This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 17/23] Use a scoped_restore for user_call_depth


On 05/03/2017 11:46 PM, Tom Tromey wrote:

> -
>  void
>  execute_user_command (struct cmd_list_element *c, char *args)
>  {
> @@ -398,15 +388,15 @@ execute_user_command (struct cmd_list_element *c, char *args)
>      return;
>  
>    scoped_user_args_level push_user_args (args);
> +  scoped_restore restore_call_depth
> +    = make_scoped_restore (&user_call_depth, user_call_depth + 1);
>  
> -  if (++user_call_depth > max_user_call_depth)
> +  if (user_call_depth > max_user_call_depth)
>      error (_("Max user call depth exceeded -- command aborted."));
>  

How about we remove the user_call_depth variable and check
user_args_stack.size () instead ?

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]