aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
struct regcache *regcache;
- regcache = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, gdbarch);
+ regcache = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
target_fetch_registers (regcache, tdep->tls_regnum_base);
amd64fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
CORE_ADDR lm_addr, CORE_ADDR offset)
{
- struct regcache *regcache;
-
- regcache = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, gdbarch);
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
target_fetch_registers (regcache, AMD64_FSBASE_REGNUM);
CORE_ADDR lm_addr, CORE_ADDR offset)
{
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
- struct regcache *regcache;
-
- regcache = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, gdbarch);
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
target_fetch_registers (regcache, tdep->tls_regnum);
}
int
-darwin_nat_target::cancel_breakpoint (ptid_t ptid)
+darwin_nat_target::cancel_breakpoint (inferior *inf, ptid_t ptid)
{
/* Arrange for a breakpoint to be hit again later. We will handle
the current event, eventually we will resume this thread, and this
CORE_ADDR pc;
pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch);
- if (breakpoint_inserted_here_p (regcache->aspace (), pc))
+ if (breakpoint_inserted_here_p (inf->aspace, pc))
{
inferior_debug (4, "cancel_breakpoint for thread 0x%lx\n",
(unsigned long) ptid.tid ());
&& thread->event.ex_type == EXC_BREAKPOINT)
{
if (thread->single_step
- || cancel_breakpoint (ptid_t (inf->pid, 0, thread->gdb_port)))
+ || cancel_breakpoint (inf,
+ ptid_t (inf->pid, 0, thread->gdb_port)))
{
gdb_assert (thread->msg_state == DARWIN_MESSAGE);
darwin_send_reply (inf, thread);
gdb_assert (buf.current_thread != thread);
regcache *regcache = get_thread_regcache (thread);
- const address_space *aspace = regcache->aspace ();
gdbarch *arch = regcache->arch ();
ULONGEST len = gdbarch_displaced_step_buffer_length (arch);
for (displaced_step_buffer &candidate : m_buffers)
{
- bool bp_in_range = breakpoint_in_range_p (aspace, candidate.addr, len);
+ bool bp_in_range = breakpoint_in_range_p (thread->inf->aspace, candidate.addr, len);
bool is_free = candidate.current_thread == nullptr;
if (!bp_in_range)
CODE_ADDR. */
static frame_info_ptr
-create_sentinel_frame (struct program_space *pspace, struct regcache *regcache,
- CORE_ADDR stack_addr, CORE_ADDR code_addr)
+create_sentinel_frame (program_space *pspace, address_space *aspace,
+ regcache *regcache, CORE_ADDR stack_addr,
+ CORE_ADDR code_addr)
{
frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
frame->level = -1;
frame->pspace = pspace;
- frame->aspace = regcache->aspace ();
+ frame->aspace = aspace;
/* Explicitly initialize the sentinel frame's cache. Provide it
with the underlying regcache. In the future additional
information, such as the frame's thread will be added. */
if (sentinel_frame == NULL)
sentinel_frame =
- create_sentinel_frame (current_program_space, get_current_regcache (),
- 0, 0).get ();
+ create_sentinel_frame (current_program_space, current_inferior ()->aspace,
+ get_current_regcache (), 0, 0).get ();
/* Set the current frame before computing the frame id, to avoid
recursion inside compute_frame_id, in case the frame's
frame_info *fi = FRAME_OBSTACK_ZALLOC (struct frame_info);
fi->next = create_sentinel_frame (current_program_space,
+ current_inferior ()->aspace,
get_current_regcache (),
id.stack_addr, id.code_addr).get ();
(struct gdbarch *gdbarch, struct thread_info *info, gdb_signal stop_signal,
bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data, int *note_size)
{
- struct regcache *regcache
- = get_thread_arch_regcache (info->inf->process_target (),
- info->ptid, gdbarch);
+ regcache *regcache
+ = get_thread_arch_regcache (info->inf, info->ptid, gdbarch);
target_fetch_registers (regcache, -1);
gcore_elf_collect_thread_registers (regcache, info->ptid, obfd,
note_data, note_size, stop_signal);
i386fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
CORE_ADDR lm_addr, CORE_ADDR offset)
{
- struct regcache *regcache;
-
- regcache = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, gdbarch);
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
target_fetch_registers (regcache, I386_GSBASE_REGNUM);
point. */
struct regcache *child_regcache
- = get_thread_arch_aspace_regcache (parent_inf,
- event_status.child_ptid (),
- gdbarch,
- parent_inf->aspace);
+ = get_thread_arch_regcache (parent_inf, event_status.child_ptid (),
+ gdbarch);
/* Read PC value of parent. */
CORE_ADDR parent_pc = regcache_read_pc (regcache);
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = regcache->arch ();
struct thread_info *tp = inferior_thread ();
- const address_space *aspace = regcache->aspace ();
ptid_t resume_ptid;
/* This represents the user's step vs continue request. When
deciding whether "set scheduler-locking step" applies, it's the
inferior_ptid.to_string ().c_str (),
paddress (gdbarch, pc));
+ const address_space *aspace = tp->inf->aspace;
+
/* Normally, by the time we reach `resume', the breakpoints are either
removed or inserted, as appropriate. The exception is if we're sitting
at a permanent breakpoint; we need to step over it, but permanent
if (target_is_non_stop_p ())
stop_all_threads ("displaced stepping falling back on inline stepping");
- set_step_over_info (regcache->aspace (),
- regcache_read_pc (regcache), 0, tp->global_num);
+ set_step_over_info (aspace, regcache_read_pc (regcache), 0,
+ tp->global_num);
step = maybe_software_singlestep (gdbarch);
{
struct regcache *regcache = get_thread_regcache (tp);
- if (breakpoint_here_p (regcache->aspace (),
+ if (breakpoint_here_p (tp->inf->aspace,
regcache_read_pc (regcache))
== ordinary_breakpoint_here)
return true;
regcache = get_current_regcache ();
gdbarch = regcache->arch ();
- const address_space *aspace = regcache->aspace ();
pc = regcache_read_pc_protected (regcache);
if (addr == (CORE_ADDR) -1)
{
+ const address_space *aspace = cur_thr->inf->aspace;
+
if (cur_thr->stop_pc_p ()
&& pc == cur_thr->stop_pc ()
&& breakpoint_here_p (aspace, pc) == ordinary_breakpoint_here
paddress (gdbarch, pc));
discard = 1;
}
- else if (!breakpoint_inserted_here_p (regcache->aspace (), pc))
+ else if (!breakpoint_inserted_here_p (tp->inf->aspace, pc))
{
infrun_debug_printf ("previous breakpoint of %s, at %s gone",
tp->ptid.to_string ().c_str (),
if (decr_pc == 0)
return;
- const address_space *aspace = regcache->aspace ();
+ const address_space *aspace = thread->inf->aspace;
/* Find the location where (if we've hit a breakpoint) the
breakpoint would be. */
infrun_debug_printf ("syscall number=%d", syscall_number);
ecs->event_thread->control.stop_bpstat
- = bpstat_stop_status_nowatch (regcache->aspace (),
+ = bpstat_stop_status_nowatch (ecs->event_thread->inf->aspace,
ecs->event_thread->stop_pc (),
ecs->event_thread, ecs->ws);
&& ws.sig () == GDB_SIGNAL_TRAP)
{
struct regcache *regcache = get_thread_regcache (tp);
- const address_space *aspace = regcache->aspace ();
+ const address_space *aspace = tp->inf->aspace;
CORE_ADDR pc = regcache_read_pc (regcache);
adjust_pc_after_break (tp, tp->pending_waitstatus ());
{
struct regcache *regcache = get_thread_regcache (ecs->event_thread);
- if (breakpoint_inserted_here_p (regcache->aspace (),
+ if (breakpoint_inserted_here_p (ecs->event_thread->inf->aspace,
regcache_read_pc (regcache)))
{
infrun_debug_printf ("Treating signal as SIGTRAP");
ecs->event_thread->set_stop_pc (regcache_read_pc (regcache));
ecs->event_thread->control.stop_bpstat
- = bpstat_stop_status_nowatch (regcache->aspace (),
+ = bpstat_stop_status_nowatch (ecs->event_thread->inf->aspace,
ecs->event_thread->stop_pc (),
ecs->event_thread, ecs->ws);
(regcache_read_pc (get_thread_regcache (ecs->event_thread)));
ecs->event_thread->control.stop_bpstat
- = bpstat_stop_status_nowatch (get_current_regcache ()->aspace (),
+ = bpstat_stop_status_nowatch (ecs->event_thread->inf->aspace,
ecs->event_thread->stop_pc (),
ecs->event_thread, ecs->ws);
(regcache_read_pc (get_thread_regcache (ecs->event_thread)));
ecs->event_thread->control.stop_bpstat
- = bpstat_stop_status_nowatch (get_current_regcache ()->aspace (),
+ = bpstat_stop_status_nowatch (ecs->event_thread->inf->aspace,
ecs->event_thread->stop_pc (),
ecs->event_thread, ecs->ws);
CORE_ADDR pc;
regcache = get_thread_regcache (ecs->event_thread);
- const address_space *aspace = regcache->aspace ();
+ const address_space *aspace = ecs->event_thread->inf->aspace;
pc = regcache_read_pc (regcache);
inline function call sites). */
if (ecs->event_thread->control.step_range_end != 1)
{
- const address_space *aspace
- = get_thread_regcache (ecs->event_thread)->aspace ();
+ const address_space *aspace = ecs->event_thread->inf->aspace;
/* skip_inline_frames is expensive, so we avoid it if we can
determine that the address is one where functions cannot have
/* See if there is a breakpoint/watchpoint/catchpoint/etc. that
handles this event. */
ecs->event_thread->control.stop_bpstat
- = bpstat_stop_status (get_current_regcache ()->aspace (),
+ = bpstat_stop_status (ecs->event_thread->inf->aspace,
ecs->event_thread->stop_pc (),
ecs->event_thread, ecs->ws, stop_chain);
if (remove_bp
&& (remove_wps || !use_displaced_stepping (ecs->event_thread)))
{
- set_step_over_info (regcache->aspace (),
+ set_step_over_info (ecs->event_thread->inf->aspace,
regcache_read_pc (regcache), remove_wps,
ecs->event_thread->global_num);
}
return 0;
}
+/* Get the inferior associated to LWP. Must be called with an LWP that has
+ an associated inferior. Always return non-nullptr. */
+
+static inferior *
+lwp_inferior (const lwp_info *lwp)
+{
+ inferior *inf = find_inferior_ptid (linux_target, lwp->ptid);
+ gdb_assert (inf != nullptr);
+ return inf;
+}
+
/* Return non-zero if LP has a wait status pending. Discard the
pending event and resume the LWP if the event that originally
caused the stop became uninteresting. */
}
#if !USE_SIGTRAP_SIGINFO
- else if (!breakpoint_inserted_here_p (regcache->aspace (), pc))
+ else if (!breakpoint_inserted_here_p (lwp_inferior (lp)->aspace, pc))
{
linux_nat_debug_printf ("previous breakpoint of %s, at %s gone",
lp->ptid.to_string ().c_str (),
if (!linux_target->low_status_is_event (lp->status))
return;
- inferior *inf = find_inferior_ptid (linux_target, lp->ptid);
+ inferior *inf = lwp_inferior (lp);
if (inf->starting_up)
return;
}
#else
if ((!lp->step || lp->stop_pc == sw_bp_pc)
- && software_breakpoint_inserted_here_p (regcache->aspace (),
- sw_bp_pc))
+ && software_breakpoint_inserted_here_p (inf->aspace, sw_bp_pc))
{
/* The LWP was either continued, or stepped a software
breakpoint instruction. */
lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
}
- if (hardware_breakpoint_inserted_here_p (regcache->aspace (), pc))
+ if (hardware_breakpoint_inserted_here_p (inf->aspace, pc))
lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
if (lp->stop_reason == TARGET_STOPPED_BY_NO_REASON)
static int
resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid)
{
- inferior *inf = find_inferior_ptid (linux_target, lp->ptid);
+ inferior *inf = lwp_inferior (lp);
if (!lp->stopped)
{
immediately, and we're not waiting for this LWP. */
if (!lp->ptid.matches (wait_ptid))
{
- if (breakpoint_inserted_here_p (regcache->aspace (), pc))
+ if (breakpoint_inserted_here_p (inf->aspace, pc))
leave_stopped = 1;
}
iterate_over_lwps (ptid, linux_nat_stop_lwp);
}
-/* When requests are passed down from the linux-nat layer to the
- single threaded inf-ptrace layer, ptids of (lwpid,0,0) form are
- used. The address space pointer is stored in the inferior object,
- but the common code that is passed such ptid can't tell whether
- lwpid is a "main" process id or not (it assumes so). We reverse
- look up the "main" process id from the lwp here. */
-
-struct address_space *
-linux_nat_target::thread_address_space (ptid_t ptid)
-{
- struct lwp_info *lwp;
- struct inferior *inf;
- int pid;
-
- if (ptid.lwp () == 0)
- {
- /* An (lwpid,0,0) ptid. Look up the lwp object to get at the
- tgid. */
- lwp = find_lwp_pid (ptid);
- pid = lwp->ptid.pid ();
- }
- else
- {
- /* A (pid,lwpid,0) ptid. */
- pid = ptid.pid ();
- }
-
- inf = find_inferior_pid (this, pid);
- gdb_assert (inf != NULL);
- return inf->aspace;
-}
-
/* Return the cached value of the processor core for thread PTID. */
int
const char *thread_name (struct thread_info *) override;
- struct address_space *thread_address_space (ptid_t) override;
-
bool stopped_by_watchpoint () override;
bool stopped_data_address (CORE_ADDR *) override;
CORE_ADDR lm_addr, CORE_ADDR offset)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
- struct regcache *regcache;
int tp_offset, tp_regnum;
-
- regcache = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, gdbarch);
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
if (tdep->wordsize == 4)
{
get_ps_regcache (struct ps_prochandle *ph, lwpid_t lwpid)
{
inferior *inf = ph->thread->inf;
- return get_thread_arch_regcache (inf->process_target (),
- ptid_t (inf->pid, lwpid),
+ return get_thread_arch_regcache (inf, ptid_t (inf->pid, lwpid),
inf->arch ());
}
{
}
-struct address_space *
-process_stratum_target::thread_address_space (ptid_t ptid)
-{
- /* Fall-back to the "main" address space of the inferior. */
- inferior *inf = find_inferior_ptid (this, ptid);
-
- if (inf == NULL || inf->aspace == NULL)
- internal_error (_("Can't determine the current "
- "address space of thread %s\n"),
- target_pid_to_str (ptid).c_str ());
-
- return inf->aspace;
-}
-
struct gdbarch *
process_stratum_target::thread_architecture (ptid_t ptid)
{
bool supports_non_stop () override { return false; }
bool supports_disable_randomization () override { return false; }
- /* This default implementation returns the inferior's address
- space. */
- struct address_space *thread_address_space (ptid_t ptid) override;
-
/* This default implementation always returns the current inferior's
gdbarch. */
struct gdbarch *thread_architecture (ptid_t ptid) override;
not doing the change at all if the watchpoint
traps. */
if (hardware_watchpoint_inserted_in_range
- (regcache->aspace (),
+ (current_inferior ()->aspace,
entry->u.mem.addr, entry->u.mem.len))
record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
}
ret);
regcache = get_current_regcache ();
tmp_pc = regcache_read_pc (regcache);
- const struct address_space *aspace = regcache->aspace ();
+ const address_space *aspace = current_inferior ()->aspace;
if (target_stopped_by_watchpoint ())
{
record_full_resume_ptid);
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = regcache->arch ();
- const struct address_space *aspace = regcache->aspace ();
+ const address_space *aspace = current_inferior ()->aspace;
int continue_flag = 1;
int first_record_full_end = 1;
}
}
-regcache::regcache (inferior *inf_for_target_calls, gdbarch *gdbarch,
- const address_space *aspace_)
+regcache::regcache (inferior *inf_for_target_calls, gdbarch *gdbarch)
/* The register buffers. A read/write register cache can only hold
[0 .. gdbarch_num_regs). */
- : detached_regcache (gdbarch, false), m_aspace (aspace_),
+ : detached_regcache (gdbarch, false),
m_inf_for_target_calls (inf_for_target_calls)
{
m_ptid = minus_one_ptid;
target when appropriate. */
static target_pid_ptid_regcache_map regcaches;
-struct regcache *
-get_thread_arch_aspace_regcache (inferior *inf_for_target_calls,
- ptid_t ptid, gdbarch *arch,
- struct address_space *aspace)
+regcache *
+get_thread_arch_regcache (inferior *inf_for_target_calls, ptid_t ptid,
+ gdbarch *arch)
{
gdb_assert (inf_for_target_calls != nullptr);
}
/* It does not exist, create it. */
- regcache *new_regcache = new regcache (inf_for_target_calls, arch, aspace);
+ regcache *new_regcache = new regcache (inf_for_target_calls, arch);
new_regcache->set_ptid (ptid);
/* Work around a problem with g++ 4.8 (PR96537): Call the regcache_up
constructor explicitly instead of implicitly. */
return new_regcache;
}
-struct regcache *
-get_thread_arch_regcache (process_stratum_target *target, ptid_t ptid,
- struct gdbarch *gdbarch)
-{
- scoped_restore_current_inferior restore_current_inferior;
- inferior *inf = find_inferior_ptid (target, ptid);
- set_current_inferior (inf);
- address_space *aspace = target_thread_address_space (ptid);
-
- return get_thread_arch_aspace_regcache (inf, ptid, gdbarch, aspace);
-}
-
static process_stratum_target *current_thread_target;
static ptid_t current_thread_ptid;
static struct gdbarch *current_thread_arch;
struct regcache *
get_thread_regcache (process_stratum_target *target, ptid_t ptid)
{
+ inferior *inf = find_inferior_ptid (target, ptid);
+
if (!current_thread_arch
|| target != current_thread_target
|| current_thread_ptid != ptid)
current_thread_target = target;
scoped_restore_current_inferior restore_current_inferior;
- set_current_inferior (find_inferior_ptid (target, ptid));
+ set_current_inferior (inf);
current_thread_arch = target_thread_architecture (ptid);
}
- return get_thread_arch_regcache (target, ptid, current_thread_arch);
+ return get_thread_arch_regcache (inf, ptid, current_thread_arch);
}
/* See regcache.h. */
return 0;
};
-/* Wrapper around get_thread_arch_aspace_regcache that does some self checks. */
+/* Wrapper around get_thread_arch_regcache that does some self checks. */
static void
-get_thread_arch_aspace_regcache_and_check (inferior *inf_for_target_calls,
- ptid_t ptid)
+get_thread_arch_regcache_and_check (inferior *inf_for_target_calls,
+ ptid_t ptid)
{
/* We currently only test with a single gdbarch. Any gdbarch will do, so use
the current inferior's gdbarch. Also use the current inferior's address
space. */
gdbarch *arch = inf_for_target_calls->arch ();
- address_space *aspace = inf_for_target_calls->aspace;
- regcache *regcache = get_thread_arch_aspace_regcache (inf_for_target_calls,
- ptid, arch, aspace);
+ regcache *regcache
+ = get_thread_arch_regcache (inf_for_target_calls, ptid, arch);
SELF_CHECK (regcache != NULL);
SELF_CHECK (regcache->ptid () == ptid);
SELF_CHECK (regcache->arch () == arch);
- SELF_CHECK (regcache->aspace () == aspace);
}
/* The data that the regcaches selftests must hold onto for the duration of the
{
for (long lwp : { 1, 2, 3 })
{
- get_thread_arch_aspace_regcache_and_check
+ get_thread_arch_regcache_and_check
(&data->test_ctx_1.mock_inferior, ptid_t (pid, lwp));
expected_regcache_size++;
SELF_CHECK (regcaches_size () == expected_regcache_size);
- get_thread_arch_aspace_regcache_and_check
+ get_thread_arch_regcache_and_check
(&data->test_ctx_2.mock_inferior, ptid_t (pid, lwp));
expected_regcache_size++;
SELF_CHECK (regcaches_size () == expected_regcache_size);
}
static void
-get_thread_arch_aspace_regcache_test ()
+get_thread_arch_regcache_test ()
{
/* populate_regcaches_for_test already tests most of the
- get_thread_arch_aspace_regcache functionality. */
+ get_thread_arch_regcache functionality. */
regcache_test_data_up data = populate_regcaches_for_test ();
size_t regcaches_size_before = regcaches_size ();
/* Test that getting an existing regcache doesn't create a new one. */
- get_thread_arch_aspace_regcache_and_check (&data->test_ctx_1.mock_inferior,
- ptid_t (2, 2));
+ get_thread_arch_regcache_and_check (&data->test_ctx_1.mock_inferior,
+ ptid_t (2, 2));
SELF_CHECK (regcaches_size () == regcaches_size_before);
}
public:
readwrite_regcache (inferior *inf_for_target_calls,
struct gdbarch *gdbarch)
- : regcache (inf_for_target_calls, gdbarch, nullptr)
+ : regcache (inf_for_target_calls, gdbarch)
{}
};
gdb_assert (regcaches.empty ());
/* Populate the regcaches container. */
- get_thread_arch_aspace_regcache (&target1.mock_inferior, old_ptid, arch,
- nullptr);
- get_thread_arch_aspace_regcache (&target2.mock_inferior, old_ptid, arch,
- nullptr);
+ get_thread_arch_regcache (&target1.mock_inferior, old_ptid, arch);
+ get_thread_arch_regcache (&target2.mock_inferior, old_ptid, arch);
gdb_assert (regcaches.size () == 2);
gdb_assert (regcache_count (&target1.mock_target, old_ptid) == 1);
deprecate_cmd (c, "maintenance flush register-cache");
#if GDB_SELF_TEST
- selftests::register_test ("get_thread_arch_aspace_regcache",
- selftests::get_thread_arch_aspace_regcache_test);
+ selftests::register_test ("get_thread_arch_regcache",
+ selftests::get_thread_arch_regcache_test);
selftests::register_test ("registers_changed_ptid_all",
selftests::registers_changed_ptid_all_test);
selftests::register_test ("registers_changed_ptid_target",
struct regcache;
struct regset;
struct gdbarch;
-struct address_space;
class thread_info;
struct process_stratum_target;
struct inferior;
/* Get the regcache of THREAD. */
extern struct regcache *get_thread_regcache (thread_info *thread);
-extern struct regcache *get_thread_arch_regcache
- (process_stratum_target *targ, ptid_t, struct gdbarch *);
-extern struct regcache *get_thread_arch_aspace_regcache
- (inferior *inf_for_target_calls, ptid_t,
- struct gdbarch *, struct address_space *);
+extern regcache *get_thread_arch_regcache (inferior *inf_for_target_calls,
+ ptid_t ptid, gdbarch *arch);
extern enum register_status
regcache_raw_read_signed (struct regcache *regcache,
public:
DISABLE_COPY_AND_ASSIGN (regcache);
- /* Return REGCACHE's address space. */
- const address_space *aspace () const
- {
- return m_aspace;
- }
-
/* Restore 'this' regcache. The set of registers restored into
the regcache determined by the restore_reggroup.
Writes to regcache will go through to the target. SRC is a
void debug_print_register (const char *func, int regno);
protected:
- regcache (inferior *inf_for_target_calls, gdbarch *gdbarch,
- const address_space *aspace);
+ regcache (inferior *inf_for_target_calls, gdbarch *gdbarch);
private:
enum register_status write_part (int regnum, int offset, int len,
const gdb_byte *in, bool is_raw);
- /* The address space of this register cache (for registers where it
- makes sense, like PC or SP). */
- const address_space * const m_aspace;
-
/* The inferior to switch to, to make target calls.
This may not be the inferior of thread M_PTID. For instance, this
it connected to? */
ptid_t m_ptid;
- friend struct regcache *
- get_thread_arch_aspace_regcache (inferior *inf_for_target_calls, ptid_t ptid,
- struct gdbarch *gdbarch,
- struct address_space *aspace);
+ friend regcache *get_thread_arch_regcache (inferior *inf_for_target_calls,
+ ptid_t ptid, gdbarch *gdbarch);
};
using regcache_up = std::unique_ptr<regcache>;
&& status->kind () != TARGET_WAITKIND_SIGNALLED
&& status->kind () != TARGET_WAITKIND_NO_RESUMED)
{
+ remote_notice_new_inferior (ptid, false);
+
/* Expedited registers. */
if (!stop_reply->regcache.empty ())
{
already). */
gdb_assert (status->kind () != TARGET_WAITKIND_THREAD_EXITED);
- struct regcache *regcache
- = get_thread_arch_regcache (this, ptid, stop_reply->arch);
+ regcache *regcache
+ = get_thread_arch_regcache (find_inferior_ptid (this, ptid), ptid,
+ stop_reply->arch);
for (cached_reg_t ® : stop_reply->regcache)
{
stop_reply->regcache.clear ();
}
- remote_notice_new_inferior (ptid, false);
remote_thread_info *remote_thr = get_remote_thread_info (this, ptid);
remote_thr->core = stop_reply->core;
remote_thr->stop_reason = stop_reply->stop_reason;
riscv_fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
CORE_ADDR lm_addr, CORE_ADDR offset)
{
- struct regcache *regcache;
-
- regcache = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, gdbarch);
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
target_fetch_registers (regcache, RISCV_TP_REGNUM);
ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
- struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, current_inferior ()->arch ());
+ regcache *regcache = get_thread_arch_regcache (current_inferior (), ptid,
+ current_inferior ()->arch ());
target_fetch_registers (regcache, -1);
fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
const prgregset_t gregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
- struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, current_inferior ()->arch ());
+ regcache *regcache = get_thread_arch_regcache (current_inferior (), ptid,
+ current_inferior ()->arch ());
supply_gregset (regcache, (const gdb_gregset_t *) gregset);
target_store_registers (regcache, -1);
prfpregset_t *fpregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
- struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, current_inferior ()->arch ());
+ regcache *regcache = get_thread_arch_regcache (current_inferior (), ptid,
+ current_inferior ()->arch ());
target_fetch_registers (regcache, -1);
fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
const prfpregset_t * fpregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
- struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, current_inferior ()->arch ());
+ regcache *regcache = get_thread_arch_regcache (current_inferior (), ptid,
+ current_inferior ()->arch ());
supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
target_store_registers (regcache, -1);
most cases. */
if (!load_addr_found)
{
- struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- inferior_ptid,
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), inferior_ptid,
current_inferior ()->arch ());
load_addr = (regcache_read_pc (regcache)
void dumpcore (const char *arg0) override;
bool can_run_breakpoint_commands () override;
struct gdbarch *thread_architecture (ptid_t arg0) override;
- struct address_space *thread_address_space (ptid_t arg0) override;
bool filesystem_is_local () override;
void trace_init () override;
void download_tracepoint (struct bp_location *arg0) override;
void dumpcore (const char *arg0) override;
bool can_run_breakpoint_commands () override;
struct gdbarch *thread_architecture (ptid_t arg0) override;
- struct address_space *thread_address_space (ptid_t arg0) override;
bool filesystem_is_local () override;
void trace_init () override;
void download_tracepoint (struct bp_location *arg0) override;
return result;
}
-struct address_space *
-target_ops::thread_address_space (ptid_t arg0)
-{
- return this->beneath ()->thread_address_space (arg0);
-}
-
-struct address_space *
-dummy_target::thread_address_space (ptid_t arg0)
-{
- return NULL;
-}
-
-struct address_space *
-debug_target::thread_address_space (ptid_t arg0)
-{
- gdb_printf (gdb_stdlog, "-> %s->thread_address_space (...)\n", this->beneath ()->shortname ());
- struct address_space * result
- = this->beneath ()->thread_address_space (arg0);
- gdb_printf (gdb_stdlog, "<- %s->thread_address_space (", this->beneath ()->shortname ());
- target_debug_print_ptid_t (arg0);
- gdb_puts (") = ", gdb_stdlog);
- target_debug_print_address_space_p (result);
- gdb_puts ("\n", gdb_stdlog);
- return result;
-}
-
bool
target_ops::filesystem_is_local ()
{
return target_read_stralloc (t, TARGET_OBJECT_OSDATA, type);
}
-/* Determine the current address space of thread PTID. */
-
-struct address_space *
-target_thread_address_space (ptid_t ptid)
-{
- struct address_space *aspace;
-
- aspace = current_inferior ()->top_target ()->thread_address_space (ptid);
- gdb_assert (aspace != NULL);
-
- return aspace;
-}
-
/* See target.h. */
target_ops *
virtual struct gdbarch *thread_architecture (ptid_t)
TARGET_DEFAULT_RETURN (NULL);
- /* Determine current address space of thread PTID. */
- virtual struct address_space *thread_address_space (ptid_t)
- TARGET_DEFAULT_RETURN (NULL);
-
/* Target file operations. */
/* Return true if the filesystem seen by the current inferior
extern void target_prepare_to_store (regcache *regcache);
-/* Determine current address space of thread PTID. */
-
-struct address_space *target_thread_address_space (ptid_t);
-
/* Implement the "info proc" command. This returns one if the request
was handled, and zero otherwise. It can also throw an exception if
an error was encountered while attempting to handle the