From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70165 invoked by alias); 25 Jul 2017 17:21:53 -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 70107 invoked by uid 89); 25 Jul 2017 17:21:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 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: gproxy7-pub.mail.unifiedlayer.com Received: from gproxy7-pub.mail.unifiedlayer.com (HELO gproxy7-pub.mail.unifiedlayer.com) (70.40.196.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Jul 2017 17:21:51 +0000 Received: from cmgw4 (unknown [10.0.90.85]) by gproxy7.mail.unifiedlayer.com (Postfix) with ESMTP id 1155821616E for ; Tue, 25 Jul 2017 11:21:23 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id p5ML1v0032f2jeq015MPTo; Tue, 25 Jul 2017 11:21:23 -0600 X-Authority-Analysis: v=2.2 cv=G/hsK5s5 c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=G3gG6ho9WtcA:10 a=zstS-IiYAAAA:8 a=ZEK3q9eOBVY12OTiWuAA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 174-29-39-24.hlrn.qwest.net ([174.29.39.24]:55470 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1da3WJ-0015gW-Qn; Tue, 25 Jul 2017 11:21:19 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 18/24] Use a scoped_restore for command_nest_depth Date: Tue, 25 Jul 2017 17:21:00 -0000 Message-Id: <20170725172107.9799-19-tom@tromey.com> In-Reply-To: <20170725172107.9799-1-tom@tromey.com> References: <20170725172107.9799-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1da3WJ-0015gW-Qn X-Source-Sender: 174-29-39-24.hlrn.qwest.net (bapiya.Home) [174.29.39.24]:55470 X-Source-Auth: tom+tromey.com X-Email-Count: 19 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-07/txt/msg00376.txt.bz2 This changes a couple of places to use a scoped_restore when manipulating command_nest_depth. ChangeLog 2017-07-25 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 f81185a..38f2613 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-07-25 Tom Tromey + * cli/cli-script.c (execute_user_command) + (execute_control_command): Use scoped_restore. + +2017-07-25 Tom Tromey + * cli/cli-script.c (do_restore_user_call_depth): Remove. (execute_user_command): Remove user_call_depth; use user_args_stack's size instead. diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index edaebef..6ce532b 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) -- 2.9.3