diff options
author | Yao Qi <yao@codesourcery.com> | 2013-08-01 06:42:59 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2013-08-01 06:42:59 +0000 |
commit | 645eab03a932e03adc9b34feba086835a38ea471 (patch) | |
tree | dc0a8a2cc591bd24c870368d34279bf4c7c2a002 | |
parent | 67d21849b027b607128d19e82a5e9dc1652ae81f (diff) | |
download | gdb-645eab03a932e03adc9b34feba086835a38ea471.zip gdb-645eab03a932e03adc9b34feba086835a38ea471.tar.gz gdb-645eab03a932e03adc9b34feba086835a38ea471.tar.bz2 |
gdb/
* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Parse argv
with mi_getopt.
(mi_cmd_stack_list_variables): Likewise.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 79 |
2 files changed, 75 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ba2105b..6ded2a9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2013-08-01 Yao Qi <yao@codesourcery.com> + + * mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Parse argv + with mi_getopt. + (mi_cmd_stack_list_variables): Likewise. + 2013-07-31 Andrew Burgess <aburgess@broadcom.com> * exceptions.c (deprecated_throw_reason): Remove. diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 1f1068c..70ff0b6 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -212,16 +212,46 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc) int raw_arg = 0; enum py_bt_status result = PY_BT_ERROR; int print_value; + int oind = 0; - if (argc > 0) - raw_arg = parse_no_frames_option (argv[0]); + if (argc > 1) + { + int i; + enum opt + { + NO_FRAME_FILTERS + }; + static const struct mi_opt opts[] = + { + {"-no-frame-filters", NO_FRAME_FILTERS, 0}, + { 0, 0, 0 } + }; + + while (1) + { + char *oarg; + /* Don't parse 'print-values' as an option. */ + int opt = mi_getopt ("-stack-list-locals", argc - 1, argv, + opts, &oind, &oarg); + + if (opt < 0) + break; + switch ((enum opt) opt) + { + case NO_FRAME_FILTERS: + raw_arg = oind; + break; + } + } + } - if (argc < 1 || argc > 2 || (argc == 2 && ! raw_arg) - || (argc == 1 && raw_arg)) + /* After the last option is parsed, there should be only + 'print-values'. */ + if (argc - oind != 1) error (_("-stack-list-locals: Usage: [--no-frame-filters] PRINT_VALUES")); frame = get_selected_frame (NULL); - print_value = mi_parse_print_values (argv[raw_arg]); + print_value = mi_parse_print_values (argv[oind]); if (! raw_arg && frame_filters) { @@ -341,17 +371,46 @@ mi_cmd_stack_list_variables (char *command, char **argv, int argc) int raw_arg = 0; enum py_bt_status result = PY_BT_ERROR; int print_value; + int oind = 0; - if (argc > 0) - raw_arg = parse_no_frames_option (argv[0]); + if (argc > 1) + { + int i; + enum opt + { + NO_FRAME_FILTERS + }; + static const struct mi_opt opts[] = + { + {"-no-frame-filters", NO_FRAME_FILTERS, 0}, + { 0, 0, 0 } + }; + + while (1) + { + char *oarg; + /* Don't parse 'print-values' as an option. */ + int opt = mi_getopt ("-stack-list-variables", argc - 1, + argv, opts, &oind, &oarg); + if (opt < 0) + break; + switch ((enum opt) opt) + { + case NO_FRAME_FILTERS: + raw_arg = oind; + break; + } + } + } - if (argc < 1 || argc > 2 || (argc == 2 && ! raw_arg) - || (argc == 1 && raw_arg)) + /* After the last option is parsed, there should be only + 'print-values'. */ + if (argc - oind != 1) error (_("-stack-list-variables: Usage: " \ "[--no-frame-filters] PRINT_VALUES")); frame = get_selected_frame (NULL); - print_value = mi_parse_print_values (argv[raw_arg]); + print_value = mi_parse_print_values (argv[oind]); if (! raw_arg && frame_filters) { |