From patchwork Wed Feb 27 20:18:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31649 Received: (qmail 114403 invoked by alias); 27 Feb 2019 20:18:58 -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 114280 invoked by uid 89); 27 Feb 2019 20:18:57 -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=do_cleanups X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.150.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Feb 2019 20:18:55 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 810C8E758 for ; Wed, 27 Feb 2019 14:18:54 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id z5fKgYLiK4FKpz5fKgqAJZ; Wed, 27 Feb 2019 14:18:54 -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=tBzVq3N2bHgMRaEF8GP/o+4DmUEjup5rKtvjb01iiBg=; b=ub6YTw2/q/9EvsshCRMpE+oGjs ppbPv1YuAjAVw9Vtclzb3Zi7yApVeopYHWxkrJ38XzRbvl9jPUq41AG/I9A1QuA5kiUXQRPVpNWUW 1/zaEeLpXWZmEpfEyV8ohbSk5; Received: from 75-166-85-218.hlrn.qwest.net ([75.166.85.218]:36364 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gz5fK-004Fi1-AD; Wed, 27 Feb 2019 14:18:54 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 06/22] Remove cleanup from solib-svr4.c Date: Wed, 27 Feb 2019 13:18:33 -0700 Message-Id: <20190227201849.32210-7-tom@tromey.com> In-Reply-To: <20190227201849.32210-1-tom@tromey.com> References: <20190227201849.32210-1-tom@tromey.com> This removes a cleanup from solib-svr4.c, replacing it with make_scope_exit. gdb/ChangeLog 2019-02-27 Tom Tromey * solib-svr4.c (disable_probes_interface): Remove parameter. (svr4_handle_solib_event): Use make_scope_exit. --- gdb/ChangeLog | 5 +++++ gdb/solib-svr4.c | 40 ++++++++++------------------------------ 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 787b98ba266..2b370ef96d0 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1826,7 +1826,7 @@ solist_update_incremental (struct svr4_info *info, CORE_ADDR lm) ones set up for the probes-based interface are adequate. */ static void -disable_probes_interface_cleanup (void *arg) +disable_probes_interface () { struct svr4_info *info = get_svr4_info (); @@ -1847,7 +1847,6 @@ svr4_handle_solib_event (void) struct svr4_info *info = get_svr4_info (); struct probe_and_action *pa; enum probe_action action; - struct cleanup *old_chain; struct value *val = NULL; CORE_ADDR pc, debug_base, lm = 0; struct frame_info *frame = get_current_frame (); @@ -1858,26 +1857,20 @@ svr4_handle_solib_event (void) /* If anything goes wrong we revert to the original linker interface. */ - old_chain = make_cleanup (disable_probes_interface_cleanup, NULL); + auto cleanup = make_scope_exit (disable_probes_interface); pc = regcache_read_pc (get_current_regcache ()); pa = solib_event_probe_at (info, pc); if (pa == NULL) - { - do_cleanups (old_chain); - return; - } + return; action = solib_event_probe_action (pa); if (action == PROBES_INTERFACE_FAILED) - { - do_cleanups (old_chain); - return; - } + return; if (action == DO_NOTHING) { - discard_cleanups (old_chain); + cleanup.release (); return; } @@ -1907,25 +1900,16 @@ svr4_handle_solib_event (void) END_CATCH if (val == NULL) - { - do_cleanups (old_chain); - return; - } + return; debug_base = value_as_address (val); if (debug_base == 0) - { - do_cleanups (old_chain); - return; - } + return; /* Always locate the debug struct, in case it moved. */ info->debug_base = 0; if (locate_base (info) == 0) - { - do_cleanups (old_chain); - return; - } + return; /* GDB does not currently support libraries loaded via dlmopen into namespaces other than the initial one. We must ignore @@ -1943,7 +1927,6 @@ svr4_handle_solib_event (void) CATCH (ex, RETURN_MASK_ERROR) { exception_print (gdb_stderr, ex); - do_cleanups (old_chain); return; } END_CATCH @@ -1968,13 +1951,10 @@ svr4_handle_solib_event (void) if (action == FULL_RELOAD) { if (!solist_update_full (info)) - { - do_cleanups (old_chain); - return; - } + return; } - discard_cleanups (old_chain); + cleanup.release (); } /* Helper function for svr4_update_solib_event_breakpoints. */