X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fthread.c;h=75bfb4771b268df7fafb09efe86608fbc9061ef5;hb=2b2798cc9716f45f752ea03411b6f9c9afc17cc6;hp=b3b3995d60e6f6d0160568f6a64981ee6108031d;hpb=c0518081f09298c67d1e74e0cc592fde8e0c6571;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/thread.c b/gdb/thread.c index b3b3995d60..75bfb4771b 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1684,6 +1684,14 @@ make_cleanup_restore_current_thread (void) /* See gdbthread.h. */ +int +show_thread_that_caused_stop (void) +{ + return highest_thread_num > 1; +} + +/* See gdbthread.h. */ + int show_inferior_qualified_tids (void) { @@ -1818,7 +1826,7 @@ thread_apply_all_command (char *cmd, int from_tty) static void thread_apply_command (char *tidlist, int from_tty) { - char *cmd; + char *cmd = NULL; struct cleanup *old_chain; char *saved_cmd; struct tid_range_parser parser; @@ -1826,11 +1834,25 @@ thread_apply_command (char *tidlist, int from_tty) if (tidlist == NULL || *tidlist == '\000') error (_("Please specify a thread ID list")); - for (cmd = tidlist; *cmd != '\000' && !isalpha (*cmd); cmd++); + tid_range_parser_init (&parser, tidlist, current_inferior ()->num); + while (!tid_range_parser_finished (&parser)) + { + int inf_num, thr_start, thr_end; + + if (!tid_range_parser_get_tid_range (&parser, + &inf_num, &thr_start, &thr_end)) + { + cmd = (char *) tid_range_parser_string (&parser); + break; + } + } - if (*cmd == '\000') + if (cmd == NULL) error (_("Please specify a command following the thread ID list")); + if (tidlist == cmd || !isalpha (cmd[0])) + invalid_thread_id_error (cmd); + /* Save a copy of the command in case it is clobbered by execute_command. */ saved_cmd = xstrdup (cmd); @@ -1850,6 +1872,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 ()