gdb: Make use of gdb::option framework for some info commands

Update the 'info variables', 'info functions', 'info locals', and
'info args' commands to make use of the gdb::options framework.

There should be no user visible changes after this commit as I have
left the help text generation using the existing mechanism, which
already tries to customise the text for each of the commands.

gdb/ChangeLog:

	* cli/cli-utils.c (extract_info_print_args): Delete.
	(extract_arg_maybe_quoted): Delete.
	(info_print_options_defs): New variable.
	(make_info_print_options_def_group): New function.
	(extract_info_print_options): Define new function.
	* cli/cli-utils.h (extract_info_print_args): Delete.
	(struct info_print_options): New structure.
	(extract_info_print_options): Declare new function.
	* stack.c (info_locals_command): Update to use new
	extract_info_print_options, also add a header comment.
	(info_args_command): Likewise.
	* symtab.c (info_variables_command): Likewise.
	(info_functions_command): Likewise.
This commit is contained in:
Andrew Burgess 2019-07-10 22:52:38 +01:00
parent 021d8588f6
commit b16507e091
5 changed files with 96 additions and 168 deletions

View file

@ -2359,24 +2359,16 @@ print_frame_local_vars (struct frame_info *frame,
}
}
/* Implement the 'info locals' command. */
void
info_locals_command (const char *args, int from_tty)
{
std::string regexp;
std::string t_regexp;
bool quiet = false;
while (args != NULL
&& extract_info_print_args (&args, &quiet, &regexp, &t_regexp))
;
if (args != NULL)
report_unrecognized_option_error ("info locals", args);
info_print_options opts;
extract_info_print_options (&opts, &args);
print_frame_local_vars (get_selected_frame (_("No frame selected.")),
quiet,
regexp.empty () ? NULL : regexp.c_str (),
t_regexp.empty () ? NULL : t_regexp.c_str (),
opts.quiet, args, opts.type_regexp,
0, gdb_stdout);
}
@ -2474,26 +2466,16 @@ print_frame_arg_vars (struct frame_info *frame,
}
}
/* Implement the 'info args' command. */
void
info_args_command (const char *args, int from_tty)
{
std::string regexp;
std::string t_regexp;
bool quiet = false;
while (args != NULL
&& extract_info_print_args (&args, &quiet, &regexp, &t_regexp))
;
if (args != NULL)
report_unrecognized_option_error ("info args", args);
info_print_options opts;
extract_info_print_options (&opts, &args);
print_frame_arg_vars (get_selected_frame (_("No frame selected.")),
quiet,
regexp.empty () ? NULL : regexp.c_str (),
t_regexp.empty () ? NULL : t_regexp.c_str (),
gdb_stdout);
opts.quiet, args, opts.type_regexp, gdb_stdout);
}
/* Return the symbol-block in which the selected frame is executing.