diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-07-10 22:52:38 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-07-11 20:18:17 +0100 |
commit | b16507e0917169555f8bbfcb1d6c9685813ccf6c (patch) | |
tree | 192bf877c552f553987b353e04f15dc710962b46 /gdb/symtab.c | |
parent | 021d8588f6ca843a2aada955d00851fbb62f8a62 (diff) | |
download | gdb-b16507e0917169555f8bbfcb1d6c9685813ccf6c.zip gdb-b16507e0917169555f8bbfcb1d6c9685813ccf6c.tar.gz gdb-b16507e0917169555f8bbfcb1d6c9685813ccf6c.tar.bz2 |
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.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 01118c6..4669112 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4687,6 +4687,9 @@ symtab_symbol_info (bool quiet, gdb_assert (kind <= TYPES_DOMAIN); + if (regexp != nullptr && *regexp == '\0') + regexp = nullptr; + /* Must make sure that if we're interrupted, symbols gets freed. */ std::vector<symbol_search> symbols = search_symbols (regexp, kind, t_regexp, 0, NULL); @@ -4742,47 +4745,28 @@ symtab_symbol_info (bool quiet, } } +/* Implement the 'info variables' command. */ + static void info_variables_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, ®exp, &t_regexp)) - ; + info_print_options opts; + extract_info_print_options (&opts, &args); - if (args != NULL) - report_unrecognized_option_error ("info variables", args); - - symtab_symbol_info (quiet, - regexp.empty () ? NULL : regexp.c_str (), - VARIABLES_DOMAIN, - t_regexp.empty () ? NULL : t_regexp.c_str (), - from_tty); + symtab_symbol_info (opts.quiet, args, VARIABLES_DOMAIN, + opts.type_regexp, from_tty); } +/* Implement the 'info functions' command. */ static void info_functions_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, ®exp, &t_regexp)) - ; - - if (args != NULL) - report_unrecognized_option_error ("info functions", args); + info_print_options opts; + extract_info_print_options (&opts, &args); - symtab_symbol_info (quiet, - regexp.empty () ? NULL : regexp.c_str (), - FUNCTIONS_DOMAIN, - t_regexp.empty () ? NULL : t_regexp.c_str (), - from_tty); + symtab_symbol_info (opts.quiet, args, FUNCTIONS_DOMAIN, + opts.type_regexp, from_tty); } |