This is the mail archive of the gdb-patches@sourceware.org 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]

[RFA] Fix for testsuite errors with gdbserver (remote)


> Nonetheless, if you pass target_gdbarch instead to ensure_python_env in
> python_inferior_exit (in python/py_inferior.c), things will behave much
> better. Once again, I don't know if this is strictly correct, but it
> should at least get you going with gdbserver again.
> 
> I hope this leads someone to a better solution.

  I investigated a little further and it seems to me
that the problem is that instead of a null_ptid,
the TARGET_WAITKIND_EXITED event has a (pid,0,0) form,
which is also not a valid thread, but doesn't get
filtered out yet by has_stack_frames  before
calling is_exited.


  I first wanted to add a test "lwp == 0 && tid == 0"
inside has_stack_frames, but as I was not sure that
other target could not have valid thread with a zero identifier,
I thought it would be safer to look for a fix inside
remote specific code.

  Inverting two lines in remote_close fixes hopefully this issue.
At least using --target_board=native_gdbsderver.exp
works again!

Is this patch OK?

 2011-02-18  Pierre Muller  <muller@ics.u-strasbg.fr>

	* remote.c (remote_close): Reset INFERIOR_PTID to NULL_PTID
	before calling discard_all_inferiors.

Index: src/gdb/remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.434
diff -u -p -r1.434 remote.c
--- src/gdb/remote.c	14 Feb 2011 11:22:29 -0000	1.434
+++ src/gdb/remote.c	18 Feb 2011 16:41:42 -0000
@@ -2908,9 +2908,11 @@ remote_close (int quitting)
   remote_desc = NULL;
 
   /* We don't have a connection to the remote stub anymore.  Get rid
-     of all the inferiors and their threads we were controlling.  */
-  discard_all_inferiors ();
+     of all the inferiors and their threads we were controlling.
+     Reset inferior_ptid to null_ptid first, as otherwise has_stack_frames
+     will be unable to find the thread corresponding to (pid, 0, 0).  */
   inferior_ptid = null_ptid;
+  discard_all_inferiors ();
 
   /* We're no longer interested in any of these events.  */
   discard_pending_stop_replies (-1);


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