aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/arc-tdep.c6
-rw-r--r--gdb/breakpoint.c2
-rw-r--r--gdb/bsd-kvm.c6
-rw-r--r--gdb/corelow.c2
-rw-r--r--gdb/frame.c9
-rw-r--r--gdb/frv-tdep.c2
-rw-r--r--gdb/i386-fbsd-nat.c2
-rw-r--r--gdb/i386-tdep.c3
-rw-r--r--gdb/ia64-linux-nat.c2
-rw-r--r--gdb/infcall.c7
-rw-r--r--gdb/infcmd.c5
-rw-r--r--gdb/infrun.c23
-rw-r--r--gdb/linux-fork.c10
-rw-r--r--gdb/m32c-tdep.c2
-rw-r--r--gdb/mep-tdep.c4
-rw-r--r--gdb/mi/mi-main.c3
-rw-r--r--gdb/or1k-tdep.c2
-rw-r--r--gdb/procfs.c2
-rw-r--r--gdb/record-btrace.c2
-rw-r--r--gdb/record-full.c20
-rw-r--r--gdb/regcache-dump.c5
-rw-r--r--gdb/regcache.c6
-rw-r--r--gdb/regcache.h1
-rw-r--r--gdb/reverse.c7
-rw-r--r--gdb/solib-darwin.c6
-rw-r--r--gdb/solib-svr4.c2
-rw-r--r--gdb/stack.c6
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/tracepoint.c4
-rw-r--r--gdb/windows-nat.c4
-rw-r--r--gdb/xtensa-tdep.c6
31 files changed, 80 insertions, 83 deletions
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 0740eff..a22b5bf 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -322,7 +322,7 @@ arc_insn_get_operand_value (const struct arc_instruction &insn,
return insn.operands[operand_num].value;
default:
/* Value in instruction is a register number. */
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
ULONGEST value;
regcache_cooked_read_unsigned (regcache,
insn.operands[operand_num].value,
@@ -351,7 +351,7 @@ arc_insn_get_operand_value_signed (const struct arc_instruction &insn,
return insn.operands[operand_num].value;
default:
/* Value in instruction is a register number. */
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
LONGEST value;
regcache_cooked_read_signed (regcache,
insn.operands[operand_num].value,
@@ -449,7 +449,7 @@ arc_insn_get_branch_target (const struct arc_instruction &insn)
/* LEAVE_S: PC = BLINK. */
else if (insn.insn_class == LEAVE)
{
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
ULONGEST value;
regcache_cooked_read_unsigned (regcache, ARC_BLINK_REGNUM, &value);
return value;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index a6b9b24..cd8f36f 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13946,7 +13946,7 @@ insert_single_step_breakpoint (struct gdbarch *gdbarch,
int
insert_single_step_breakpoints (struct gdbarch *gdbarch)
{
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
std::vector<CORE_ADDR> next_pcs;
next_pcs = gdbarch_software_single_step (gdbarch, regcache);
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 0ed95f6..bb2d038 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -136,7 +136,7 @@ bsd_kvm_target_open (const char *arg, int from_tty)
thread_info *thr = add_thread_silent (&bsd_kvm_ops, bsd_kvm_ptid);
switch_to_thread (thr);
- target_fetch_registers (get_current_regcache (), -1);
+ target_fetch_registers (get_thread_regcache (thr), -1);
reinit_frame_cache ();
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
@@ -334,7 +334,7 @@ bsd_kvm_proc_cmd (const char *arg, int fromtty)
if (kvm_read (core_kd, addr, &bsd_kvm_paddr, sizeof bsd_kvm_paddr) == -1)
error (("%s"), kvm_geterr (core_kd));
- target_fetch_registers (get_current_regcache (), -1);
+ target_fetch_registers (get_thread_regcache (inferior_thread ()), -1);
reinit_frame_cache ();
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
@@ -354,7 +354,7 @@ bsd_kvm_pcb_cmd (const char *arg, int fromtty)
bsd_kvm_paddr = (struct pcb *)(u_long) parse_and_eval_address (arg);
- target_fetch_registers (get_current_regcache (), -1);
+ target_fetch_registers (get_thread_regcache (inferior_thread ()), -1);
reinit_frame_cache ();
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 91b442b..a38d962 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -773,7 +773,7 @@ core_target_open (const char *arg, int from_tty)
}
/* Fetch all registers from core file. */
- target_fetch_registers (get_current_regcache (), -1);
+ target_fetch_registers (get_thread_regcache (inferior_thread ()), -1);
/* Now, set up the frame cache, and print the top of stack. */
reinit_frame_cache ();
diff --git a/gdb/frame.c b/gdb/frame.c
index dfd9299..5ac84a8 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1164,7 +1164,7 @@ frame_pop (frame_info_ptr this_frame)
definition can lead to targets writing back bogus values
(arguably a bug in the target code mind). */
/* Now copy those saved registers into the current regcache. */
- get_current_regcache ()->restore (scratch.get ());
+ get_thread_regcache (inferior_thread ())->restore (scratch.get ());
/* We've made right mess of GDB's local state, just discard
everything. */
@@ -1445,7 +1445,7 @@ put_frame_register (frame_info_ptr frame, int regnum,
break;
}
case lval_register:
- get_current_regcache ()->cooked_write (realnum, buf);
+ get_thread_regcache (inferior_thread ())->cooked_write (realnum, buf);
break;
default:
error (_("Attempt to assign to an unmodifiable value."));
@@ -1690,7 +1690,8 @@ get_current_frame (void)
if (sentinel_frame == NULL)
sentinel_frame =
create_sentinel_frame (current_program_space, current_inferior ()->aspace,
- get_current_regcache (), 0, 0).get ();
+ get_thread_regcache (inferior_thread ()),
+ 0, 0).get ();
/* Set the current frame before computing the frame id, to avoid
recursion inside compute_frame_id, in case the frame's
@@ -2024,7 +2025,7 @@ create_new_frame (frame_id id)
fi->next = create_sentinel_frame (current_program_space,
current_inferior ()->aspace,
- get_current_regcache (),
+ get_thread_regcache (inferior_thread ()),
id.stack_addr, id.code_addr).get ();
/* Set/update this frame's cached PC value, found in the next frame.
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 3656f6f..6528cf3 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -114,7 +114,7 @@ frv_fdpic_loadmap_addresses (struct gdbarch *gdbarch, CORE_ADDR *interp_addr,
return -1;
else
{
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
if (interp_addr != NULL)
{
diff --git a/gdb/i386-fbsd-nat.c b/gdb/i386-fbsd-nat.c
index e2c0e61..7eb3b40 100644
--- a/gdb/i386-fbsd-nat.c
+++ b/gdb/i386-fbsd-nat.c
@@ -233,7 +233,7 @@ i386_fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
if (!step)
{
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
ULONGEST eflags;
/* Workaround for a bug in FreeBSD. Make sure that the trace
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 1ddca24..f5ff55d 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8907,11 +8907,10 @@ i386_target_description (uint64_t xcr0, bool segments)
static unsigned long
i386_mpx_bd_base (void)
{
- struct regcache *rcache;
ULONGEST ret;
enum register_status regstatus;
- rcache = get_current_regcache ();
+ regcache *rcache = get_thread_regcache (inferior_thread ());
gdbarch *arch = rcache->arch ();
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index f9f21d8..a610de6 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -693,7 +693,7 @@ ia64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
{
CORE_ADDR psr;
siginfo_t siginfo;
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
if (!linux_nat_get_siginfo (inferior_ptid, &siginfo))
return false;
diff --git a/gdb/infcall.c b/gdb/infcall.c
index e62c220..8252fee 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -482,7 +482,7 @@ get_call_return_value (struct call_return_meta_info *ri)
else
{
gdbarch_return_value_as_value (ri->gdbarch, ri->function, ri->value_type,
- get_current_regcache (),
+ get_thread_regcache (inferior_thread ()),
&retval, NULL);
if (stack_temporaries && class_or_union_p (ri->value_type))
{
@@ -1068,7 +1068,7 @@ call_function_by_hand_dummy (struct value *function,
sp = push_dummy_code (gdbarch, sp, funaddr, args,
target_values_type, &real_pc, &bp_addr,
- get_current_regcache ());
+ get_thread_regcache (inferior_thread ()));
/* Write a legitimate instruction at the point where the infcall
breakpoint is going to be inserted. While this instruction
@@ -1270,7 +1270,8 @@ call_function_by_hand_dummy (struct value *function,
/* Create the dummy stack frame. Pass in the call dummy address as,
presumably, the ABI code knows where, in the call dummy, the
return address should be pointed. */
- sp = gdbarch_push_dummy_call (gdbarch, function, get_current_regcache (),
+ sp = gdbarch_push_dummy_call (gdbarch, function,
+ get_thread_regcache (inferior_thread ()),
bp_addr, args.size (), args.data (),
sp, return_method, struct_addr);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index cf8cd52..8890a16 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -496,7 +496,8 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
/* Start the target running. Do not use -1 continuation as it would skip
breakpoint right at the entry point. */
- proceed (regcache_read_pc (get_current_regcache ()), GDB_SIGNAL_0);
+ proceed (regcache_read_pc (get_thread_regcache (inferior_thread ())),
+ GDB_SIGNAL_0);
/* Since there was no error, there's no need to finish the thread
states here. */
@@ -1466,7 +1467,7 @@ advance_command (const char *arg, int from_tty)
struct value *
get_return_value (struct symbol *func_symbol, struct value *function)
{
- regcache *stop_regs = get_current_regcache ();
+ regcache *stop_regs = get_thread_regcache (inferior_thread ());
struct gdbarch *gdbarch = stop_regs->arch ();
struct value *value;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 785a4e1..4138d00 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2621,9 +2621,9 @@ do_target_resume (ptid_t resume_ptid, bool step, enum gdb_signal sig)
static void
resume_1 (enum gdb_signal sig)
{
- struct regcache *regcache = get_current_regcache ();
- struct gdbarch *gdbarch = regcache->arch ();
struct thread_info *tp = inferior_thread ();
+ regcache *regcache = get_thread_regcache (tp);
+ struct gdbarch *gdbarch = regcache->arch ();
ptid_t resume_ptid;
/* This represents the user's step vs continue request. When
deciding whether "set scheduler-locking step" applies, it's the
@@ -3566,7 +3566,6 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
{
INFRUN_SCOPED_DEBUG_ENTER_EXIT;
- struct regcache *regcache;
struct gdbarch *gdbarch;
CORE_ADDR pc;
@@ -3587,15 +3586,13 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
/* We'll update this if & when we switch to a new thread. */
update_previous_thread ();
- regcache = get_current_regcache ();
- gdbarch = regcache->arch ();
-
- pc = regcache_read_pc_protected (regcache);
-
thread_info *cur_thr = inferior_thread ();
-
infrun_debug_printf ("cur_thr = %s", cur_thr->ptid.to_string ().c_str ());
+ regcache *regcache = get_thread_regcache (cur_thr);
+ gdbarch = regcache->arch ();
+ pc = regcache_read_pc_protected (regcache);
+
/* Fill in with reasonable starting values. */
init_thread_stepping_state (cur_thr);
@@ -8894,7 +8891,7 @@ keep_going_pass_signal (struct execution_control_state *ecs)
}
else
{
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (ecs->event_thread);
int remove_bp;
int remove_wps;
step_over_what step_what;
@@ -9112,7 +9109,7 @@ print_signal_received_reason (struct ui_out *uiout, enum gdb_signal siggnal)
annotate_signal_string ();
uiout->field_string ("signal-meaning", gdb_signal_to_string (siggnal));
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (thr);
struct gdbarch *gdbarch = regcache->arch ();
if (gdbarch_report_signal_info_p (gdbarch))
gdbarch_report_signal_info (gdbarch, uiout, siggnal);
@@ -10026,7 +10023,7 @@ infcall_suspend_state_up
save_infcall_suspend_state ()
{
struct thread_info *tp = inferior_thread ();
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (tp);
struct gdbarch *gdbarch = regcache->arch ();
infcall_suspend_state_up inf_state
@@ -10047,7 +10044,7 @@ void
restore_infcall_suspend_state (struct infcall_suspend_state *inf_state)
{
struct thread_info *tp = inferior_thread ();
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
struct gdbarch *gdbarch = regcache->arch ();
inf_state->restore (gdbarch, tp, regcache);
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 52e3854..39c3a6b 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -219,12 +219,13 @@ fork_load_infrun_state (struct fork_info *fp)
linux_nat_switch_fork (fp->ptid);
if (fp->savedregs)
- get_current_regcache ()->restore (fp->savedregs);
+ get_thread_regcache (inferior_thread ())->restore (fp->savedregs);
registers_changed ();
reinit_frame_cache ();
- inferior_thread ()->set_stop_pc (regcache_read_pc (get_current_regcache ()));
+ inferior_thread ()->set_stop_pc
+ (regcache_read_pc (get_thread_regcache (inferior_thread ())));
nullify_last_target_wait_ptid ();
/* Now restore the file positions of open file descriptors. */
@@ -251,8 +252,9 @@ fork_save_infrun_state (struct fork_info *fp)
if (fp->savedregs)
delete fp->savedregs;
- fp->savedregs = new readonly_detached_regcache (*get_current_regcache ());
- fp->pc = regcache_read_pc (get_current_regcache ());
+ fp->savedregs = new readonly_detached_regcache
+ (*get_thread_regcache (inferior_thread ()));
+ fp->pc = regcache_read_pc (get_thread_regcache (inferior_thread ()));
/* Now save the 'state' (file position) of all open file descriptors.
Unfortunately fork does not take care of that for us... */
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index e06dbbe..a0f1779 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2556,7 +2556,7 @@ m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
CORE_ADDR func_addr, func_end;
struct m32c_prologue p;
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (gdbarch);
if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index a84df4e..6210b92 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -852,7 +852,7 @@ current_me_module (void)
if (target_has_registers ())
{
ULONGEST regval;
- regcache_cooked_read_unsigned (get_current_regcache (),
+ regcache_cooked_read_unsigned (get_thread_regcache (inferior_thread ()),
MEP_MODULE_REGNUM, &regval);
return (CONFIG_ATTR) regval;
}
@@ -879,7 +879,7 @@ current_options (void)
if (target_has_registers ())
{
ULONGEST regval;
- regcache_cooked_read_unsigned (get_current_regcache (),
+ regcache_cooked_read_unsigned (get_thread_regcache (inferior_thread ()),
MEP_OPT_REGNUM, &regval);
return regval;
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 944c911..abcd0d3 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1132,7 +1132,6 @@ void
mi_cmd_data_write_register_values (const char *command,
const char *const *argv, int argc)
{
- struct regcache *regcache;
struct gdbarch *gdbarch;
int numregs, i;
@@ -1143,7 +1142,7 @@ mi_cmd_data_write_register_values (const char *command,
will change depending upon the particular processor being
debugged. */
- regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
gdbarch = regcache->arch ();
numregs = gdbarch_num_cooked_regs (gdbarch);
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index a472a76..74d56d9 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -383,7 +383,7 @@ or1k_single_step_through_delay (struct gdbarch *gdbarch,
ULONGEST val;
CORE_ADDR ppc;
CORE_ADDR npc;
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
/* Get the previous and current instruction addresses. If they are not
adjacent, we cannot be in a delay slot. */
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 0e8a08f..3a5d173 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -3605,7 +3605,7 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
stop_signal = find_stop_signal ();
- fill_gregset (get_current_regcache (), &gregs, -1);
+ fill_gregset (get_thread_regcache (inferior_thread ()), &gregs, -1);
note_data.reset (elfcore_write_pstatus (obfd, note_data.release (), note_size,
inferior_ptid.pid (),
stop_signal, &gregs));
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index abab79f..f0e190f 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2782,7 +2782,7 @@ record_btrace_set_replay (struct thread_info *tp,
/* Start anew from the new replay position. */
record_btrace_clear_histories (btinfo);
- inferior_thread ()->set_stop_pc (regcache_read_pc (get_current_regcache ()));
+ tp->set_stop_pc (regcache_read_pc (get_thread_regcache (tp)));
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
}
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 1cea869..0ce6862 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -913,7 +913,7 @@ record_full_async_inferior_event_handler (gdb_client_data data)
static void
record_full_core_open_1 (const char *name, int from_tty)
{
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
int regnum = gdbarch_num_regs (regcache->arch ());
int i;
@@ -1069,7 +1069,7 @@ record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
struct gdbarch *gdbarch = target_thread_architecture (ptid);
- record_full_message (get_current_regcache (), signal);
+ record_full_message (get_thread_regcache (inferior_thread ()), signal);
if (!step)
{
@@ -1216,7 +1216,7 @@ record_full_wait_1 (struct target_ops *ops,
registers_changed ();
switch_to_thread (current_inferior ()->process_target (),
ret);
- regcache = get_current_regcache ();
+ regcache = get_thread_regcache (inferior_thread ());
tmp_pc = regcache_read_pc (regcache);
const address_space *aspace = current_inferior ()->aspace;
@@ -1286,7 +1286,7 @@ record_full_wait_1 (struct target_ops *ops,
{
switch_to_thread (current_inferior ()->process_target (),
record_full_resume_ptid);
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
struct gdbarch *gdbarch = regcache->arch ();
const address_space *aspace = current_inferior ()->aspace;
int continue_flag = 1;
@@ -2001,7 +2001,9 @@ record_full_goto_entry (struct record_full_entry *p)
registers_changed ();
reinit_frame_cache ();
- inferior_thread ()->set_stop_pc (regcache_read_pc (get_current_regcache ()));
+
+ thread_info *thr = inferior_thread ();
+ thr->set_stop_pc (regcache_read_pc (get_thread_regcache (thr)));
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
}
@@ -2322,7 +2324,6 @@ record_full_restore (void)
asection *osec;
uint32_t osec_size;
int bfd_offset = 0;
- struct regcache *regcache;
/* We restore the execution log from the open core bfd,
if there is one. */
@@ -2365,7 +2366,7 @@ record_full_restore (void)
try
{
- regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
while (1)
{
@@ -2525,7 +2526,6 @@ record_full_base_target::save_record (const char *recfilename)
{
struct record_full_entry *cur_record_full_list;
uint32_t magic;
- struct regcache *regcache;
struct gdbarch *gdbarch;
int save_size = 0;
asection *osec = NULL;
@@ -2546,7 +2546,7 @@ record_full_base_target::save_record (const char *recfilename)
cur_record_full_list = record_full_list;
/* Get the values of regcache and gdbarch. */
- regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
gdbarch = regcache->arch ();
/* Disable the GDB operation record. */
@@ -2731,7 +2731,7 @@ record_full_goto_insn (struct record_full_entry *entry,
{
scoped_restore restore_operation_disable
= record_full_gdb_operation_disable_set ();
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
struct gdbarch *gdbarch = regcache->arch ();
/* Assume everything is valid: we will hit the entry,
diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c
index 585e02e..4b9be85 100644
--- a/gdb/regcache-dump.c
+++ b/gdb/regcache-dump.c
@@ -233,7 +233,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
gdbarch *gdbarch;
if (target_has_registers ())
- gdbarch = get_current_regcache ()->arch ();
+ gdbarch = get_thread_regcache (inferior_thread ())->arch ();
else
gdbarch = current_inferior ()->arch ();
@@ -254,7 +254,8 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
auto dump_pseudo = (what_to_dump == regcache_dump_cooked);
if (target_has_registers ())
- dump.reset (new register_dump_regcache (get_current_regcache (),
+ dump.reset (new register_dump_regcache (get_thread_regcache
+ (inferior_thread ()),
dump_pseudo));
else
{
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 48a926e..48d7db4 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -415,12 +415,6 @@ get_thread_regcache (thread_info *thread)
thread->ptid);
}
-struct regcache *
-get_current_regcache (void)
-{
- return get_thread_regcache (inferior_thread ());
-}
-
/* See gdbsupport/common-regcache.h. */
struct regcache *
diff --git a/gdb/regcache.h b/gdb/regcache.h
index f73f08a..7922a5c 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -30,7 +30,6 @@ class thread_info;
struct process_stratum_target;
struct inferior;
-extern struct regcache *get_current_regcache (void);
extern struct regcache *get_thread_regcache (process_stratum_target *target,
ptid_t ptid);
diff --git a/gdb/reverse.c b/gdb/reverse.c
index 0a9cc29..30d621f 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -113,7 +113,8 @@ save_bookmark_command (const char *args, int from_tty)
{
/* Get target's idea of a bookmark. */
gdb_byte *bookmark_id = target_get_bookmark (args, from_tty);
- struct gdbarch *gdbarch = get_current_regcache ()->arch ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
+ gdbarch *gdbarch = regcache->arch ();
/* CR should not cause another identical bookmark. */
dont_repeat ();
@@ -125,7 +126,7 @@ save_bookmark_command (const char *args, int from_tty)
all_bookmarks.emplace_back ();
bookmark &b = all_bookmarks.back ();
b.number = ++bookmark_count;
- b.pc = regcache_read_pc (get_current_regcache ());
+ b.pc = regcache_read_pc (regcache);
b.sal = find_pc_line (b.pc, 0);
b.sal.pspace = get_frame_program_space (get_current_frame ());
b.opaque_data.reset (bookmark_id);
@@ -237,7 +238,7 @@ goto_bookmark_command (const char *args, int from_tty)
static int
bookmark_1 (int bnum)
{
- struct gdbarch *gdbarch = get_current_regcache ()->arch ();
+ gdbarch *gdbarch = get_thread_regcache (inferior_thread ())->arch ();
int matched = 0;
for (const bookmark &iter : all_bookmarks)
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 4f9ba99..c18791c 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -362,7 +362,7 @@ darwin_read_exec_load_addr_at_init (struct darwin_info *info)
gdb_byte buf[8];
/* Get SP. */
- if (regcache_cooked_read_unsigned (get_current_regcache (),
+ if (regcache_cooked_read_unsigned (get_thread_regcache (inferior_thread ()),
gdbarch_sp_regnum (gdbarch),
&load_ptr_addr) != REG_VALID)
return 0;
@@ -450,7 +450,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
/* We find the dynamic linker's base address by examining
the current pc (which should point at the entry point for the
dynamic linker) and subtracting the offset of the entry point. */
- load_addr = (regcache_read_pc (get_current_regcache ())
+ load_addr = (regcache_read_pc (get_thread_regcache (inferior_thread ()))
- bfd_get_start_address (dyld_bfd.get ()));
/* Now try to set a breakpoint in the dynamic linker. */
@@ -574,7 +574,7 @@ darwin_solib_create_inferior_hook (int from_tty)
for the dynamic linker) and subtracting the offset of
the entry point. */
- pc = regcache_read_pc (get_current_regcache ());
+ pc = regcache_read_pc (get_thread_regcache (inferior_thread ()));
dyld_relocated_base_address = pc - dyld_bfd_start_address;
/* We get the proper notifier relocated address by
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index b02e809..8a5ad59 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1867,7 +1867,7 @@ svr4_handle_solib_event (void)
if (info->probes_table == NULL)
return;
- pc = regcache_read_pc (get_current_regcache ());
+ pc = regcache_read_pc (get_thread_regcache (inferior_thread ()));
pa = solib_event_probe_at (info, pc);
if (pa == nullptr)
{
diff --git a/gdb/stack.c b/gdb/stack.c
index 39dcefa..ef56544 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2798,13 +2798,13 @@ return_command (const char *retval_exp, int from_tty)
if (return_value != NULL)
{
struct type *return_type = return_value->type ();
- struct gdbarch *cache_arch = get_current_regcache ()->arch ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
+ struct gdbarch *cache_arch = regcache->arch ();
gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
&& rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
gdbarch_return_value_as_value
- (cache_arch, function, return_type,
- get_current_regcache (), NULL /*read*/,
+ (cache_arch, function, return_type, regcache, NULL /*read*/,
return_value->contents ().data () /*write*/);
}
diff --git a/gdb/symfile.c b/gdb/symfile.c
index eebc5ea..7f7ac33 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2098,7 +2098,7 @@ generic_load (const char *args, int from_tty)
uiout->text (", load size ");
uiout->field_unsigned ("load-size", total_progress.data_count);
uiout->text ("\n");
- regcache_write_pc (get_current_regcache (), entry);
+ regcache_write_pc (get_thread_regcache (inferior_thread ()), entry);
/* Reset breakpoints, now that we have changed the load image. For
instance, breakpoints may have been set (or reset, by
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 2c54868..d5f29eb 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2283,7 +2283,7 @@ tfind_pc_command (const char *args, int from_tty)
check_trace_running (current_trace_status ());
if (args == 0 || *args == 0)
- pc = regcache_read_pc (get_current_regcache ());
+ pc = regcache_read_pc (get_thread_regcache (inferior_thread ()));
else
pc = parse_and_eval_address (args);
@@ -2731,7 +2731,7 @@ get_traceframe_location (int *stepping_frame_p)
/* The current frame is a trap frame if the frame PC is equal to the
tracepoint PC. If not, then the current frame was collected
during single-stepping. */
- regcache = get_current_regcache ();
+ regcache = get_thread_regcache (inferior_thread ());
/* If the traceframe's address matches any of the tracepoint's
locations, assume it is a direct hit rather than a while-stepping
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index b98efe8..205bf01 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1441,7 +1441,7 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
if (step)
{
/* Single step by setting t bit. */
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
struct gdbarch *gdbarch = regcache->arch ();
fetch_registers (regcache, gdbarch_ps_regnum (gdbarch));
th->wow64_context.EFlags |= FLAG_TRACE_BIT;
@@ -1469,7 +1469,7 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
if (step)
{
/* Single step by setting t bit. */
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
struct gdbarch *gdbarch = regcache->arch ();
fetch_registers (regcache, gdbarch_ps_regnum (gdbarch));
th->context.EFlags |= FLAG_TRACE_BIT;
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index c9935d1..9e7bfde 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -161,7 +161,8 @@ xtensa_read_register (int regnum)
{
ULONGEST value;
- regcache_raw_read_unsigned (get_current_regcache (), regnum, &value);
+ regcache_raw_read_unsigned (get_thread_regcache (inferior_thread ()), regnum,
+ &value);
return (unsigned long) value;
}
@@ -169,7 +170,8 @@ xtensa_read_register (int regnum)
static void
xtensa_write_register (int regnum, ULONGEST value)
{
- regcache_raw_write_unsigned (get_current_regcache (), regnum, value);
+ regcache_raw_write_unsigned (get_thread_regcache (inferior_thread ()), regnum,
+ value);
}
/* Return the window size of the previous call to the function from which we