From patchwork Wed May 3 22:46:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 20255 Received: (qmail 52378 invoked by alias); 3 May 2017 22:46:41 -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 52240 invoked by uid 89); 3 May 2017 22:46:40 -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: gproxy3.mail.unifiedlayer.com Received: from gproxy3-pub.mail.unifiedlayer.com (HELO gproxy3.mail.unifiedlayer.com) (69.89.30.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 May 2017 22:46:37 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy3.mail.unifiedlayer.com (Postfix) with ESMTP id CB5DA400AF for ; Wed, 3 May 2017 16:46:39 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id Fymc1v00X2f2jeq01ymfNk; Wed, 03 May 2017 16:46:39 -0600 X-Authority-Analysis: v=2.2 cv=K+5SJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=tJ8p9aeEuA8A:10 a=zstS-IiYAAAA:8 a=5vPJ8OrGAzSWGVq7TyIA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-63-71.hlrn.qwest.net ([75.166.63.71]:53090 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1d632a-00051x-If; Wed, 03 May 2017 16:46:36 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 18/23] Use a scoped_restore for command_nest_depth Date: Wed, 3 May 2017 16:46:21 -0600 Message-Id: <20170503224626.2818-19-tom@tromey.com> In-Reply-To: <20170503224626.2818-1-tom@tromey.com> References: <20170503224626.2818-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1d632a-00051x-If X-Source-Sender: 75-166-63-71.hlrn.qwest.net (bapiya.Home) [75.166.63.71]:53090 X-Source-Auth: tom+tromey.com X-Email-Count: 25 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== This changes a couple of places to use a scoped_restore when manipulating command_nest_depth. 2017-05-02 Tom Tromey * cli/cli-script.c (execute_user_command) (execute_control_command): Use scoped_restore. --- gdb/ChangeLog | 5 +++++ gdb/cli/cli-script.c | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 873b404..a27feda 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-05-02 Tom Tromey + * cli/cli-script.c (execute_user_command) + (execute_control_command): Use scoped_restore. + +2017-05-02 Tom Tromey + * cli/cli-script.c (do_restore_user_call_depth): Remove. (execute_user_command): Use scoped_restore. diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 7f90d27..c0e6716 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -401,7 +401,8 @@ execute_user_command (struct cmd_list_element *c, char *args) scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0); - command_nest_depth++; + scoped_restore save_nesting + = make_scoped_restore (&command_nest_depth, command_nest_depth + 1); while (cmdlines) { ret = execute_control_command (cmdlines); @@ -412,7 +413,6 @@ execute_user_command (struct cmd_list_element *c, char *args) } cmdlines = cmdlines->next; } - command_nest_depth--; do_cleanups (old_chain); } @@ -532,9 +532,9 @@ execute_control_command (struct command_line *cmd) current = *cmd->body_list; while (current) { - command_nest_depth++; + scoped_restore save_nesting + = make_scoped_restore (&command_nest_depth, command_nest_depth + 1); ret = execute_control_command (current); - command_nest_depth--; /* If we got an error, or a "break" command, then stop looping. */ @@ -591,9 +591,9 @@ execute_control_command (struct command_line *cmd) /* Execute commands in the given arm. */ while (current) { - command_nest_depth++; + scoped_restore save_nesting + = make_scoped_restore (&command_nest_depth, command_nest_depth + 1); ret = execute_control_command (current); - command_nest_depth--; /* If we got an error, get out. */ if (ret != simple_control)