Fix gdb build with --enable-build-with-cxx --disable-nls
[deliverable/binutils-gdb.git] / gdb / thread.c
index b3b3995d60e6f6d0160568f6a64981ee6108031d..75bfb4771b268df7fafb09efe86608fbc9061ef5 100644 (file)
@@ -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 ()
This page took 0.025951 seconds and 4 git commands to generate.