gdb: remove get_current_regcache

Remove get_current_regcache, inlining the call to get_thread_regcache in
callers.  When possible, pass the right thread_info object known from
the local context.  Otherwise, fall back to passing `inferior_thread ()`.

This makes the reference to global context bubble up one level, a small
step towards the long term goal of reducing the number of references to
global context (or rather, moving those references as close as possible
to the top of the call tree).

No behavior change expected.

Change-Id: Ifa6980c88825d803ea586546b6b4c633c33be8d6
This commit is contained in:
Simon Marchi 2023-11-05 04:47:26 +00:00
parent 7438771288
commit 9c742269ec
31 changed files with 80 additions and 83 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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 ();

View File

@ -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.

View File

@ -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)
{

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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... */

View File

@ -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))

View File

@ -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;
}

View File

@ -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);

View File

@ -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. */

View File

@ -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));

View File

@ -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);
}

View File

@ -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,

View File

@ -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
{

View File

@ -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 *

View File

@ -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);

View File

@ -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)

View File

@ -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

View File

@ -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)
{

View File

@ -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*/);
}

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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