From patchwork Tue Sep 12 18:57:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 22855 Received: (qmail 117325 invoked by alias); 12 Sep 2017 18:57:51 -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 117150 invoked by uid 89); 12 Sep 2017 18:57:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy9-pub.mail.unifiedlayer.com Received: from gproxy9-pub.mail.unifiedlayer.com (HELO gproxy9-pub.mail.unifiedlayer.com) (69.89.20.122) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Sep 2017 18:57:47 +0000 Received: from cmgw4 (unknown [10.0.90.85]) by gproxy9.mail.unifiedlayer.com (Postfix) with ESMTP id EEB421E0703 for ; Tue, 12 Sep 2017 12:57:45 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id 8ixi1w01U2f2jeq01ixlA8; Tue, 12 Sep 2017 12:57:45 -0600 X-Authority-Analysis: v=2.2 cv=OZLoNlbY c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=BtGWBE0F8XtXLiHqXNUA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:46142 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1drqNS-001eRR-P6; Tue, 12 Sep 2017 12:57:42 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 11/11] Change captured_mi_execute_command to use scoped_restore Date: Tue, 12 Sep 2017 12:57:36 -0600 Message-Id: <20170912185736.20436-12-tom@tromey.com> In-Reply-To: <20170912185736.20436-1-tom@tromey.com> References: <20170912185736.20436-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1drqNS-001eRR-P6 X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya.Home) [75.166.76.94]:46142 X-Source-Auth: tom+tromey.com X-Email-Count: 12 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes Change captured_mi_execute_command to use a scoped_restore, removing a cleanup. The old code copied the current token, but I don't believe that is necessary. ChangeLog 2017-09-12 Tom Tromey * mi/mi-main.c (captured_mi_execute_command): Use scope_restore. --- gdb/ChangeLog | 4 ++++ gdb/mi/mi-main.c | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ee965c4..773f35d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2017-09-12 Tom Tromey + * mi/mi-main.c (captured_mi_execute_command): Use scope_restore. + +2017-09-12 Tom Tromey + * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Update. * ada-lang.h (struct ada_exc_info): Remove typedef. Declare operator< and operator==. diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 3d73446..3e5eca2 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1870,20 +1870,19 @@ mi_cmd_remove_inferior (const char *command, char **argv, int argc) Return <0 for error; >=0 for ok. args->action will tell mi_execute_command what action - to perfrom after the given command has executed (display/suppress + to perform after the given command has executed (display/suppress prompt, display error). */ static void captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context) { struct mi_interp *mi = (struct mi_interp *) command_interp (); - struct cleanup *cleanup; if (do_timings) current_command_ts = context->cmd_start; - current_token = xstrdup (context->token); - cleanup = make_cleanup (free_current_contents, ¤t_token); + scoped_restore save_token = make_scoped_restore (¤t_token, + context->token); running_result_record_printed = 0; mi_proceeded = 0; @@ -1959,8 +1958,6 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context) break; } } - - do_cleanups (cleanup); } /* Print a gdb exception to the MI output stream. */