From 71ef29a86b252a4780517fc9b2bf9f7d3dd2d991 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 15 Jan 2016 21:46:23 +0000 Subject: 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 * 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) : New value. (tid_range_parser_star_range): New declaration. gdb/doc/ChangeLog: 2016-01-15 Pedro Alves * gdb.texinfo (Threads) : Document star ranges. gdb/testsuite/ChangeLog: 2016-01-15 Pedro Alves * gdb.multi/tids.exp: Test star wildcard ranges. --- gdb/thread.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gdb/thread.c') diff --git a/gdb/thread.c b/gdb/thread.c index 56de6e1..c7f1467 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1864,6 +1864,26 @@ thread_apply_command (char *tidlist, int from_tty) inf = find_inferior_id (inf_num); if (inf != NULL) tp = find_thread_id (inf, thr_num); + + if (tid_range_parser_star_range (&parser)) + { + if (inf == NULL) + { + warning (_("Unknown inferior %d"), inf_num); + tid_range_parser_skip (&parser); + continue; + } + + /* No use looking for threads past the highest thread number + the inferior ever had. */ + if (thr_num >= inf->highest_thread_num) + tid_range_parser_skip (&parser); + + /* Be quiet about unknown threads numbers. */ + if (tp == NULL) + continue; + } + if (tp == NULL) { if (show_inferior_qualified_tids () -- cgit v1.1