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,
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,
/* 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;
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);
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);
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);
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);
}
/* 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 ();
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. */
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."));
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
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.
return -1;
else
{
- struct regcache *regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
if (interp_addr != NULL)
{
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
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);
{
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;
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))
{
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
/* 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);
/* 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. */
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;
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
{
INFRUN_SCOPED_DEBUG_ENTER_EXIT;
- struct regcache *regcache;
struct gdbarch *gdbarch;
CORE_ADDR pc;
/* 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);
}
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;
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);
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
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);
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. */
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... */
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))
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, ®val);
return (CONFIG_ATTR) regval;
}
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, ®val);
return regval;
}
mi_cmd_data_write_register_values (const char *command,
const char *const *argv, int argc)
{
- struct regcache *regcache;
struct gdbarch *gdbarch;
int numregs, i;
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);
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. */
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));
/* 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);
}
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;
{
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)
{
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;
{
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;
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);
}
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. */
try
{
- regcache = get_current_regcache ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
while (1)
{
{
struct record_full_entry *cur_record_full_list;
uint32_t magic;
- struct regcache *regcache;
struct gdbarch *gdbarch;
int save_size = 0;
asection *osec = NULL;
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. */
{
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,
gdbarch *gdbarch;
if (target_has_registers ())
- gdbarch = get_current_regcache ()->arch ();
+ gdbarch = get_thread_regcache (inferior_thread ())->arch ();
else
gdbarch = current_inferior ()->arch ();
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
{
thread->ptid);
}
-struct regcache *
-get_current_regcache (void)
-{
- return get_thread_regcache (inferior_thread ());
-}
-
/* See gdbsupport/common-regcache.h. */
struct regcache *
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);
{
/* 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 ();
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);
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)
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;
/* 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. */
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
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)
{
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*/);
}
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
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);
/* 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
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;
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;
{
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;
}
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