forked from Imagelibrary/binutils-gdb
* regcache.c (struct regcache): Add ptid_t member.
(regcache_xmalloc): Initialize it. (regcache_cpy_no_passthrough): Do not refer to current_regcache. (regcache_dup): Likewise. (regcache_dup_no_passthrough): Likewise. (current_regcache): Make static. (registers_ptid): Remove variable. (get_thread_regcache): New function. (get_current_regcache): New function. (registers_changed): Implement by freeing current regcache. (regcache_raw_read): Do not refer to current_regcache. Set inferior_ptid to regcache->ptid while calling target routines. (regcache_raw_write): Likewise. (regcache_raw_supply): Do not refer to current_regcache. (read_pc_pid): Use thread regcache. Do not modify inferior_ptid. (write_pc_pid): Likewise. (build_regcache): Remove. (_initialize_regcache): Do not call DEPRECATED_REGISTER_GDBARCH_SWAP or deprecated_register_gdbarch_swap. Do not initialize registers_ptid. * regcache.h (get_current_regcache): Add prototype. (get_thread_regcache): Likewise. (current_regcache): Remove declaration. * corelow.c (core_open): Replace current_regcache by get_current_regcache (). * frame.c (frame_pop): Likewise. (put_frame_register): Likewise. (get_current_frame, create_new_frame): Likewise. * mi/mi-main.c (mi_cmd_data_write_register_values): Likewise. * stack.c (return_command): Likewise. * infcall.c (call_function_by_hand): Likewise. * infrun.c (resume): Likewise. (save_inferior_status, restore_inferior_status): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. (fork_save_infrun_state): Likewise. * win32-nat.c (win32_resume): Likewise. * i386fbsd-nat.c (i386fbsd_resume): Likewise. * monitor.c (monitor_wait): Likewise. * remote.c (remote_wait): Likewise. * remote-mips.c (mips_wait): Likewise. * bsd-kvm.c (bsd_kvm_open): Likewise (bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Likewise. * fbsd-nat.c (fbsd_make_corefile_notes): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. (ia64_linux_stopped_data_address): Likewise. * frv-tdep.c (frv_fdpic_loadmap_addresses): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * mep-tdep.c (current_me_module, current_options): Likewise. * mips-tdep.c (deprecated_mips_set_processor_regs_hack): Likewise. * linux-nat.c (linux_nat_do_thread_registers): Use thread regcache instead of current_regcache. Call target_fetch_registers. (linux_nat_corefile_thread_callback): Update call site. (linux_nat_do_registers): Likewise. * procfs.c (procfs_do_thread_registers): Use thread regcache instead of current_regcache. (procfs_make_note_section): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise.
This commit is contained in:
@@ -2583,19 +2583,26 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
|
||||
gdb_fpxregset_t fpxregs;
|
||||
#endif
|
||||
unsigned long lwp = ptid_get_lwp (ptid);
|
||||
struct gdbarch *gdbarch = current_gdbarch;
|
||||
struct regcache *regcache = get_thread_regcache (ptid);
|
||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||
const struct regset *regset;
|
||||
int core_regset_p;
|
||||
struct cleanup *old_chain;
|
||||
|
||||
old_chain = save_inferior_ptid ();
|
||||
inferior_ptid = ptid;
|
||||
target_fetch_registers (regcache, -1);
|
||||
do_cleanups (old_chain);
|
||||
|
||||
core_regset_p = gdbarch_regset_from_core_section_p (gdbarch);
|
||||
if (core_regset_p
|
||||
&& (regset = gdbarch_regset_from_core_section (gdbarch, ".reg",
|
||||
sizeof (gregs))) != NULL
|
||||
&& regset->collect_regset != NULL)
|
||||
regset->collect_regset (regset, current_regcache, -1,
|
||||
regset->collect_regset (regset, regcache, -1,
|
||||
&gregs, sizeof (gregs));
|
||||
else
|
||||
fill_gregset (current_regcache, &gregs, -1);
|
||||
fill_gregset (regcache, &gregs, -1);
|
||||
|
||||
note_data = (char *) elfcore_write_prstatus (obfd,
|
||||
note_data,
|
||||
@@ -2607,10 +2614,10 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
|
||||
&& (regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
|
||||
sizeof (fpregs))) != NULL
|
||||
&& regset->collect_regset != NULL)
|
||||
regset->collect_regset (regset, current_regcache, -1,
|
||||
regset->collect_regset (regset, regcache, -1,
|
||||
&fpregs, sizeof (fpregs));
|
||||
else
|
||||
fill_fpregset (current_regcache, &fpregs, -1);
|
||||
fill_fpregset (regcache, &fpregs, -1);
|
||||
|
||||
note_data = (char *) elfcore_write_prfpreg (obfd,
|
||||
note_data,
|
||||
@@ -2622,10 +2629,10 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
|
||||
&& (regset = gdbarch_regset_from_core_section (gdbarch, ".reg-xfp",
|
||||
sizeof (fpxregs))) != NULL
|
||||
&& regset->collect_regset != NULL)
|
||||
regset->collect_regset (regset, current_regcache, -1,
|
||||
regset->collect_regset (regset, regcache, -1,
|
||||
&fpxregs, sizeof (fpxregs));
|
||||
else
|
||||
fill_fpxregset (current_regcache, &fpxregs, -1);
|
||||
fill_fpxregset (regcache, &fpxregs, -1);
|
||||
|
||||
note_data = (char *) elfcore_write_prxfpreg (obfd,
|
||||
note_data,
|
||||
@@ -2650,21 +2657,12 @@ static int
|
||||
linux_nat_corefile_thread_callback (struct lwp_info *ti, void *data)
|
||||
{
|
||||
struct linux_nat_corefile_thread_data *args = data;
|
||||
ptid_t saved_ptid = inferior_ptid;
|
||||
|
||||
inferior_ptid = ti->ptid;
|
||||
registers_changed ();
|
||||
/* FIXME should not be necessary; fill_gregset should do it automatically. */
|
||||
target_fetch_registers (current_regcache, -1);
|
||||
args->note_data = linux_nat_do_thread_registers (args->obfd,
|
||||
ti->ptid,
|
||||
args->note_data,
|
||||
args->note_size);
|
||||
args->num_notes++;
|
||||
inferior_ptid = saved_ptid;
|
||||
registers_changed ();
|
||||
/* FIXME should not be necessary; fill_gregset should do it automatically. */
|
||||
target_fetch_registers (current_regcache, -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2675,15 +2673,11 @@ static char *
|
||||
linux_nat_do_registers (bfd *obfd, ptid_t ptid,
|
||||
char *note_data, int *note_size)
|
||||
{
|
||||
registers_changed ();
|
||||
/* FIXME should not be necessary; fill_gregset should do it automatically. */
|
||||
target_fetch_registers (current_regcache, -1);
|
||||
return linux_nat_do_thread_registers (obfd,
|
||||
ptid_build (ptid_get_pid (inferior_ptid),
|
||||
ptid_get_pid (inferior_ptid),
|
||||
0),
|
||||
note_data, note_size);
|
||||
return note_data;
|
||||
}
|
||||
|
||||
/* Fills the "to_make_corefile_note" target vector. Builds the note
|
||||
|
||||
Reference in New Issue
Block a user