{
public:
/* Add our register access methods. */
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
void store_registers (struct regcache *, int) override;
const struct target_desc *read_description () override;
void
aarch64_linux_nat_target::fetch_registers (struct regcache *regcache,
- int regno)
+ int regno, bool only_this)
{
if (gdbarch_bfd_arch_info (regcache->arch ())->bits_per_word == 32)
aarch32_fetch_registers (regcache, regno);
register_status status;
gdb_byte buf[8];
- status = regcache->raw_read (AARCH64_SVE_VG_REGNUM, buf);
+ status = regcache->raw_read (AARCH64_SVE_VG_REGNUM, buf, true);
if (status != REG_VALID)
return;
register_status status;
gdb_byte buf[8];
- status = regcache->raw_read (AARCH64_SVE_VG_REGNUM, buf);
+ status = regcache->raw_read (AARCH64_SVE_VG_REGNUM, buf, true);
if (status != REG_VALID)
return;
void resume (ptid_t, int, enum gdb_signal) override;
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
thread/process connected to REGCACHE. */
void
-aix_thread_target::fetch_registers (struct regcache *regcache, int regno)
+aix_thread_target::fetch_registers (struct regcache *regcache, int regno,
+ bool only_this)
{
struct thread_info *thread;
pthdb_tid_t tid;
exists. */
if (regcache->ptid ().tid () == 0)
- beneath ()->fetch_registers (regcache, regno);
+ beneath ()->fetch_registers (regcache, regno, only_this);
else
{
thread = current_inferior ()->find_thread (regcache->ptid ());
void commit_resumed () override;
void stop (ptid_t ptid) override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
void store_registers (struct regcache *, int) override;
void update_thread_list () override;
}
void
-amd_dbgapi_target::fetch_registers (struct regcache *regcache, int regno)
+amd_dbgapi_target::fetch_registers (struct regcache *regcache, int regno,
+ bool only_this)
{
if (!ptid_is_gpu (regcache->ptid ()))
{
- beneath ()->fetch_registers (regcache, regno);
+ beneath ()->fetch_registers (regcache, regno, only_this);
return;
}
void mourn_inferior () override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
void store_registers (struct regcache *, int) override;
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
}
void
-bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum)
+bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum,
+ bool only_this)
{
struct gdbarch *gdbarch = regcache->arch ();
struct bsd_uthread_ops *uthread_ops = get_bsd_uthread (gdbarch);
inferior_ptid = ptid;
/* Always fetch the appropriate registers from the layer beneath. */
- beneath ()->fetch_registers (regcache, regnum);
+ beneath ()->fetch_registers (regcache, regnum, only_this);
/* FIXME: That might have gotten us more than we asked for. Make
sure we overwrite all relevant registers with values from the
void close () override;
void detach (inferior *, int) override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
enum target_xfer_status xfer_partial (enum target_object object,
const char *annex,
part, typically implemented in the xm-file for each
architecture. */
-/* We just get all the registers, so we don't use regno. */
+/* We just get all the registers, so we don't use regno nor only_this. */
void
-core_target::fetch_registers (struct regcache *regcache, int regno)
+core_target::fetch_registers (struct regcache *regcache, int regno,
+ bool only_this)
{
if (!(m_core_gdbarch != nullptr
&& gdbarch_iterate_over_regset_sections_p (m_core_gdbarch)))
void disconnect (const char *, int) override;
- void fetch_registers (struct regcache *, int) override = 0;
+ void fetch_registers (struct regcache *, int, bool) override = 0;
void store_registers (struct regcache *, int) override = 0;
void prepare_to_store (struct regcache *) override;
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
void resume (ptid_t, int, enum gdb_signal) override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
void store_registers (struct regcache *, int) override;
void prepare_to_store (struct regcache *) override;
void
ravenscar_thread_target::fetch_registers (struct regcache *regcache,
- int regnum)
+ int regnum, bool only_this)
{
ptid_t ptid = regcache->ptid ();
if (use_beneath)
{
temporarily_change_regcache_ptid changer (regcache, base);
- beneath ()->fetch_registers (regcache, i);
+ beneath ()->fetch_registers (regcache, i, only_this);
}
else
arch_ops->fetch_register (regcache, i);
}
}
else
- beneath ()->fetch_registers (regcache, regnum);
+ beneath ()->fetch_registers (regcache, regnum, only_this);
}
void
int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
enum remove_bp_reason) override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
void store_registers (struct regcache *, int) override;
void prepare_to_store (struct regcache *) override;
/* The fetch_registers method of target record-btrace. */
void
-record_btrace_target::fetch_registers (struct regcache *regcache, int regno)
+record_btrace_target::fetch_registers (struct regcache *regcache, int regno,
+ bool only_this)
{
btrace_insn_iterator *replay = nullptr;
regcache->raw_supply (regno, &insn->pc);
}
else
- this->beneath ()->fetch_registers (regcache, regno);
+ this->beneath ()->fetch_registers (regcache, regno, only_this);
}
/* The store_registers method of target record-btrace. */
void resume (ptid_t, int, enum gdb_signal) override;
void disconnect (const char *, int) override;
void kill () override;
- void fetch_registers (struct regcache *regcache, int regno) override;
+ void fetch_registers (struct regcache *regcache, int regno, bool) override;
void prepare_to_store (struct regcache *regcache) override;
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
void
record_full_core_target::fetch_registers (struct regcache *regcache,
- int regno)
+ int regno, bool only_this)
{
if (regno < 0)
{
}
void
-regcache::raw_update (int regnum)
+regcache::raw_update (int regnum, bool only_this)
{
assert_regnum (regnum);
std::optional<scoped_restore_current_thread> maybe_restore_thread
= maybe_switch_inferior (m_inf_for_target_calls);
- target_fetch_registers (this, regnum);
+ target_fetch_registers (this, regnum, only_this);
/* A number of targets can't access the whole set of raw
registers (because the debug API provides no means to get at
}
register_status
-readable_regcache::raw_read (int regnum, gdb::array_view<gdb_byte> dst)
+readable_regcache::raw_read (int regnum, gdb::array_view<gdb_byte> dst,
+ bool only_this)
{
assert_regnum (regnum);
gdb_assert (dst.size () == register_size (regnum));
- raw_update (regnum);
+ raw_update (regnum, only_this);
if (m_register_status[regnum] != REG_VALID)
memset (dst.data (), 0, dst.size ());
xfer_partial_called = 0;
}
- void fetch_registers (regcache *regs, int regno) override;
+ void fetch_registers (regcache *regs, int regno, bool) override;
void store_registers (regcache *regs, int regno) override;
enum target_xfer_status xfer_partial (enum target_object object,
};
void
-target_ops_no_register::fetch_registers (regcache *regs, int regno)
+target_ops_no_register::fetch_registers (regcache *regs, int regno,
+ bool only_this)
{
/* Mark register available. */
regs->raw_supply_zeroed (regno);
{}
/* Transfer a raw register [0..NUM_REGS) from core-gdb to this regcache,
- return its value in *BUF and return its availability status. */
- register_status raw_read (int regnum, gdb::array_view<gdb_byte> dst);
+ return its value in *BUF and return its availability status.
+
+ If ONLY_THIS is true, then don't try to fetch other registers in the
+ process of updating REGNUM. This may be required when REGNUM is used
+ by a target_description parameter. */
+ register_status raw_read (int regnum, gdb::array_view<gdb_byte> dst,
+ bool only_this = false);
/* Deprecated overload of the above. */
register_status raw_read (int regnum, gdb_byte *dst);
gdb_byte *dst)
{ return raw_read_part (regnum, offset, gdb::make_array_view (dst, len)); }
- /* Make certain that the register REGNUM is up-to-date. */
- virtual void raw_update (int regnum) = 0;
+ /* Make certain that the register REGNUM is up-to-date.
+
+ If ONLY_THIS is true, then don't try to fetch other registers in the
+ process of updating REGNUM. This may be required when REGNUM is used
+ by a target_description parameter. */
+ virtual void raw_update (int regnum, bool only_this = false) = 0;
/* Transfer a raw register [0..NUM_REGS+NUM_PSEUDO_REGS) from core-gdb to
this regcache, return its value in DST and return its availability status. */
: readable_regcache (gdbarch, has_pseudo)
{}
- void raw_update (int regnum) override
+ void raw_update (int regnum, bool only_this) override
{}
DISABLE_COPY_AND_ASSIGN (detached_regcache);
template<typename T, typename = RequireLongest<T>>
void cooked_write (int regnum, T val);
- void raw_update (int regnum) override;
+ void raw_update (int regnum, bool only_this = false) override;
/* Partial transfer of raw registers. Perform read, modify, write style
operations. */
DISABLE_COPY_AND_ASSIGN (readonly_detached_regcache);
- void raw_update (int regnum) override
+ void raw_update (int regnum, bool only_this = false) override
{}
};
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
bool has_pending_events () override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
void store_registers (struct regcache *, int) override;
void prepare_to_store (struct regcache *) override;
}
void
-remote_target::fetch_registers (struct regcache *regcache, int regnum)
+remote_target::fetch_registers (struct regcache *regcache, int regnum,
+ bool only_this)
{
struct gdbarch *gdbarch = regcache->arch ();
struct remote_state *rs = get_remote_state ();
we are likely to read more than one register. If this is the
first 'g' packet, we might be overly optimistic about its
contents, so fall back to 'p'. */
- if (reg->in_g_packet)
+ if (!only_this && reg->in_g_packet)
{
fetch_registers_using_g (regcache);
if (reg->in_g_packet)
std::string pid_to_str (ptid_t) override;
ptid_t get_ada_task_ptid (long lwp, ULONGEST thread) override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
}
void
-sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
+sol_thread_target::fetch_registers (struct regcache *regcache, int regnum,
+ bool only_this)
{
thread_t thread;
td_thrhandle_t thandle;
if (!ptid.tid_p ())
{
/* It's an LWP; pass the request on to the layer beneath. */
- beneath ()->fetch_registers (regcache, regnum);
+ beneath ()->fetch_registers (regcache, regnum, only_this);
return;
}
void resume (ptid_t arg0, int arg1, enum gdb_signal arg2) override;
void commit_resumed () override;
ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_flags arg2) override;
- void fetch_registers (struct regcache *arg0, int arg1) override;
+ void fetch_registers (struct regcache *arg0, int arg1, bool arg2) override;
void store_registers (struct regcache *arg0, int arg1) override;
void prepare_to_store (struct regcache *arg0) override;
void files_info () override;
void resume (ptid_t arg0, int arg1, enum gdb_signal arg2) override;
void commit_resumed () override;
ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_flags arg2) override;
- void fetch_registers (struct regcache *arg0, int arg1) override;
+ void fetch_registers (struct regcache *arg0, int arg1, bool arg2) override;
void store_registers (struct regcache *arg0, int arg1) override;
void prepare_to_store (struct regcache *arg0) override;
void files_info () override;
}
void
-target_ops::fetch_registers (struct regcache *arg0, int arg1)
+target_ops::fetch_registers (struct regcache *arg0, int arg1, bool arg2)
{
- this->beneath ()->fetch_registers (arg0, arg1);
+ this->beneath ()->fetch_registers (arg0, arg1, arg2);
}
void
-dummy_target::fetch_registers (struct regcache *arg0, int arg1)
+dummy_target::fetch_registers (struct regcache *arg0, int arg1, bool arg2)
{
}
void
-debug_target::fetch_registers (struct regcache *arg0, int arg1)
+debug_target::fetch_registers (struct regcache *arg0, int arg1, bool arg2)
{
target_debug_printf_nofunc ("-> %s->fetch_registers (...)", this->beneath ()->shortname ());
- this->beneath ()->fetch_registers (arg0, arg1);
- target_debug_printf_nofunc ("<- %s->fetch_registers (%s, %s)",
+ this->beneath ()->fetch_registers (arg0, arg1, arg2);
+ target_debug_printf_nofunc ("<- %s->fetch_registers (%s, %s, %s)",
this->beneath ()->shortname (),
target_debug_print_regcache_p (arg0).c_str (),
- target_debug_print_int (arg1).c_str ());
+ target_debug_print_int (arg1).c_str (),
+ target_debug_print_bool (arg2).c_str ());
}
void
}
void
-target_fetch_registers (struct regcache *regcache, int regno)
+target_fetch_registers (struct regcache *regcache, int regno, bool only_this)
{
- current_inferior ()->top_target ()->fetch_registers (regcache, regno);
+ current_inferior ()->top_target ()->fetch_registers (regcache, regno,
+ only_this);
target_debug_printf ("%s", regcache->register_debug_string (regno).c_str ());
}
virtual ptid_t wait (ptid_t, struct target_waitstatus *,
target_wait_flags options)
TARGET_DEFAULT_FUNC (default_target_wait);
- virtual void fetch_registers (struct regcache *, int)
+ virtual void fetch_registers (struct regcache *, int, bool)
TARGET_DEFAULT_IGNORE ();
virtual void store_registers (struct regcache *, int)
TARGET_DEFAULT_NORETURN (noprocess ());
extern bool target_has_pending_events ();
-/* Fetch at least register REGNO, or all regs if regno == -1. No result. */
+/* Fetch at least register REGNO, or all regs if regno == -1. No result.
-extern void target_fetch_registers (struct regcache *regcache, int regno);
+ If ONLY_THIS is true, then try to minimize the number of registers
+ fetched in the process of updating REGNUM. This may be required when
+ REGNUM is used by a target_description parameter.
+ */
+
+extern void target_fetch_registers (struct regcache *regcache, int regno,
+ bool only_this = false);
/* Store at least register REGNO, or all regs if REGNO == -1.
It can store as many registers as it wants to, so target_prepare_to_store
{ return ctf_target_info; }
void close () override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
enum target_xfer_status xfer_partial (enum target_object object,
const char *annex,
gdb_byte *readbuf,
If no matched events are found, mark registers unavailable. */
void
-ctf_target::fetch_registers (struct regcache *regcache, int regno)
+ctf_target::fetch_registers (struct regcache *regcache, int regno,
+ bool only_this)
{
struct gdbarch *gdbarch = regcache->arch ();
struct bt_ctf_event *event = NULL;
{ return tfile_target_info; }
void close () override;
- void fetch_registers (struct regcache *, int) override;
+ void fetch_registers (struct regcache *, int, bool) override;
enum target_xfer_status xfer_partial (enum target_object object,
const char *annex,
gdb_byte *readbuf,
requested register from it. */
void
-tfile_target::fetch_registers (struct regcache *regcache, int regno)
+tfile_target::fetch_registers (struct regcache *regcache, int regno,
+ bool only_this)
{
struct gdbarch *gdbarch = regcache->arch ();
int offset, regn, regsize, dummy;