fix for PR 13618 -- gdb incorrectly reports thread information.
authorDavid Taylor <taylor@redhat.com>
Fri, 24 Oct 1997 21:04:39 +0000 (21:04 +0000)
committerDavid Taylor <taylor@redhat.com>
Fri, 24 Oct 1997 21:04:39 +0000 (21:04 +0000)
If other systems besides nm-sun4sol2 exhibit the problem, they may need
definitions of FIND_NEW_THREADS and a corresponding support function.

gdb/ChangeLog
gdb/config/sparc/nm-sun4sol2.h
gdb/sol-thread.c
gdb/thread.c

index fdfffcd..0e42ed3 100644 (file)
@@ -1,3 +1,12 @@
+Fri Oct 24 16:48:21 1997  David Taylor  <taylor@texas.cygnus.com>
+
+       * sol-thread.c (sol_find_new_threads_callback,
+       sol_find_new_threads): New functions.
+       * config/sparc/nm-sun4sol2.h (FIND_NEW_THREADS): New macro, invoke
+       sol_find_new_threads.
+       * thread.c (info_threads_command): invoke FIND_NEW_THREADS if it
+       is defined.
+
 Thu Oct 23 16:16:04 1997  Jeff Law  (law@fast.cs.utah.edu)
 
        * dbxread.c (process_one_symbol): Put back initialization
index c83e44d..f6833f4 100644 (file)
@@ -39,4 +39,7 @@ struct objfile;
 
 void sol_thread_new_objfile PARAMS ((struct objfile *objfile));
 
+#define FIND_NEW_THREADS sol_find_new_threads
+void sol_find_new_threads PARAMS ((void));
+
 #endif
index cc61c6a..aa69c0d 100644 (file)
@@ -1239,6 +1239,43 @@ solaris_pid_to_str (pid)
 }
 \f
 
+/* Worker bee for find_new_threads
+   Callback function that gets called once per USER thread (i.e., not
+   kernel) thread. */
+
+static int
+sol_find_new_threads_callback(th, ignored)
+     const td_thrhandle_t *th;
+     void *ignored;
+{
+  td_err_e retval;
+  td_thrinfo_t ti;
+  int pid;
+
+  if ((retval = p_td_thr_get_info(th, &ti)) != TD_OK)
+    {
+      return -1;
+    }
+  pid = BUILD_THREAD(ti.ti_tid, PIDGET(inferior_pid));
+  if (!in_thread_list(pid))
+    add_thread(pid);
+
+  return 0;
+}
+
+void
+sol_find_new_threads()
+{
+  if (inferior_pid == -1)
+    {
+      printf_filtered("No process.\n");
+      return;
+    }
+  p_td_ta_thr_iter (main_ta, sol_find_new_threads_callback, (void *)0,
+                   TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
+                   TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
+}
+
 #ifdef MAINTENANCE_CMDS
 /* Worker bee for info sol-thread command.  This is a callback function that
    gets called once for each Solaris thread (ie. not kernel thread) in the 
index b8bf9e1..4c158ff 100644 (file)
@@ -347,6 +347,10 @@ info_threads_command (arg, from_tty)
   if (!target_has_stack) error ("No stack.");
 
   prune_threads ();
+#if defined(FIND_NEW_THREADS)
+  FIND_NEW_THREADS ();
+#endif
+
   for (tp = thread_list; tp; tp = tp->next)
     {
       if (tp->pid == current_pid)