diff options
author | Pedro Alves <palves@redhat.com> | 2019-07-02 16:34:31 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2019-07-02 16:34:31 +0100 |
commit | 54d6600669256d2b3582d7088d11ab18f6f21f0d (patch) | |
tree | 8a4e7dc737a929bad2d8d15c51c4f06382911537 /gdb/testsuite | |
parent | 1faa385ff6b11df26efc46152fe15b31adbf8624 (diff) | |
download | gdb-54d6600669256d2b3582d7088d11ab18f6f21f0d.zip gdb-54d6600669256d2b3582d7088d11ab18f6f21f0d.tar.gz gdb-54d6600669256d2b3582d7088d11ab18f6f21f0d.tar.bz2 |
Make "info threads" use the gdb::option framework
This makes "info threads" use the gdb::option framework to process
options. There's only one option today (-gid), and it isn't used much
frequently unless you're looking at matching MI output. Still, this
was in the neighborhood of "thread apply" so I had converted it.
The main advantage is that TAB completion now shows you the available
options, and gives you a hint to what the command accepts as operand
argument, including showing a metasyntactic variable:
(gdb) info threads [TAB]
-gid ID
(gdb) help info threads
Display currently known threads.
Usage: info threads [OPTION]... [ID]...
Options:
-gid
Show global thread IDs.
If ID is given, it is a space-separated list of IDs of threads to display.
Otherwise, all threads are displayed.
(gdb)
gdb/ChangeLog:
2019-07-02 Pedro Alves <palves@redhat.com>
* NEWS (Completion improvements): Mention "info threads".
* thread.c (struct info_threads_opts, info_threads_option_defs)
(make_info_threads_options_def_group): New.
(info_threads_command): Use gdb::option::process_options.
(info_threads_command_completer): New.
(_initialize_thread): Use gdb::option::build_help to build the
help text for "info threads".
gdb/testsuite/ChangeLog:
2019-07-02 Pedro Alves <palves@redhat.com>
* gdb.base/options.exp (test-info-threads): New procedure.
(top level): Call it.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/options.exp | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8b52d44..f38efbe 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-02 Pedro Alves <palves@redhat.com> + + * gdb.base/options.exp (test-info-threads): New procedure. + (top level): Call it. + 2019-06-28 Tom Tromey <tromey@adacore.com> * gdb.dwarf2/ada-linkage-name.c: New file. diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp index 4570c2a..f88e6a8 100644 --- a/gdb/testsuite/gdb.base/options.exp +++ b/gdb/testsuite/gdb.base/options.exp @@ -454,6 +454,21 @@ proc_with_prefix test-thread-apply {} { } } +# Basic option-machinery + "info threads" command integration tests. +proc_with_prefix test-info-threads {} { + test_gdb_complete_multiple "info threads " "" "" { + "-gid" + "ID" + } + + test_gdb_complete_unique \ + "info threads -" \ + "info threads -gid" + + # "ID" isn't really something the user can type. + test_gdb_complete_none "info threads I" +} + # Miscellaneous tests. proc_with_prefix test-misc {variant} { global all_options @@ -921,3 +936,6 @@ test-frame-apply # Basic "thread apply" integration tests. test-thread-apply + +# Basic "info threads" integration tests. +test-info-threads |