aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2019-06-13 00:06:53 +0100
committerPedro Alves <palves@redhat.com>2019-06-13 00:22:07 +0100
commit5d7071341dd3c01d38fc01398ef8b23b1bd3783c (patch)
tree62f105b390f2950fe27f33439a9b0cbee921b5b8 /gdb/stack.h
parent272d4594343349a713f7d8967d90ae2413ecbc30 (diff)
downloadgdb-5d7071341dd3c01d38fc01398ef8b23b1bd3783c.zip
gdb-5d7071341dd3c01d38fc01398ef8b23b1bd3783c.tar.gz
gdb-5d7071341dd3c01d38fc01398ef8b23b1bd3783c.tar.bz2
Make "frame apply" support -OPT options
This adds support for '-'-style options to the "frame apply" family of commands -- "frame apply COUNT", "frame apply level", "frame apply all", "faas" and "tfaas". The -q/-c/-s flags were already supported, -past-main/-past-entry is new: ~~~ (gdb) help frame apply all Apply a command to all frames. Usage: frame apply all [OPTION]... COMMAND Prints the frame location information followed by COMMAND output. By default, an error raised during the execution of COMMAND aborts "frame apply". Options: -q Disables printing the frame location information. -c Print any error raised by COMMAND and continue. -s Silently ignore any errors or empty output produced by COMMAND. -past-main [on|off] Set whether backtraces should continue past "main". Normally the caller of "main" is not of interest, so GDB will terminate the backtrace at "main". Set this if you need to see the rest of the stack trace. -past-entry [on|off] Set whether backtraces should continue past the entry point of a program. Normally there are no callers beyond the entry point of a program, so GDB will terminate the backtrace there. Set this if you need to see the rest of the stack trace. ~~~ TAB completion of options is now supported. Also, TAB completion of COMMAND in "frame apply all COMMAND" does the right thing now, making use of complete_command, added by the previous patch. E.g.: (gdb) thread apply all -ascending frame apply all -past-main print -[TAB] -address -elements -pretty -symbol -array -null-stop -repeats -union -array-indexes -object -static-members -vtbl (gdb) thread apply all -ascending frame apply all -past-main print glo[TAB] global1 global2 The change to tfaas_command is necessary because otherwise you get this: (gdb) tfaas -- Unrecognized option at: frame apply all -s -- That's because the above is equivalent to: (gdb) thread apply all -s frame apply all -s -- and the "--" instructs "thread apply" to consider everything up to "--" as its command options. And from that view, "frame" is an invalid option. The change makes tfaas be equivalent to: (gdb) thread apply all -s -- frame apply all -s -- gdb/ChangeLog: 2019-06-13 Pedro Alves <palves@redhat.com> * cli/cli-utils.c (parse_flags_qcs): Use validate_flags_qcs. (validate_flags_qcs): New. * cli/cli-utils.h (struct qcs_flags): Change field types to int. (validate_flags_qcs): Declare. * stack.c (qcs_flag_option_def, fr_qcs_flags_option_defs): New. (make_frame_apply_options_def_group): New. (frame_apply_command_count): Process options with gdb::option::process_options. (frame_apply_completer): New. (frame_apply_level_completer, frame_apply_all_completer) (frame_apply_completer): New. (_initialize_stack): Update help of "frame apply", "frame apply level", "frame apply all" and "faas" to mention supported options and install command completers. * stack.h (frame_apply_all_completer): Declare. * thread.c: Include "stack.h". (tfaas_command): Add "--". (_initialize_thread): Update help "tfaas" to mention supported options and install command completer. gdb/testsuite/ChangeLog: 2019-06-13 Pedro Alves <palves@redhat.com> * gdb.base/options.exp (test-frame-apply): New. (top level): Test print commands with different "frame apply" prefixes.
Diffstat (limited to 'gdb/stack.h')
-rw-r--r--gdb/stack.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/stack.h b/gdb/stack.h
index 6c6caa9..9ac77c0 100644
--- a/gdb/stack.h
+++ b/gdb/stack.h
@@ -52,4 +52,9 @@ struct symtab* get_last_displayed_symtab (void);
int get_last_displayed_line (void);
symtab_and_line get_last_displayed_sal ();
+/* Completer for the "frame apply all" command. */
+void frame_apply_all_cmd_completer (struct cmd_list_element *ignore,
+ completion_tracker &tracker,
+ const char *text, const char */*word*/);
+
#endif /* #ifndef STACK_H */