diff options
author | Daniel Jacobowitz <drow@false.org> | 2009-11-10 21:00:41 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2009-11-10 21:00:41 +0000 |
commit | 751254059d4238e2a67a7644306f1185523816ca (patch) | |
tree | b36af04ddaea2da4e000a3f6e7eec1d68bf1ac29 /gdb/procfs.c | |
parent | fa33544892e1a4aaf94c7a37a708fd6af5b0c6cd (diff) | |
download | gdb-751254059d4238e2a67a7644306f1185523816ca.zip gdb-751254059d4238e2a67a7644306f1185523816ca.tar.gz gdb-751254059d4238e2a67a7644306f1185523816ca.tar.bz2 |
2009-11-10 Daniel Gutson <dgutson@codesourcery.com>
* procfs.c (procfs_do_thread_registers): Added a call to fetch
register values before saving them in the core file
through the gcore command.
(procfs_corefile_thread_callback): Removed the backup of
inferior_ptid before calling procfs_do_thread_registers since
the function already saves and restores it before returning.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r-- | gdb/procfs.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c index 7d7a895..c311ef5 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -6060,9 +6060,19 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid, gdb_gregset_t gregs; gdb_fpregset_t fpregs; unsigned long merged_pid; + struct cleanup *old_chain; merged_pid = TIDGET (ptid) << 16 | PIDGET (ptid); + /* This part is the old method for fetching registers. + It should be replaced by the newer one using regsets + once it is implemented in this platform: + gdbarch_regset_from_core_section() and regset->collect_regset(). */ + + old_chain = save_inferior_ptid (); + inferior_ptid = ptid; + target_fetch_registers (regcache, -1); + fill_gregset (regcache, &gregs, -1); #if defined (UNIXWARE) note_data = (char *) elfcore_write_lwpstatus (obfd, @@ -6085,6 +6095,9 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid, note_size, &fpregs, sizeof (fpregs)); + + do_cleanups (old_chain); + return note_data; } @@ -6102,13 +6115,11 @@ procfs_corefile_thread_callback (procinfo *pi, procinfo *thread, void *data) if (pi != NULL) { - ptid_t saved_ptid = inferior_ptid; - inferior_ptid = MERGEPID (pi->pid, thread->tid); - args->note_data = procfs_do_thread_registers (args->obfd, inferior_ptid, + ptid_t ptid = MERGEPID (pi->pid, thread->tid); + args->note_data = procfs_do_thread_registers (args->obfd, ptid, args->note_data, args->note_size, args->stop_signal); - inferior_ptid = saved_ptid; } return 0; } |