2004-09-12 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / thread-db.c
index baa9ba6e54ee1f84edaf5f96e7afaac53e75cd5c..326bf72642d3e308dd1128ea46d180d3c33be9da 100644 (file)
@@ -63,10 +63,6 @@ static void (*target_new_objfile_chain) (struct objfile * objfile);
 /* Non-zero if we're using this module's target vector.  */
 static int using_thread_db;
 
-/* Non-zero if we have to keep this module's target vector active
-   across re-runs.  */
-static int keep_thread_db;
-
 /* Non-zero if we have determined the signals used by the threads
    library.  */
 static int thread_signals;
@@ -275,12 +271,18 @@ thread_get_info_callback (const td_thrhandle_t *thp, void *infop)
   thread_info = find_thread_pid (thread_ptid);
 
   /* In the case of a zombie thread, don't continue.  We don't want to
-     attach to it thinking it is a new thread and we don't want to mark
-     it as valid.  */
+     attach to it thinking it is a new thread.  */
   if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE)
     {
       if (infop != NULL)
         *(struct thread_info **) infop = thread_info;
+      if (thread_info != NULL)
+       {
+         memcpy (&thread_info->private->th, thp, sizeof (*thp));
+         thread_info->private->th_valid = 1;
+         memcpy (&thread_info->private->ti, &ti, sizeof (ti));
+         thread_info->private->ti_valid = 1;
+       }
       return TD_THR_ZOMBIE;
     }
 
@@ -667,8 +669,6 @@ thread_db_new_objfile (struct objfile *objfile)
          using_thread_db = 0;
        }
 
-      keep_thread_db = 0;
-
       goto quit;
     }
 
@@ -697,18 +697,6 @@ thread_db_new_objfile (struct objfile *objfile)
       push_target (&thread_db_ops);
       using_thread_db = 1;
 
-      /* If the thread library was detected in the main symbol file
-         itself, we assume that the program was statically linked
-         against the thread library and well have to keep this
-         module's target vector activated until forever...  Well, at
-         least until all symbols have been discarded anyway (see
-         above).  */
-      if (objfile == symfile_objfile)
-       {
-         gdb_assert (proc_handle.pid == 0);
-         keep_thread_db = 1;
-       }
-
       /* We can only poke around if there actually is a child process.
          If there is no child process alive, postpone the steps below
          until one has been created.  */
@@ -1071,7 +1059,7 @@ thread_db_store_registers (int regno)
 
       deprecated_read_register_gen (regno, raw);
       thread_db_fetch_registers (-1);
-      supply_register (regno, raw);
+      regcache_raw_supply (current_regcache, regno, raw);
     }
 
   fill_gregset ((gdb_gregset_t *) gregset, -1);
@@ -1100,12 +1088,8 @@ static void
 thread_db_create_inferior (char *exec_file, char *allargs, char **env,
                           int from_tty)
 {
-  if (!keep_thread_db)
-    {
-      unpush_target (&thread_db_ops);
-      using_thread_db = 0;
-    }
-
+  unpush_target (&thread_db_ops);
+  using_thread_db = 0;
   target_beneath->to_create_inferior (exec_file, allargs, env, from_tty);
 }
 
@@ -1135,17 +1119,9 @@ thread_db_mourn_inferior (void)
 
   target_beneath->to_mourn_inferior ();
 
-  /* Detach thread_db target ops if not dealing with a statically
-     linked threaded program.  This allows a corefile to be debugged
-     after finishing debugging of a threaded program.  At present,
-     debugging a statically-linked threaded program is broken, but
-     the check is added below in the event that it is fixed in the
-     future.  */
-  if (!keep_thread_db)
-    {
-      unpush_target (&thread_db_ops);
-      using_thread_db = 0;
-    }
+  /* Detach thread_db target ops.  */
+  unpush_target (&thread_db_ops);
+  using_thread_db = 0;
 }
 
 static int
This page took 0.024292 seconds and 4 git commands to generate.