diff options
author | Pedro Alves <pedro@codesourcery.com> | 2008-09-08 21:26:36 +0000 |
---|---|---|
committer | Pedro Alves <pedro@codesourcery.com> | 2008-09-08 21:26:36 +0000 |
commit | f2fdc646560b949b3441f0d0a00e7db97d78d08b (patch) | |
tree | 26d1efa436c58d850eefc7ce6daed9886f6671e4 /gdb/bsd-uthread.c | |
parent | 6b8c2192cc44981597e0b395f36a27e42dc9b498 (diff) | |
download | gdb-f2fdc646560b949b3441f0d0a00e7db97d78d08b.tar.gz |
* 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 df038e6771e..b6a18f0144f 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, |