Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Keith Seitz'" <keiths@redhat.com>,
	       "'Michael Snyder'" <msnyder@vmware.com>
Cc: <gdb@sourceware.org>, <gdb-patches@sourceware.org>
Subject: [RFA] Fix for testsuite errors with gdbserver (remote)
Date: Fri, 18 Feb 2011 16:50:00 -0000	[thread overview]
Message-ID: <000901cbcf8b$a7e35b50$f7aa11f0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <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);


       reply	other threads:[~2011-02-18 16:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4D5C71F6.80208@vmware.com>
     [not found] ` <4D5C7552.4010708@vmware.com>
     [not found]   ` <4D5C8312.4030701@vmware.com>
     [not found]     ` <4D5D6D83.8030302@vmware.com>
     [not found]       ` <4D5D8974.5030205@redhat.com>
2011-02-18 16:50         ` Pierre Muller [this message]
2011-02-18 18:56           ` Keith Seitz
2011-02-18 20:26             ` Pedro Alves
2011-02-18 20:30               ` Tom Tromey
2011-02-18 20:31                 ` Tom Tromey
2011-02-21 11:50                   ` Pedro Alves
2011-02-21 15:47                     ` Pierre Muller
2011-02-21 15:54                       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000901cbcf8b$a7e35b50$f7aa11f0$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=gdb-patches@sourceware.org \
    --cc=gdb@sourceware.org \
    --cc=keiths@redhat.com \
    --cc=msnyder@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox