This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Fix for testsuite errors with gdbserver (remote)
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Keith Seitz'" <keiths at redhat dot com>, "'Michael Snyder'" <msnyder at vmware dot com>
- Cc: <gdb at sourceware dot org>, <gdb-patches at sourceware dot org>
- Date: Fri, 18 Feb 2011 17:48:22 +0100
- Subject: [RFA] Fix for testsuite errors with gdbserver (remote)
- References: <4D5C71F6.80208@vmware.com> <4D5C7552.4010708@vmware.com> <4D5C8312.4030701@vmware.com> <4D5D6D83.8030302@vmware.com> <4D5D8974.5030205@redhat.com>
> 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);