Subject: Re: bin/30756
To: None <M.Drochner@fz-juelich.de>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: netbsd-bugs
Date: 08/16/2005 18:07:15
Matthias Drochner <M.Drochner@fz-juelich.de> writes:
> rpaulo@NetBSD.org said:
> > thread_resume_suspend_cb: td_thr_suspend(0xa3bc2c0): generic error
>
> The appended patch helps for this problem.
> It seems that the thread debugging stuff needs some cleanup...
That happens to work but it's not right at all. nbsd_thread_resume()
is being called with a ptid argument of {<pid>, 1, 0}; that is, the
upper levels are trying to single-step an LWP rather than a thread (we
don't currently have a mechanism for that in the ptrace
interface). This causes thread_resume_suspend_cb() to try to suspend
the only thread in the program... which is a bad enough idea, but it
happens early enough that the idle queue isn't even set up, and so
there's no thread to replace the suspended thread in the register
set. This causes td_thr_suspend() to bail out with the error seen
above.
However, this does point out a partial solution, which I've gone ahead
and committed:
Index: nbsd-thread.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/gdb/gdb/nbsd-thread.c,v
retrieving revision 1.15
diff -p -u -r1.15 nbsd-thread.c
--- nbsd-thread.c 12 Oct 2004 22:16:34 -0000 1.15
+++ nbsd-thread.c 16 Aug 2005 22:02:38 -0000
@@ -262,11 +262,14 @@ static void
nbsd_thread_resume (ptid_t ptid, int step, enum target_signal signo)
{
- /* If a particular ptid is specified, then gdb wants to resume or
+ /* If a particular thread is specified, then gdb wants to resume or
step just that thread. If it isn't on a processor, then it needs
- to be put on one, and nothing else can be on the runnable
- list. */
- if (GET_PID (ptid) != -1)
+ to be put on one, and nothing else can be on the runnable list.
+ XXX If GDB asks us to step a LWP rather than a thread, there
+ isn't anything we can do but pass it down to the ptrace call;
+ given the flexibility of the LWP-to-thread mapping, this might or
+ might not accomplish what the user wanted. */
+ if (GET_PID (ptid) != -1 && IS_THREAD (ptid))
{
int val;
This seems to get things limping along again.
- Nathan