From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17735 invoked by alias); 13 Feb 2019 21:29:37 -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 17640 invoked by uid 89); 13 Feb 2019 21:29:37 -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=UD:pathstuff.h, pathstuff.h, pathstuffh X-HELO: gateway21.websitewelcome.com Received: from gateway21.websitewelcome.com (HELO gateway21.websitewelcome.com) (192.185.45.228) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Feb 2019 21:29:33 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway21.websitewelcome.com (Postfix) with ESMTP id B4FD5400C915F for ; Wed, 13 Feb 2019 15:29:31 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id u25zg2uHNdnCeu25zg1qNo; Wed, 13 Feb 2019 15:29:31 -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=nLV2NKcLcZOgApdhMu6nFbfZ58FT9MIqrjBCsprGZ4o=; b=fYXoHtHfKAE4CW3vAWTFEYzXx0 KKhIeFogQjqCExoh58V+73FrcaFG7MWbSUCUstzWMHpxUnaF7M/yYxNS5ATB3D/AkBnPfZd+AzH+D pXyfScmP7vKOKPQbqGqdLI6FF; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:42554 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gu25z-001UWe-Gn; Wed, 13 Feb 2019 15:29:31 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 05/20] Remove last cleanup from gdbserver Date: Wed, 13 Feb 2019 21:29:00 -0000 Message-Id: <20190213212927.9474-6-tom@tromey.com> In-Reply-To: <20190213212927.9474-1-tom@tromey.com> References: <20190213212927.9474-1-tom@tromey.com> X-SW-Source: 2019-02/txt/msg00189.txt.bz2 This removes the last cleanup from gdbserver, replacing it with SCOPE_EXIT. This could perhaps be done in a different way, but this approach was direct and obviously correct. gdb/gdbserver/ChangeLog 2019-02-13 Tom Tromey * server.c (detach_or_kill_for_exit_cleanup): Remove parameter. (captured_main): Use SCOPE_EXIT. --- gdb/gdbserver/ChangeLog | 5 +++++ gdb/gdbserver/server.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index e960c10d402..25c62aad830 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -43,6 +43,7 @@ #include "common/pathstuff.h" #include "common/selftest.h" +#include "common/scope-exit.h" #define require_running_or_return(BUF) \ if (!target_running ()) \ @@ -3545,17 +3546,16 @@ detach_or_kill_for_exit (void) /* Value that will be passed to exit(3) when gdbserver exits. */ static int exit_code; -/* Cleanup version of detach_or_kill_for_exit. */ +/* Wrapper for detach_or_kill_for_exit that catches and prints + errors. */ static void -detach_or_kill_for_exit_cleanup (void *ignore) +detach_or_kill_for_exit_cleanup () { - TRY { detach_or_kill_for_exit (); } - CATCH (exception, RETURN_MASK_ALL) { fflush (stdout); @@ -3832,7 +3832,8 @@ captured_main (int argc, char *argv[]) cs.last_status.value.integer = 0; cs.last_ptid = minus_one_ptid; } - make_cleanup (detach_or_kill_for_exit_cleanup, NULL); + + SCOPE_EXIT { detach_or_kill_for_exit_cleanup (); }; /* Don't report shared library events on the initial connection, even if some libraries are preloaded. Avoids the "stopped by -- 2.17.2