This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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  <>

	* 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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]