diff options
author | Tom Tromey <tom@tromey.com> | 2017-04-30 21:15:58 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-08-03 07:59:05 -0600 |
commit | b51b225eb9b03b627967108ee3de38ada5de219d (patch) | |
tree | 561756a2e1e30a326c9b5653522393b3e279d3b3 /gdb/cli | |
parent | ac991630ca57ba6a00d0d1358786164248d140fc (diff) | |
download | gdb-b51b225eb9b03b627967108ee3de38ada5de219d.zip gdb-b51b225eb9b03b627967108ee3de38ada5de219d.tar.gz gdb-b51b225eb9b03b627967108ee3de38ada5de219d.tar.bz2 |
Use a scoped_restore for command_nest_depth
This changes a couple of places to use a scoped_restore when
manipulating command_nest_depth.
ChangeLog
2017-08-03 Tom Tromey <tom@tromey.com>
* cli/cli-script.c (execute_user_command)
(execute_control_command): Use scoped_restore.
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-script.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 36aa371..d8dfbfc 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -398,7 +398,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); @@ -409,7 +410,6 @@ execute_user_command (struct cmd_list_element *c, char *args) } cmdlines = cmdlines->next; } - command_nest_depth--; do_cleanups (old_chain); } @@ -529,9 +529,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. */ @@ -588,9 +588,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) |