From patchwork Wed Jan 23 15:21:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 31188 Received: (qmail 65523 invoked by alias); 23 Jan 2019 15:21:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 65430 invoked by uid 89); 23 Jan 2019 15:21:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=markers X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Jan 2019 15:21:47 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA0A5C71AF; Wed, 23 Jan 2019 15:21:45 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12A2467143; Wed, 23 Jan 2019 15:21:44 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Cc: Tom Tromey , Andrew Burgess Subject: [PATCH v3 11/17] Remove cleanup from linux-nat.c Date: Wed, 23 Jan 2019 15:21:25 +0000 Message-Id: <20190123152131.29893-12-palves@redhat.com> In-Reply-To: <20190123152131.29893-1-palves@redhat.com> References: <20190123152131.29893-1-palves@redhat.com> From: Tom Tromey This removes a cleanup from linux-nat.c, replacing it with a scope_exit. gdb/ChangeLog: yyyy-mm-dd Tom Tromey Pedro Alves * linux-nat.c: Include scope-exit.h. (cleanup_target_stop): Remove. (linux_nat_target::static_tracepoint_markers_by_strid): Use SCOPE_EXIT. --- gdb/linux-nat.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index c0d5f8dc66..45da9fa997 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -66,6 +66,7 @@ #include "objfiles.h" #include "nat/linux-namespaces.h" #include "fileio.h" +#include "common/scope-exit.h" #ifndef SPUFS_MAGIC #define SPUFS_MAGIC 0x23c9b64e @@ -4223,22 +4224,10 @@ linux_nat_xfer_osdata (enum target_object object, return TARGET_XFER_OK; } -static void -cleanup_target_stop (void *arg) -{ - ptid_t *ptid = (ptid_t *) arg; - - gdb_assert (arg != NULL); - - /* Unpause all */ - target_continue_no_signal (*ptid); -} - std::vector linux_nat_target::static_tracepoint_markers_by_strid (const char *strid) { char s[IPA_CMD_BUF_SIZE]; - struct cleanup *old_chain; int pid = inferior_ptid.pid (); std::vector markers; const char *p = s; @@ -4253,7 +4242,8 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid) agent_run_command (pid, s, strlen (s) + 1); - old_chain = make_cleanup (cleanup_target_stop, &ptid); + /* Unpause all. */ + SCOPE_EXIT { target_continue_no_signal (ptid); }; while (*p++ == 'm') { @@ -4272,8 +4262,6 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid) p = s; } - do_cleanups (old_chain); - return markers; }