This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
linux native, switch forks, always have a thread
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 30 Apr 2008 15:36:30 +0100
- Subject: linux native, switch forks, always have a thread
I'd missed this case when I made linux native always have a thread.
It's not perfect in the sense that switching forks ("restart"/"fork",
not follow-fork-mode) in multi-threaded apps doesn't handle
multi-threading correctly yet, but that is an already existing
problem. We shall be getting back to that in a few weeks
for multi-process support.
--
Pedro Alves
2008-04-30 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_nat_switch_fork): Reinit GDB's thread list
and register the fork's PTID as a thread.
---
gdb/linux-nat.c | 2 ++
1 file changed, 2 insertions(+)
Index: src/gdb/linux-nat.c
===================================================================
--- src.orig/gdb/linux-nat.c 2008-04-28 11:54:27.000000000 +0100
+++ src/gdb/linux-nat.c 2008-04-28 11:53:38.000000000 +0100
@@ -948,8 +948,10 @@ linux_nat_switch_fork (ptid_t new_ptid)
{
struct lwp_info *lp;
+ init_thread_list ();
init_lwp_list ();
lp = add_lwp (new_ptid);
+ add_thread_silent (new_ptid);
lp->stopped = 1;
}