aboutsummaryrefslogtreecommitdiff
path: root/gdb/tid-parse.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2019-06-13 00:06:54 +0100
committerPedro Alves <palves@redhat.com>2019-06-13 00:23:25 +0100
commit6665660a411ead049daa85cac5c629d637e22044 (patch)
tree7a28a95777f94ced2128db5f8fd0067021eda951 /gdb/tid-parse.c
parentf7e13587eaf1e2d433e21ac0a9e413a98e53652d (diff)
downloadgdb-6665660a411ead049daa85cac5c629d637e22044.zip
gdb-6665660a411ead049daa85cac5c629d637e22044.tar.gz
gdb-6665660a411ead049daa85cac5c629d637e22044.tar.bz2
Make "thread apply" use the gdb::option framework
Similarly to the "frame apply" patch, this makes the "thread apply" family of commands -- "thread apply TID", "thread apply all" and "taas" use the gdb::option framework for '-'-style options. No new options are added, but there are some user-visible changes: - Can now abbreviate and complete "-ascending" - We now have a completer for "thread apply" commands Can now complete options ("thread apply all -[TAB]"), and also, 'thread apply all COMMAND[TAB]' now does what you'd expect, by making use of the new complete_command routine. - "help" output tweaked with auto-generated option descriptions: ~~~ Usage: thread apply all [OPTION]... COMMAND Prints per-inferior thread number and target system's thread id followed by COMMAND output. By default, an error raised during the execution of COMMAND aborts "thread apply". Options: -ascending Call COMMAND for all threads in ascending order. The default is descending order. -q Disables printing the thread information. -c Print any error raised by COMMAND and continue. -s Silently ignore any errors or empty output produced by COMMAND. ~~~ The "By default ..." sentence is new as well. gdb/ChangeLog: 2019-06-13 Pedro Alves <palves@redhat.com> * thread.c: Include "cli/cli-option.h". (tp_array_compar_ascending): Global. (tp_array_compar): Delete function. (tp_array_compar_ascending, tp_array_compar_descending): New functions. (ascending_option_def, qcs_flag_option_def) (thr_qcs_flags_option_defs) (make_thread_apply_all_options_def_group) (make_thread_apply_options_def_group): New. (thread_apply_all_command): Use gdb::option::process_options. (thread_apply_command_completer) (thread_apply_all_command_completer): New. (thread_apply_command): Use gdb::option::process_options. (_initialize_thread): Delete THREAD_APPLY_FLAGS_HELP, replace it with a new THREAD_APPLY_OPTION_HELP. Use gdb::option::build_help to generate help text of "thread apply". Adjust "taas"'s help. * tid-parse.c (tid_range_parser::in_thread_range): New method. * tid-parse.h (tid_range_parser::in_thread_range): New method. gdb/testsuite/ChangeLog: 2019-06-13 Pedro Alves <palves@redhat.com> * gdb.base/options.exp (test-thread-apply): New. (top level): Call it.
Diffstat (limited to 'gdb/tid-parse.c')
-rw-r--r--gdb/tid-parse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/tid-parse.c b/gdb/tid-parse.c
index 07d7d2c..6ad8b1f 100644
--- a/gdb/tid-parse.c
+++ b/gdb/tid-parse.c
@@ -307,6 +307,12 @@ tid_range_parser::in_star_range () const
return m_state == STATE_STAR_RANGE;
}
+bool
+tid_range_parser::in_thread_range () const
+{
+ return m_state == STATE_THREAD_RANGE;
+}
+
/* See tid-parse.h. */
int