aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-01-15 21:46:23 +0000
committerPedro Alves <palves@redhat.com>2016-01-15 21:46:23 +0000
commit71ef29a86b252a4780517fc9b2bf9f7d3dd2d991 (patch)
tree6906fc0e6297b079fa951857e19f15aefd7143cc /gdb/testsuite
parent3f5b7598805c8253c43c989a540a2408c8b685ad (diff)
downloadgdb-71ef29a86b252a4780517fc9b2bf9f7d3dd2d991.zip
gdb-71ef29a86b252a4780517fc9b2bf9f7d3dd2d991.tar.gz
gdb-71ef29a86b252a4780517fc9b2bf9f7d3dd2d991.tar.bz2
Star wildcard ranges (e.g., "info thread 2.*")
Add support for specifying "all threads of inferior N", by writing "*" as thread number/range in thread ID lists. E.g., "info threads 2.*" or "thread apply 2.* bt". gdb/ChangeLog: 2016-01-15 Pedro Alves <palves@redhat.com> * NEWS: Mention star wildcard ranges. * cli/cli-utils.c (get_number_or_range): Check state->in_range first. (number_range_setup_range): New function. * cli/cli-utils.h (number_range_setup_range): New declaration. * thread.c (thread_apply_command): Support star TID ranges. * tid-parse.c (tid_range_parser_finished) (tid_range_parser_string, tid_range_parser_skip) (get_tid_or_range, get_tid_or_range): Handle TID_RANGE_STATE_STAR_RANGE. (tid_range_parser_star_range): New function. * tid-parse.h (enum tid_range_state) <TID_RANGE_STATE_STAR_RANGE>: New value. (tid_range_parser_star_range): New declaration. gdb/doc/ChangeLog: 2016-01-15 Pedro Alves <palves@redhat.com> * gdb.texinfo (Threads) <thread ID lists>: Document star ranges. gdb/testsuite/ChangeLog: 2016-01-15 Pedro Alves <palves@redhat.com> * gdb.multi/tids.exp: Test star wildcard ranges.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.multi/tids.exp36
2 files changed, 40 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e5e38b3..7ba90d7 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2016-01-15 Pedro Alves <palves@redhat.com>
+ * gdb.multi/tids.exp: Test star wildcard ranges.
+
+2016-01-15 Pedro Alves <palves@redhat.com>
+
* gdb.multi/tids.exp (thr_apply_info_thr_error): Remove "p 1234"
command from "thread apply" invocation.
(thr_apply_info_thr_invalid): Default the expected output to the
diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp
index 5763234..5d8701e 100644
--- a/gdb/testsuite/gdb.multi/tids.exp
+++ b/gdb/testsuite/gdb.multi/tids.exp
@@ -277,6 +277,36 @@ with_test_prefix "two inferiors" {
"warning: Unknown thread 30.1" \
"thread apply \$inf.1"
+ # Star ranges.
+
+ thr_apply_info_thr "1.*" \
+ "1.1 1.2 1.3"
+
+ thr_apply_info_thr "*" \
+ "1.1 1.2 1.3"
+
+ thr_apply_info_thr "1.* 2.1" \
+ "1.1 1.2 1.3 2.1"
+
+ thr_apply_info_thr "2.1 1.*" \
+ "1.1 1.2 1.3 2.1" \
+ "2.1 1.1 1.2 1.3"
+
+ thr_apply_info_thr "1.* 2.*" \
+ "1.1 1.2 1.3 2.1 2.2 2.3"
+
+ thr_apply_info_thr "2.* 1.*" \
+ "1.1 1.2 1.3 2.1 2.2 2.3" \
+ "2.1 2.2 2.3 1.1 1.2 1.3"
+
+ # There's no inferior 3, but "info threads" treats the thread list
+ # as a filter, so it's OK. "thread apply" complains about the
+ # unknown inferior through.
+ info_threads "1.1 3.*" \
+ "1.1"
+ gdb_test "thread apply 1.1 3.* p 1" \
+ "Thread 1.1.*warning: Unknown inferior 3"
+
# Now test a set of invalid thread IDs/ranges.
thr_apply_info_thr_invalid "1." \
@@ -318,6 +348,11 @@ with_test_prefix "two inferiors" {
thr_apply_info_thr_error "${prefix}-\$one" "negative value"
thr_apply_info_thr_error "${prefix}\$minus_one" \
"negative value: ${prefix_re}\\\$minus_one"
+
+ thr_apply_info_thr_error "${prefix}1-*" "inverted range"
+ thr_apply_info_thr_invalid "${prefix}*1"
+ thr_apply_info_thr_invalid "${prefix}*foo"
+ thr_apply_info_thr_invalid "${prefix}foo*"
}
# Check that a valid thread ID list with a missing command errors
@@ -330,6 +365,7 @@ with_test_prefix "two inferiors" {
gdb_test "thread apply 1-2" $output
gdb_test "thread apply 1.1-2" $output
gdb_test "thread apply $thr" $output
+ gdb_test "thread apply 1.*" $output
}
# Check that we do parse the inferior number and don't confuse it.