diff options
author | Pedro Alves <palves@redhat.com> | 2008-09-08 21:26:36 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2008-09-08 21:26:36 +0000 |
commit | fb5e7258b364c6dc452e5126dfcf1b010a4cf8f7 (patch) | |
tree | 64d5d779dff71e85a6f884bdb7723663891ee623 /gdb/bsd-uthread.c | |
parent | af99052775b274a23fd8004bf816f9b299b96b23 (diff) | |
download | gdb-fb5e7258b364c6dc452e5126dfcf1b010a4cf8f7.zip gdb-fb5e7258b364c6dc452e5126dfcf1b010a4cf8f7.tar.gz gdb-fb5e7258b364c6dc452e5126dfcf1b010a4cf8f7.tar.bz2 |
* bsd-uthread.c (bsd_uthread_wait): Decorate the main thread with
thread_change_ptid. Check for exited threads.
(bsd_uthread_find_new_threads): Check for exited threads.
Diffstat (limited to 'gdb/bsd-uthread.c')
-rw-r--r-- | gdb/bsd-uthread.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index df038e6..b6a18f0 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -367,14 +367,16 @@ bsd_uthread_wait (ptid_t ptid, struct target_waitstatus *status) } } - /* HACK: Twiddle INFERIOR_PTID such that the initial thread of a - process isn't recognized as a new thread. */ - if (ptid_get_tid (ptid) != 0 && !in_thread_list (ptid) - && ptid_get_tid (inferior_ptid) == 0) - { - add_thread_silent (ptid); - inferior_ptid = ptid; - } + /* If INFERIOR_PTID doesn't have a tid member yet, and we now have a + ptid with tid set, then ptid is still the initial thread of + the process. Notify GDB core about it. */ + if (ptid_get_tid (inferior_ptid) == 0 + && ptid_get_tid (ptid) != 0 && !in_thread_list (ptid)) + thread_change_ptid (inferior_ptid, ptid); + + /* Don't let the core see a ptid without a corresponding thread. */ + if (!in_thread_list (ptid) || is_exited (ptid)) + add_thread (ptid); return ptid; } @@ -419,7 +421,7 @@ bsd_uthread_find_new_threads (void) { ptid_t ptid = ptid_build (pid, 0, addr); - if (!in_thread_list (ptid)) + if (!in_thread_list (ptid) || is_exited (ptid)) add_thread (ptid); addr = read_memory_typed_address (addr + offset, |