* linux-nat.c (linux_nat_wait): Update inferior_ptid's ptid with
authorPedro Alves <palves@redhat.com>
Mon, 8 Sep 2008 21:22:49 +0000 (21:22 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 8 Sep 2008 21:22:49 +0000 (21:22 +0000)
thread_change_ptid.  Don't add or mark the main thread as running
and executing here.
* fork-child.c (fork_inferior): Add the main thread here.

gdb/ChangeLog
gdb/fork-child.c
gdb/linux-nat.c

index 1ec1b871c651b8a6e964b5af792e07584b5039b1..3f73fe1e46b68e9ec5707443297019c33ab7ffaf 100644 (file)
@@ -1,3 +1,10 @@
+2008-09-08  Pedro Alves  <pedro@codesourcery.com>
+
+       * linux-nat.c (linux_nat_wait): Update inferior_ptid's ptid with
+       thread_change_ptid.  Don't add or mark the main thread as running
+       and executing here.
+       * fork-child.c (fork_inferior): Add the main thread here.
+
 2008-09-08  Jerome Guitton  <guitton@adacore.com>
 
        * rs6000-tdep.c (rs6000_fetch_instruction)
index 7aff110ba923af9babd464cd4b24631e66652e45..229770f154bacc69d977b1606b56430bacd2996d 100644 (file)
@@ -397,6 +397,12 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
   /* Needed for wait_for_inferior stuff below.  */
   inferior_ptid = pid_to_ptid (pid);
 
+  /* We have something that executes now.  We'll be running through
+     the shell at this point, but the pid shouldn't change.  Targets
+     supporting MT should fill this task's ptid with more data as soon
+     as they can.  */
+  add_thread_silent (inferior_ptid);
+
   /* Now that we have a child process, make it our target, and
      initialize anything target-vector-specific that needs
      initializing.  */
index 126f7dcb781222c90221d6f90a5d757290c0afe2..fe78c258bdb9a7c167fc3902f11c77f7b74bba93 100644 (file)
@@ -2719,14 +2719,13 @@ linux_nat_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
     {
       gdb_assert (!is_lwp (inferior_ptid));
 
-      inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
-                                GET_PID (inferior_ptid));
+      /* Upgrade the main thread's ptid.  */
+      thread_change_ptid (inferior_ptid,
+                         BUILD_LWP (GET_PID (inferior_ptid),
+                                    GET_PID (inferior_ptid)));
+
       lp = add_lwp (inferior_ptid);
       lp->resumed = 1;
-      /* Add the main thread to GDB's thread list.  */
-      add_thread_silent (lp->ptid);
-      set_running (lp->ptid, 1);
-      set_executing (lp->ptid, 1);
     }
 
   /* Block events while we're here.  */
This page took 0.046265 seconds and 4 git commands to generate.