diff options
author | peadar <peadar@FreeBSD.org> | 2005-01-11 14:53:16 +0000 |
---|---|---|
committer | peadar <peadar@FreeBSD.org> | 2005-01-11 14:53:16 +0000 |
commit | 778dfbe1e77806767ae52185feca4de8afaf68e2 (patch) | |
tree | af654e027ceba1b1d469d1fa575f342ef7d5f0c1 /gnu/usr.bin | |
parent | 9f0f84e349e5ce4563a85ec275361d4fe4b12837 (diff) | |
download | FreeBSD-src-778dfbe1e77806767ae52185feca4de8afaf68e2.zip FreeBSD-src-778dfbe1e77806767ae52185feca4de8afaf68e2.tar.gz |
When grabbing registers for an lwp, fake the inferior's pid using the
lwp ID before invoking the underlying target operation.
For corefiles, we rely on gdb internals to do this, and it uses the
pid as an index, rather than the lwpid, so previously, backtraces
for multithreaded core files wasn't working correctly. For processes,
we currently use ptrace directly, so fixup that code to also use
the pid directly.
Discussed With: marcel, davidxu
MFC After: 4 days
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/gdb/libgdb/fbsd-threads.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/usr.bin/gdb/libgdb/fbsd-threads.c b/gnu/usr.bin/gdb/libgdb/fbsd-threads.c index 02b250f..64e8db7 100644 --- a/gnu/usr.bin/gdb/libgdb/fbsd-threads.c +++ b/gnu/usr.bin/gdb/libgdb/fbsd-threads.c @@ -602,7 +602,8 @@ fbsd_lwp_fetch_registers (int regno) return; } - lwp = GET_LWP (inferior_ptid); + /* XXX: We've replaced the pid with the lwpid for GDB's benefit. */ + lwp = GET_PID (inferior_ptid); if (ptrace (PT_GETREGS, lwp, (caddr_t) &gregs, 0) == -1) error ("Cannot get lwp %d registers: %s\n", lwp, safe_strerror (errno)); @@ -1271,7 +1272,10 @@ ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset) struct cleanup *old_chain; old_chain = save_inferior_ptid (); - inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); + + /* XXX: Target operation isn't lwp aware: replace pid with lwp */ + inferior_ptid = BUILD_LWP (0, lwpid); + target_fetch_registers (-1); fill_gregset (gregset, -1); do_cleanups (old_chain); |