thread_db_get_info: cannot get thread info: generic error on fork()/execvp()

Daniel Jacobowitz drow@false.org
Wed Aug 30 18:14:00 GMT 2006


On Wed, Aug 30, 2006 at 05:28:27PM +0100, Alex Bligh wrote:
> Hi,
> 
> Now we have a pretty trivial test case to reproduce this problem,
> as per the 20 line program at the bottom of bug 2149,
> is there any chance at all of getting a fix? I currently
> can't debug my app at all because it suffers from this
> problem. I am willing to help in any way I can to debug
> this or test.

Well, I can reproduce the problem.  I can see roughly what's wrong,
too.  We still think we're attached to the old thread.

Could you try this patch?

-- 
Daniel Jacobowitz
CodeSourcery

2006-08-30  Daniel Jacobowitz  <dan@codesourcery.com>

	* infrun.c (handle_inferior_event): Context switch after fork
	and exec events.

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.214
diff -u -p -r1.214 infrun.c
--- infrun.c	19 Aug 2006 03:19:00 -0000	1.214
+++ infrun.c	30 Aug 2006 18:13:51 -0000
@@ -1411,6 +1411,12 @@ handle_inferior_event (struct execution_
       pending_follow.fork_event.parent_pid = PIDGET (ecs->ptid);
       pending_follow.fork_event.child_pid = ecs->ws.value.related_pid;
 
+      if (!ptid_equal (ecs->ptid, inferior_ptid))
+	{
+	  context_switch (ecs);
+	  flush_cached_frames ();
+	}
+
       stop_pc = read_pc ();
 
       stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid, 0);
@@ -1469,6 +1475,12 @@ handle_inferior_event (struct execution_
       ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
       inferior_ptid = ecs->saved_inferior_ptid;
 
+      if (!ptid_equal (ecs->ptid, inferior_ptid))
+	{
+	  context_switch (ecs);
+	  flush_cached_frames ();
+	}
+
       /* If no catchpoint triggered for this, then keep going.  */
       if (ecs->random_signal)
 	{



More information about the Gdb mailing list