From: Daniel Jacobowitz <drow@mvista.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: Mark Kettenis <kettenis@chello.nl>,
msnyder@redhat.com, gdb-patches@sources.redhat.com
Subject: Re: [Fwd: Re: [Fwd: Re: gdb/725: Crash using debug target and regcaches (in 5.3 branch?)]]
Date: Tue, 03 Dec 2002 11:33:00 -0000 [thread overview]
Message-ID: <20021203193322.GA19891@nevyn.them.org> (raw)
In-Reply-To: <3DED03F1.6070601@redhat.com>
On Tue, Dec 03, 2002 at 02:20:17PM -0500, Andrew Cagney wrote:
>
> >>Er, no I wont :-(
> >>
> >>The attached is the refind patch. I added the comment:
> >>
> >>+ /* NOTE: cagney/2002-12-02: This assumes that the target code can
> >>+ directly transfer the register values into the register cache.
> >>+ This works fine when there is a 1:1 mapping between light weight
> >>+ process (LWP) (a.k.a. process on GNU/Linux) and the thread. On
> >>+ an N:1 (user-land threads), or N:M (combination of user-land and
> >>+ LWP threading), this does not work. An LWP can be sitting in the
> >>+ thread context switch code and hence, the LWP's registers belong
> >>+ to no thread. */
> >
> >
> >First of all, this comment is wrong.
>
> Why?
>
> The code is assuming that the LWP registers belong to the currently
> selected thread's regcache. That is a pretty scary assumption.
>
> [I'll use that wording]
It's not an assumption at this point. proc-service.c:230 to
thread_db_fetch_registers is the only path into lin_lwp_fetch_registers.
And that does:
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
So at this point we _know_ that the thread we're querying has its
registers in the LWP. That's the whole point.
>
> > I think we're miscommunicating
> >on what the patch does. At this point the fetch_inferior_registers
> >code has an inferior_ptid which looks like this:
> > PID = pid, LWPID = 0, TID = 0
> >or
> > PID = pid, LWPID = otherpid, TID = 0
>
> >Don't get confused by the use of TIDGET. Look at the definition of
> >TIDGET; it gets the _LWP_ id. This's a search and destroy candidate if
> >I ever saw one.
>
> I'll add that.
>
> >Some upper layer has already taken the TID, mapped it to an LWP id, and
> >is asking for that LWP's registers by the time we get here. So the LWP
> >is known to belong to the thread we are querying.
>
>
> >>however, with the patch applied, I see (and consistently, well 2 out of
> >>2, which is pretty amasing for the thread testsuite) the new failure:
> >>
> >>
> >>gdb.threads/killed.exp: GDB exits after multi-threaded program exits
> >>messily
> >>
> >>looking at the log file:
> >>
> >>(gdb) run
> >>Starting program: /home/cagney/gdb/native/gdb/testsuite/gdb.threads/killed
> >>[New Thread 1024 (LWP 6831)]
> >>[New Thread 2049 (LWP 6832)]
> >>[New Thread 1026 (LWP 6833)]
> >>Cannot find user-level thread for LWP 6833: generic error
> >>(gdb) PASS: gdb.threads/killed.exp: run program to completion
> >>quit
> >>The program is running. Exit anyway? (y or n) y
> >>Cannot find thread 2049: generic error
> >>(gdb) FAIL: gdb.threads/killed.exp: GDB exits after multi-threaded
> >>program exits
> >> messily (gdb/568)
> >>
> >>Which doesn't occure when the patch isn't applied.
> >
> >
> >Are you sure about this last bit? I see this failure even without the
> >patch, on an i386 SMP system. I just checked it moments ago.
>
> Yes. Not on an SMP machine though.
According to Michael it already shows up in all of his configurations
in current CVS... I see the same thing here. It's a little timing
sensitive, I don't know why it didn't show up beforehand for you.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2002-12-03 19:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-26 14:10 Andrew Cagney
2002-11-27 12:55 ` Andrew Cagney
2002-11-30 8:13 ` Mark Kettenis
2002-11-30 8:42 ` Andrew Cagney
2002-12-03 9:10 ` Andrew Cagney
2002-12-03 9:19 ` Daniel Jacobowitz
2002-12-03 11:20 ` Andrew Cagney
2002-12-03 11:33 ` Daniel Jacobowitz [this message]
2002-12-03 13:41 ` Andrew Cagney
2002-12-03 13:46 ` Daniel Jacobowitz
2002-12-03 14:10 ` Andrew Cagney
2002-12-03 19:22 ` Andrew Cagney
2002-12-03 9:27 Michael Elizabeth Chastain
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=20021203193322.GA19891@nevyn.them.org \
--to=drow@mvista.com \
--cc=ac131313@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kettenis@chello.nl \
--cc=msnyder@redhat.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