From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36811 invoked by alias); 9 Jan 2019 03:34:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 36564 invoked by uid 89); 9 Jan 2019 03:34:33 -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,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (50.116.125.2) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Jan 2019 03:34:31 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 06EC74011F54A for ; Tue, 8 Jan 2019 20:46:34 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id h4dSgfgdE2qH7h4dSgKYsO; Tue, 08 Jan 2019 21:34:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZymRVxv2MGU/XjkDYNBpPx8rt/pX50VmyiR5qeHxaJg=; b=Du78rZ8L+6v4eiJbyc0jmaNuhX HJEiGYffC3hKuzkkab+r8p+2zWLJnxXNxm7yUWp7estZAW0KOE5O24KgthhtUvgUTetS9xSgUCJLA nD462RHncP/PJKXdMq2AcHkUG; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:47026 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gh4dR-000HG2-Ue; Tue, 08 Jan 2019 21:34:30 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 05/12] Remove cleanup from linux-nat.c Date: Wed, 09 Jan 2019 03:34:00 -0000 Message-Id: <20190109033426.16062-6-tom@tromey.com> In-Reply-To: <20190109033426.16062-1-tom@tromey.com> References: <20190109033426.16062-1-tom@tromey.com> X-SW-Source: 2019-01/txt/msg00166.txt.bz2 This removes a cleanup from linux-nat.c, replacing it with a cleanup_function. gdb/ChangeLog 2019-01-08 Tom Tromey * linux-nat.c (cleanup_target_stop): Remove. (linux_nat_target::static_tracepoint_markers_by_strid): Use cleanup_function. --- gdb/ChangeLog | 6 ++++++ gdb/linux-nat.c | 23 ++++++++--------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 73d4fd193a..d1c4707b4b 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/cleanup-function.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,13 @@ 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); + auto continue_func + = [=] () + { + /* Unpause all */ + target_continue_no_signal (ptid); + }; + cleanup_function continue_at_end (continue_func); while (*p++ == 'm') { @@ -4272,8 +4267,6 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid) p = s; } - do_cleanups (old_chain); - return markers; } -- 2.17.2