diff options
author | Pedro Alves <palves@redhat.com> | 2008-09-08 21:22:49 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2008-09-08 21:22:49 +0000 |
commit | 27c9d2043eb30017b949170a211fe73a61488492 (patch) | |
tree | dec63f1bc63ebfb0c6f9dc2eb18100a91350c2da | |
parent | 5822d809e73ed680e384213620a148b2e86c3b13 (diff) | |
download | gdb-27c9d2043eb30017b949170a211fe73a61488492.zip gdb-27c9d2043eb30017b949170a211fe73a61488492.tar.gz gdb-27c9d2043eb30017b949170a211fe73a61488492.tar.bz2 |
* 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.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/fork-child.c | 6 | ||||
-rw-r--r-- | gdb/linux-nat.c | 11 |
3 files changed, 18 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1ec1b87..3f73fe1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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) diff --git a/gdb/fork-child.c b/gdb/fork-child.c index 7aff110..229770f 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -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. */ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 126f7dc..fe78c25 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -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. */ |