diff options
author | Tom Tromey <tom@tromey.com> | 2017-04-30 21:08:31 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-08-03 07:59:04 -0600 |
commit | ac991630ca57ba6a00d0d1358786164248d140fc (patch) | |
tree | a75397503ae9fd87b8ed15c51c7bb5793e42e31f /gdb | |
parent | 898e0c8e879394ce0fb8a08fe85929a29f3ce55b (diff) | |
download | gdb-ac991630ca57ba6a00d0d1358786164248d140fc.zip gdb-ac991630ca57ba6a00d0d1358786164248d140fc.tar.gz gdb-ac991630ca57ba6a00d0d1358786164248d140fc.tar.bz2 |
Remove user_call_depth
This changes execute_user_command to remove user_call_depth, using the
size of user_args_stack instead. This avoids a cleanup.
ChangeLog
2017-08-03 Tom Tromey <tom@tromey.com>
* cli/cli-script.c (do_restore_user_call_depth): Remove.
(execute_user_command): Remove user_call_depth; use
user_args_stack's size instead.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/cli/cli-script.c | 17 |
2 files changed, 8 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f7ccc82..be5fd55 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2017-08-03 Tom Tromey <tom@tromey.com> + * cli/cli-script.c (do_restore_user_call_depth): Remove. + (execute_user_command): Remove user_call_depth; use + user_args_stack's size instead. + +2017-08-03 Tom Tromey <tom@tromey.com> + * top.h (in_user_command): Remove. * top.c (in_user_command): Remove. * cli/cli-script.c (do_restore_user_call_depth) diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 527540a..36aa371 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -372,16 +372,6 @@ execute_cmd_post_hook (struct cmd_list_element *c) } } -/* Execute the command in CMD. */ -static void -do_restore_user_call_depth (void * call_depth) -{ - int *depth = (int *) call_depth; - - (*depth)--; -} - - void execute_user_command (struct cmd_list_element *c, char *args) { @@ -389,7 +379,6 @@ execute_user_command (struct cmd_list_element *c, char *args) struct command_line *cmdlines; struct cleanup *old_chain; enum command_control_type ret; - static int user_call_depth = 0; extern unsigned int max_user_call_depth; cmdlines = c->user_commands; @@ -399,14 +388,12 @@ execute_user_command (struct cmd_list_element *c, char *args) scoped_user_args_level push_user_args (args); - if (++user_call_depth > max_user_call_depth) + if (user_args_stack.size () > max_user_call_depth) error (_("Max user call depth exceeded -- command aborted.")); - old_chain = make_cleanup (do_restore_user_call_depth, &user_call_depth); - /* Set the instream to 0, indicating execution of a user-defined function. */ - make_cleanup (do_restore_instream_cleanup, ui->instream); + old_chain = make_cleanup (do_restore_instream_cleanup, ui->instream); ui->instream = NULL; scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0); |