aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2018-05-30 22:58:37 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2018-05-31 16:08:59 -0400
commit717f15ef5d388ab752a7438eb31bbd5f0024878c (patch)
treea65347af57bbb8a83e6d1950f27b33cd224e4117
parent79f5641f99ea86b6f903a845aeb7caef3bd1932c (diff)
downloadgdb-717f15ef5d388ab752a7438eb31bbd5f0024878c.zip
gdb-717f15ef5d388ab752a7438eb31bbd5f0024878c.tar.gz
gdb-717f15ef5d388ab752a7438eb31bbd5f0024878c.tar.bz2
Make target_store_registers take reg_buffer
-rw-r--r--gdb/aarch32-linux-nat.c4
-rw-r--r--gdb/aarch32-linux-nat.h4
-rw-r--r--gdb/aarch64-linux-nat.c20
-rw-r--r--gdb/amd64-linux-nat.c12
-rw-r--r--gdb/amd64-nat.c2
-rw-r--r--gdb/amd64-nat.h2
-rw-r--r--gdb/amd64-obsd-tdep.c2
-rw-r--r--gdb/amd64-tdep.c4
-rw-r--r--gdb/amd64-tdep.h4
-rw-r--r--gdb/bsd-uthread.c14
-rw-r--r--gdb/bsd-uthread.h2
-rw-r--r--gdb/i386-obsd-tdep.c2
-rw-r--r--gdb/i387-tdep.c8
-rw-r--r--gdb/i387-tdep.h4
-rw-r--r--gdb/inf-child.h2
-rw-r--r--gdb/proc-service.c4
-rw-r--r--gdb/ravenscar-thread.c10
-rw-r--r--gdb/record-btrace.c9
-rw-r--r--gdb/record-full.c19
-rw-r--r--gdb/record-full.h2
-rw-r--r--gdb/regcache.c9
-rw-r--r--gdb/remote.c14
-rw-r--r--gdb/rs6000-aix-tdep.c2
-rw-r--r--gdb/rs6000-lynx178-tdep.c2
-rw-r--r--gdb/sparc-obsd-tdep.c4
-rw-r--r--gdb/sparc-tdep.c4
-rw-r--r--gdb/sparc-tdep.h2
-rw-r--r--gdb/sparc64-obsd-tdep.c4
-rw-r--r--gdb/sparc64-tdep.c2
-rw-r--r--gdb/spu-multiarch.c9
-rw-r--r--gdb/target-delegates.c20
-rw-r--r--gdb/target.c4
-rw-r--r--gdb/target.h10
33 files changed, 110 insertions, 106 deletions
diff --git a/gdb/aarch32-linux-nat.c b/gdb/aarch32-linux-nat.c
index b35ab4d..49c34a9 100644
--- a/gdb/aarch32-linux-nat.c
+++ b/gdb/aarch32-linux-nat.c
@@ -54,7 +54,7 @@ aarch32_gp_regcache_supply (reg_buffer *regcache, uint32_t *regs,
true if the 32-bit mode is in use, otherwise, it is false. */
void
-aarch32_gp_regcache_collect (const struct regcache *regcache, uint32_t *regs,
+aarch32_gp_regcache_collect (const struct reg_buffer *regcache, uint32_t *regs,
int arm_apcs_32)
{
int regno;
@@ -96,7 +96,7 @@ aarch32_vfp_regcache_supply (reg_buffer *regcache, gdb_byte *regs,
VFP_REGISTER_COUNT is the number VFP registers. */
void
-aarch32_vfp_regcache_collect (const struct regcache *regcache, gdb_byte *regs,
+aarch32_vfp_regcache_collect (const struct reg_buffer *regcache, gdb_byte *regs,
const int vfp_register_count)
{
int regno;
diff --git a/gdb/aarch32-linux-nat.h b/gdb/aarch32-linux-nat.h
index 9cdd432..c59d908 100644
--- a/gdb/aarch32-linux-nat.h
+++ b/gdb/aarch32-linux-nat.h
@@ -23,12 +23,12 @@
void aarch32_gp_regcache_supply (reg_buffer *regcache, uint32_t *regs,
int arm_apcs_32);
-void aarch32_gp_regcache_collect (const struct regcache *regcache,
+void aarch32_gp_regcache_collect (const reg_buffer *regcache,
uint32_t *regs, int arm_apcs_32);
void aarch32_vfp_regcache_supply (reg_buffer *regcache, gdb_byte *regs,
const int vfp_register_count);
-void aarch32_vfp_regcache_collect (const struct regcache *regcache,
+void aarch32_vfp_regcache_collect (const reg_buffer *regcache,
gdb_byte *regs,
const int vfp_register_count);
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 37420d3..73b1ec4 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -54,7 +54,7 @@ class aarch64_linux_nat_target final : public linux_nat_target
public:
/* Add our register access methods. */
void fetch_registers (ptid_t, reg_buffer *, int) override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
const struct target_desc *read_description () override;
@@ -235,7 +235,7 @@ fetch_gregs_from_thread (ptid_t ptid, reg_buffer *regcache)
values in the GDB's register array. */
static void
-store_gregs_to_thread (const struct regcache *regcache)
+store_gregs_to_thread (ptid_t ptid, const reg_buffer *regcache)
{
int ret, tid;
elf_gregset_t regs;
@@ -245,7 +245,7 @@ store_gregs_to_thread (const struct regcache *regcache)
/* Make sure REGS can hold all registers contents on both aarch64
and arm. */
gdb_static_assert (sizeof (regs) >= 18 * 4);
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = ptid.lwp ();
iovec.iov_base = &regs;
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
@@ -324,7 +324,7 @@ fetch_fpregs_from_thread (ptid_t ptid, reg_buffer *regcache)
values in the GDB's register array. */
static void
-store_fpregs_to_thread (const struct regcache *regcache)
+store_fpregs_to_thread (ptid_t ptid, const reg_buffer *regcache)
{
int ret, tid;
elf_fpregset_t regs;
@@ -334,7 +334,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
/* Make sure REGS can hold all VFP registers contents on both aarch64
and arm. */
gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = ptid.lwp ();
iovec.iov_base = &regs;
@@ -403,18 +403,18 @@ aarch64_linux_nat_target::fetch_registers (ptid_t ptid, reg_buffer *regcache,
/* Implement the "store_registers" target_ops method. */
void
-aarch64_linux_nat_target::store_registers (struct regcache *regcache,
+aarch64_linux_nat_target::store_registers (ptid_t ptid, reg_buffer *regcache,
int regno)
{
if (regno == -1)
{
- store_gregs_to_thread (regcache);
- store_fpregs_to_thread (regcache);
+ store_gregs_to_thread (ptid, regcache);
+ store_fpregs_to_thread (ptid, regcache);
}
else if (regno < AARCH64_V0_REGNUM)
- store_gregs_to_thread (regcache);
+ store_gregs_to_thread (ptid, regcache);
else
- store_fpregs_to_thread (regcache);
+ store_fpregs_to_thread (ptid, regcache);
}
/* Fill register REGNO (if it is a general-purpose register) in
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 32ce2cb..e57ae15 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -49,7 +49,7 @@ struct amd64_linux_nat_target final : public x86_linux_nat_target
{
/* Add our register access methods. */
void fetch_registers (ptid_t, reg_buffer *, int) override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
bool low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
override;
@@ -216,15 +216,11 @@ amd64_linux_nat_target::fetch_registers (ptid_t ptid, reg_buffer *regcache,
registers). */
void
-amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
+amd64_linux_nat_target::store_registers (ptid_t ptid,
+ reg_buffer *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
- int tid;
-
- /* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (regcache->ptid ());
- if (tid == 0)
- tid = ptid_get_pid (regcache->ptid ()); /* Not a threaded program. */
+ int tid = get_ptrace_pid (ptid);
if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
{
diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c
index f7795c9..eab16e9 100644
--- a/gdb/amd64-nat.c
+++ b/gdb/amd64-nat.c
@@ -123,7 +123,7 @@ amd64_supply_native_gregset (reg_buffer *regcache,
registers. */
void
-amd64_collect_native_gregset (const struct regcache *regcache,
+amd64_collect_native_gregset (const reg_buffer *regcache,
void *gregs, int regnum)
{
char *regs = (char *) gregs;
diff --git a/gdb/amd64-nat.h b/gdb/amd64-nat.h
index 7748239..9b7fc2d 100644
--- a/gdb/amd64-nat.h
+++ b/gdb/amd64-nat.h
@@ -46,7 +46,7 @@ extern void amd64_supply_native_gregset (reg_buffer *regcache,
GREGS. If REGNUM is -1, collect and store all appropriate
registers. */
-extern void amd64_collect_native_gregset (const struct regcache *regcache,
+extern void amd64_collect_native_gregset (const reg_buffer *regcache,
void *gregs, int regnum);
#endif /* amd64-nat.h */
diff --git a/gdb/amd64-obsd-tdep.c b/gdb/amd64-obsd-tdep.c
index 434b837..5fe1914 100644
--- a/gdb/amd64-obsd-tdep.c
+++ b/gdb/amd64-obsd-tdep.c
@@ -262,7 +262,7 @@ amd64obsd_supply_uthread (reg_buffer *regcache,
}
static void
-amd64obsd_collect_uthread (const struct regcache *regcache,
+amd64obsd_collect_uthread (const reg_buffer *regcache,
int regnum, CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 7ceadd8..4023514 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -3394,7 +3394,7 @@ amd64_supply_xsave (reg_buffer *regcache, int regnum,
bits in *FXSAVE. */
void
-amd64_collect_fxsave (const struct regcache *regcache, int regnum,
+amd64_collect_fxsave (const reg_buffer *regcache, int regnum,
void *fxsave)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -3415,7 +3415,7 @@ amd64_collect_fxsave (const struct regcache *regcache, int regnum,
/* Similar to amd64_collect_fxsave, but use XSAVE extended state. */
void
-amd64_collect_xsave (const struct regcache *regcache, int regnum,
+amd64_collect_xsave (const reg_buffer *regcache, int regnum,
void *xsave, int gcore)
{
struct gdbarch *gdbarch = regcache->arch ();
diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h
index 84a2977..37dd17c 100644
--- a/gdb/amd64-tdep.h
+++ b/gdb/amd64-tdep.h
@@ -125,10 +125,10 @@ extern void amd64_supply_xsave (reg_buffer *regcache, int regnum,
all registers. This function doesn't touch any of the reserved
bits in *FXSAVE. */
-extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
+extern void amd64_collect_fxsave (const reg_buffer *regcache, int regnum,
void *fxsave);
/* Similar to amd64_collect_fxsave, but use XSAVE extended state. */
-extern void amd64_collect_xsave (const struct regcache *regcache,
+extern void amd64_collect_xsave (const reg_buffer *regcache,
int regnum, void *xsave, int gcore);
/* Floating-point register set. */
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index e13dfc5..886bd83 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -52,7 +52,7 @@ struct bsd_uthread_target final : public target_ops
void mourn_inferior () override;
void fetch_registers (ptid_t, reg_buffer *, int) override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
void resume (ptid_t, int, enum gdb_signal) override;
@@ -80,7 +80,7 @@ struct bsd_uthread_ops
void (*supply_uthread)(reg_buffer *, int, CORE_ADDR);
/* Collect registers for an inactive thread from a register cache. */
- void (*collect_uthread)(const struct regcache *, int, CORE_ADDR);
+ void (*collect_uthread)(const reg_buffer *, int, CORE_ADDR);
};
static void *
@@ -111,8 +111,8 @@ bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch,
void
bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
- void (*collect_uthread) (const struct regcache *,
- int, CORE_ADDR))
+ void (*collect_uthread) (const reg_buffer *,
+ int, CORE_ADDR))
{
struct bsd_uthread_ops *ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
@@ -348,13 +348,13 @@ bsd_uthread_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regn
}
void
-bsd_uthread_target::store_registers (struct regcache *regcache, int regnum)
+bsd_uthread_target::store_registers (ptid_t ptid, reg_buffer *regcache,
+ int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
struct bsd_uthread_ops *uthread_ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
struct target_ops *beneath = find_target_beneath (this);
- ptid_t ptid = regcache->ptid ();
CORE_ADDR addr = ptid_get_tid (ptid);
CORE_ADDR active_addr;
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
@@ -374,7 +374,7 @@ bsd_uthread_target::store_registers (struct regcache *regcache, int regnum)
{
/* Updating the thread that is currently running; pass the
request to the layer beneath. */
- beneath->store_registers (regcache, regnum);
+ beneath->store_registers (ptid, regcache, regnum);
}
}
diff --git a/gdb/bsd-uthread.h b/gdb/bsd-uthread.h
index 1b63e3c..47e2614 100644
--- a/gdb/bsd-uthread.h
+++ b/gdb/bsd-uthread.h
@@ -32,7 +32,7 @@ extern void bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch,
architecture GDBARCH to SUPPLY_UTHREAD. */
extern void bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
- void (*collect_uthread) (const struct regcache *,
+ void (*collect_uthread) (const reg_buffer *,
int, CORE_ADDR));
#endif /* bsd-uthread.h */
diff --git a/gdb/i386-obsd-tdep.c b/gdb/i386-obsd-tdep.c
index 071846c..054b7d1 100644
--- a/gdb/i386-obsd-tdep.c
+++ b/gdb/i386-obsd-tdep.c
@@ -231,7 +231,7 @@ i386obsd_supply_uthread (reg_buffer *regcache,
}
static void
-i386obsd_collect_uthread (const struct regcache *regcache,
+i386obsd_collect_uthread (const reg_buffer *regcache,
int regnum, CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index aa82207..9abc538 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -666,7 +666,7 @@ i387_supply_fxsave (reg_buffer *regcache, int regnum, const void *fxsave)
bits in *FXSAVE. */
void
-i387_collect_fxsave (const struct regcache *regcache, int regnum, void *fxsave)
+i387_collect_fxsave (const reg_buffer *regcache, int regnum, void *fxsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
gdb_byte *regs = (gdb_byte *) fxsave;
@@ -1331,7 +1331,7 @@ i387_supply_xsave (reg_buffer *regcache, int regnum,
/* Similar to i387_collect_fxsave, but use XSAVE extended state. */
void
-i387_collect_xsave (const struct regcache *regcache, int regnum,
+i387_collect_xsave (const reg_buffer *regcache, int regnum,
void *xsave, int gcore)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -1493,7 +1493,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
byte_order, I387_FCTRL_INIT_VAL);
else
memset (FXSAVE_ADDR (tdep, regs, i), 0,
- regcache_register_size (regcache, i));
+ register_size (gdbarch, i));
}
}
}
@@ -1841,7 +1841,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
int regsize;
regcache->raw_collect (i, raw);
- regsize = regcache_register_size (regcache, i);
+ regsize = register_size (gdbarch, i);
p = FXSAVE_ADDR (tdep, regs, i);
if (memcmp (raw, p, regsize))
{
diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h
index d230c15..3bc2312 100644
--- a/gdb/i387-tdep.h
+++ b/gdb/i387-tdep.h
@@ -148,12 +148,12 @@ extern void i387_supply_xsave (reg_buffer *regcache, int regnum,
all registers. This function doesn't touch any of the reserved
bits in *FXSAVE. */
-extern void i387_collect_fxsave (const struct regcache *regcache, int regnum,
+extern void i387_collect_fxsave (const reg_buffer *regcache, int regnum,
void *fxsave);
/* Similar to i387_collect_fxsave, but use XSAVE extended state. */
-extern void i387_collect_xsave (const struct regcache *regcache,
+extern void i387_collect_xsave (const reg_buffer *regcache,
int regnum, void *xsave, int gcore);
/* Extract a bitset from XSAVE indicating which features are available in
diff --git a/gdb/inf-child.h b/gdb/inf-child.h
index 00f812c..f259085 100644
--- a/gdb/inf-child.h
+++ b/gdb/inf-child.h
@@ -39,7 +39,7 @@ public:
void disconnect (const char *, int) override;
void fetch_registers (ptid_t, reg_buffer *, int) override = 0;
- void store_registers (struct regcache *, int) override = 0;
+ void store_registers (ptid_t, reg_buffer *, int) override = 0;
void prepare_to_store (struct regcache *) override;
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index 06c927b..2f52cf2 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -152,7 +152,7 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
= get_thread_arch_regcache (ptid, target_gdbarch ());
supply_gregset (regcache, (const gdb_gregset_t *) gregset);
- target_store_registers (regcache, -1);
+ target_store_registers (ptid, regcache, -1);
return PS_OK;
}
@@ -185,7 +185,7 @@ ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
= get_thread_arch_regcache (ptid, target_gdbarch ());
supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
- target_store_registers (regcache, -1);
+ target_store_registers (ptid, regcache, -1);
return PS_OK;
}
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 31a975c..9358294 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -91,7 +91,7 @@ struct ravenscar_thread_target final : public target_ops
void resume (ptid_t, int, enum gdb_signal) override;
void fetch_registers (ptid_t, reg_buffer *, int) override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
void prepare_to_store (struct regcache *) override;
@@ -433,11 +433,11 @@ ravenscar_thread_target::fetch_registers (ptid_t ptid, reg_buffer *regcache,
}
void
-ravenscar_thread_target::store_registers (struct regcache *regcache,
+ravenscar_thread_target::store_registers (ptid_t ptid,
+ reg_buffer *regcache,
int regnum)
{
target_ops *beneath = find_target_beneath (this);
- ptid_t ptid = regcache->ptid ();
if (ravenscar_runtime_initialized ()
&& is_ravenscar_task (ptid)
@@ -447,10 +447,10 @@ ravenscar_thread_target::store_registers (struct regcache *regcache,
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
- beneath->store_registers (regcache, regnum);
+ beneath->store_registers (ptid, regcache, regnum);
}
else
- beneath->store_registers (regcache, regnum);
+ beneath->store_registers (ptid, regcache, regnum);
}
void
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 03fc253..3c75e91 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -106,7 +106,7 @@ public:
void fetch_registers (ptid_t, reg_buffer *, int) override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
void prepare_to_store (struct regcache *) override;
const struct frame_unwind *get_unwinder () override;
@@ -1567,17 +1567,18 @@ record_btrace_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int re
/* The store_registers method of target record-btrace. */
void
-record_btrace_target::store_registers (struct regcache *regcache, int regno)
+record_btrace_target::store_registers (ptid_t ptid, reg_buffer *regcache,
+ int regno)
{
struct target_ops *t;
if (!record_btrace_generating_corefile
- && record_is_replaying (regcache->ptid ()))
+ && record_is_replaying (ptid))
error (_("Cannot write registers while replaying."));
gdb_assert (may_write_registers != 0);
- this->beneath->store_registers (regcache, regno);
+ this->beneath->store_registers (ptid, regcache, regno);
}
/* The prepare_to_store method of target record-btrace. */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index d14e21d..35f5167 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -273,7 +273,7 @@ public:
void detach (inferior *, int) override;
void mourn_inferior () override;
void kill () override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
const char *annex,
gdb_byte *readbuf,
@@ -306,7 +306,7 @@ public:
void kill () override;
void fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) override;
void prepare_to_store (struct regcache *regcache) override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
const char *annex,
gdb_byte *readbuf,
@@ -384,7 +384,7 @@ static void record_full_goto_insn (struct record_full_entry *entry,
/* Alloc a record_full_reg record entry. */
static inline struct record_full_entry *
-record_full_reg_alloc (struct regcache *regcache, int regnum)
+record_full_reg_alloc (reg_buffer *regcache, int regnum)
{
struct record_full_entry *rec;
struct gdbarch *gdbarch = regcache->arch ();
@@ -608,7 +608,7 @@ record_full_get_loc (struct record_full_entry *rec)
/* Record the value of a register NUM to record_full_arch_list. */
int
-record_full_arch_list_add_reg (struct regcache *regcache, int regnum)
+record_full_arch_list_add_reg (reg_buffer *regcache, int regnum)
{
struct record_full_entry *rec;
@@ -620,7 +620,7 @@ record_full_arch_list_add_reg (struct regcache *regcache, int regnum)
rec = record_full_reg_alloc (regcache, regnum);
- regcache->raw_read (regnum, record_full_get_loc (rec));
+ regcache->raw_collect (regnum, record_full_get_loc (rec));
record_full_arch_list_add (rec);
@@ -1527,7 +1527,7 @@ record_full_base_target::supports_stopped_by_hw_breakpoint ()
/* Record registers change (by user or by GDB) to list as an instruction. */
static void
-record_full_registers_change (struct regcache *regcache, int regnum)
+record_full_registers_change (reg_buffer *regcache, int regnum)
{
/* Check record_full_insn_num. */
record_full_check_insn_num ();
@@ -1574,7 +1574,8 @@ record_full_registers_change (struct regcache *regcache, int regnum)
/* "store_registers" method for process record target. */
void
-record_full_target::store_registers (struct regcache *regcache, int regno)
+record_full_target::store_registers (ptid_t ptid, reg_buffer *regcache,
+ int regno)
{
if (!record_full_gdb_operation_disable)
{
@@ -1622,7 +1623,7 @@ record_full_target::store_registers (struct regcache *regcache, int regno)
record_full_registers_change (regcache, regno);
}
- this->beneath->store_registers (regcache, regno);
+ this->beneath->store_registers (ptid, regcache, regno);
}
/* "xfer_partial" method. Behavior is conditional on
@@ -2124,7 +2125,7 @@ record_full_core_target::prepare_to_store (struct regcache *regcache)
/* "store_registers" method for prec over corefile. */
void
-record_full_core_target::store_registers (struct regcache *regcache,
+record_full_core_target::store_registers (ptid_t ptid, reg_buffer *regcache,
int regno)
{
if (record_full_gdb_operation_disable)
diff --git a/gdb/record-full.h b/gdb/record-full.h
index 81acfea..139db81 100644
--- a/gdb/record-full.h
+++ b/gdb/record-full.h
@@ -22,7 +22,7 @@
extern int record_full_memory_query;
-extern int record_full_arch_list_add_reg (struct regcache *regcache, int num);
+extern int record_full_arch_list_add_reg (reg_buffer *regcache, int num);
extern int record_full_arch_list_add_mem (CORE_ADDR addr, int len);
extern int record_full_arch_list_add_end (void);
diff --git a/gdb/regcache.c b/gdb/regcache.c
index d75b305..71898cf 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -172,7 +172,7 @@ register_size (struct gdbarch *gdbarch, int regnum)
/* See common/common-regcache.h. */
int
-regcache_register_size (const struct regcache *regcache, int n)
+regcache_register_size (const regcache *regcache, int n)
{
return register_size (regcache->arch (), n);
}
@@ -759,7 +759,7 @@ regcache::raw_write (int regnum, const gdb_byte *buf)
failure. */
regcache_invalidator invalidator (this, regnum);
- target_store_registers (this, regnum);
+ target_store_registers (ptid (), this, regnum);
/* The target did not throw an error so we can discard invalidating
the register. */
@@ -1389,7 +1389,7 @@ public:
}
void fetch_registers (ptid_t ptid, reg_buffer *regs, int regno) override;
- void store_registers (regcache *regs, int regno) override;
+ void store_registers (ptid_t ptid, reg_buffer *regs, int regno) override;
enum target_xfer_status xfer_partial (enum target_object object,
const char *annex, gdb_byte *readbuf,
@@ -1412,7 +1412,8 @@ target_ops_no_register::fetch_registers (ptid_t ptid, reg_buffer *regs,
}
void
-target_ops_no_register::store_registers (regcache *regs, int regno)
+target_ops_no_register::store_registers (ptid_t ptid, reg_buffer *regs,
+ int regno)
{
this->store_registers_called++;
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 0f1fa1d..92aebc5 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -425,7 +425,7 @@ public:
ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
void fetch_registers (ptid_t, reg_buffer *, int) override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
void prepare_to_store (struct regcache *) override;
void files_info () override;
@@ -843,9 +843,9 @@ public: /* Remote specific methods. */
int send_g_packet ();
void process_g_packet (reg_buffer *regcache);
void fetch_registers_using_g (reg_buffer *regcache);
- int store_register_using_P (const struct regcache *regcache,
+ int store_register_using_P (const reg_buffer *regcache,
packet_reg *reg);
- void store_registers_using_G (const struct regcache *regcache);
+ void store_registers_using_G (const reg_buffer *regcache);
void set_remote_traceframe ();
@@ -8348,7 +8348,7 @@ remote_target::prepare_to_store (struct regcache *regcache)
packet was not recognized. */
int
-remote_target::store_register_using_P (const struct regcache *regcache,
+remote_target::store_register_using_P (const reg_buffer *regcache,
packet_reg *reg)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -8389,7 +8389,7 @@ remote_target::store_register_using_P (const struct regcache *regcache,
contents of the register cache buffer. FIXME: ignores errors. */
void
-remote_target::store_registers_using_G (const struct regcache *regcache)
+remote_target::store_registers_using_G (const reg_buffer *regcache)
{
struct remote_state *rs = get_remote_state ();
remote_arch_state *rsa = rs->get_remote_arch_state (regcache->arch ());
@@ -8428,7 +8428,7 @@ remote_target::store_registers_using_G (const struct regcache *regcache)
of the register cache buffer. FIXME: ignores errors. */
void
-remote_target::store_registers (struct regcache *regcache, int regnum)
+remote_target::store_registers (ptid_t ptid, reg_buffer *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
struct remote_state *rs = get_remote_state ();
@@ -8436,7 +8436,7 @@ remote_target::store_registers (struct regcache *regcache, int regnum)
int i;
set_remote_traceframe ();
- set_general_thread (regcache->ptid ());
+ set_general_thread (ptid);
if (regnum >= 0)
{
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 7b8d40f..7c6ee38 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -394,7 +394,7 @@ ran_out_of_registers_for_arguments:
regcache_raw_write_signed (regcache, tdep->ppc_toc_regnum,
solib_aix_get_toc_value (func_addr));
- target_store_registers (regcache, -1);
+ target_store_registers (regcache->ptid (), regcache, -1);
return sp;
}
diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c
index 13eed3a..c0869ef 100644
--- a/gdb/rs6000-lynx178-tdep.c
+++ b/gdb/rs6000-lynx178-tdep.c
@@ -253,7 +253,7 @@ ran_out_of_registers_for_arguments:
breakpoint. */
regcache_raw_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr);
- target_store_registers (regcache, -1);
+ target_store_registers (regcache->ptid (), regcache, -1);
return sp;
}
diff --git a/gdb/sparc-obsd-tdep.c b/gdb/sparc-obsd-tdep.c
index ac5a00c..84d58a8 100644
--- a/gdb/sparc-obsd-tdep.c
+++ b/gdb/sparc-obsd-tdep.c
@@ -194,8 +194,8 @@ sparc32obsd_supply_uthread (reg_buffer *regcache,
}
static void
-sparc32obsd_collect_uthread(const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+sparc32obsd_collect_uthread (const reg_buffer *regcache, int regnum,
+ CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 8a61ad9..af5c927 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -2013,7 +2013,7 @@ sparc_supply_rwindow (reg_buffer *regcache, CORE_ADDR sp, int regnum)
}
void
-sparc_collect_rwindow (const struct regcache *regcache,
+sparc_collect_rwindow (const reg_buffer *regcache,
CORE_ADDR sp, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -2201,7 +2201,7 @@ sparc32_collect_gregset (const struct sparc_gregmap *gregmap,
void
sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap,
- struct regcache *regcache,
+ reg_buffer *regcache,
int regnum, const void *fpregs)
{
const gdb_byte *regs = (const gdb_byte *) fpregs;
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 3f0d46e..6e1775d 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -216,7 +216,7 @@ extern int
extern void sparc_supply_rwindow (reg_buffer *regcache,
CORE_ADDR sp, int regnum);
-extern void sparc_collect_rwindow (const struct regcache *regcache,
+extern void sparc_collect_rwindow (const reg_buffer *regcache,
CORE_ADDR sp, int regnum);
/* Register offsets for SunOS 4. */
diff --git a/gdb/sparc64-obsd-tdep.c b/gdb/sparc64-obsd-tdep.c
index 7a1b4cc..9fd1b57 100644
--- a/gdb/sparc64-obsd-tdep.c
+++ b/gdb/sparc64-obsd-tdep.c
@@ -365,8 +365,8 @@ sparc64obsd_supply_uthread (reg_buffer *regcache,
}
static void
-sparc64obsd_collect_uthread(const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+sparc64obsd_collect_uthread (const reg_buffer *regcache,
+ int regnum, CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index c108ee8..8743916 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -2106,7 +2106,7 @@ sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
void
sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
- struct regcache *regcache,
+ reg_buffer *regcache,
int regnum, const void *fpregs)
{
int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c
index 3681b76..2c49254 100644
--- a/gdb/spu-multiarch.c
+++ b/gdb/spu-multiarch.c
@@ -53,7 +53,7 @@ struct spu_multiarch_target final : public target_ops
void mourn_inferior () override;
void fetch_registers (ptid_t, reg_buffer *, int) override;
- void store_registers (struct regcache *, int) override;
+ void store_registers (ptid_t, reg_buffer *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
const char *annex,
@@ -238,7 +238,8 @@ spu_multiarch_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int re
/* Override the to_store_registers routine. */
void
-spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
+spu_multiarch_target::store_registers (ptid_t ptid, reg_buffer *regcache,
+ int regno)
{
struct gdbarch *gdbarch = regcache->arch ();
struct target_ops *ops_beneath = find_target_beneath (this);
@@ -248,12 +249,12 @@ spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
/* Since we use functions that rely on inferior_ptid, we need to set and
restore it. */
scoped_restore save_ptid
- = make_scoped_restore (&inferior_ptid, regcache->ptid ());
+ = make_scoped_restore (&inferior_ptid, ptid);
/* This version applies only if we're currently in spu_run. */
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
{
- ops_beneath->store_registers (regcache, regno);
+ ops_beneath->store_registers (ptid, regcache, regno);
return;
}
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index f76edae..604bedf 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -17,7 +17,7 @@ struct dummy_target : public target_ops
void commit_resume () override;
ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2) override;
void fetch_registers (ptid_t arg0, reg_buffer *arg1, int arg2) override;
- void store_registers (struct regcache *arg0, int arg1) override;
+ void store_registers (ptid_t arg0, reg_buffer *arg1, int arg2) override;
void prepare_to_store (struct regcache *arg0) override;
void files_info () override;
int insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override;
@@ -185,7 +185,7 @@ struct debug_target : public target_ops
void commit_resume () override;
ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2) override;
void fetch_registers (ptid_t arg0, reg_buffer *arg1, int arg2) override;
- void store_registers (struct regcache *arg0, int arg1) override;
+ void store_registers (ptid_t arg0, reg_buffer *arg1, int arg2) override;
void prepare_to_store (struct regcache *arg0) override;
void files_info () override;
int insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override;
@@ -510,26 +510,28 @@ debug_target::fetch_registers (ptid_t arg0, reg_buffer *arg1, int arg2)
}
void
-target_ops::store_registers (struct regcache *arg0, int arg1)
+target_ops::store_registers (ptid_t arg0, reg_buffer *arg1, int arg2)
{
- this->beneath->store_registers (arg0, arg1);
+ this->beneath->store_registers (arg0, arg1, arg2);
}
void
-dummy_target::store_registers (struct regcache *arg0, int arg1)
+dummy_target::store_registers (ptid_t arg0, reg_buffer *arg1, int arg2)
{
noprocess ();
}
void
-debug_target::store_registers (struct regcache *arg0, int arg1)
+debug_target::store_registers (ptid_t arg0, reg_buffer *arg1, int arg2)
{
fprintf_unfiltered (gdb_stdlog, "-> %s->store_registers (...)\n", this->beneath->shortname ());
- this->beneath->store_registers (arg0, arg1);
+ this->beneath->store_registers (arg0, arg1, arg2);
fprintf_unfiltered (gdb_stdlog, "<- %s->store_registers (", this->beneath->shortname ());
- target_debug_print_struct_regcache_p (arg0);
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ target_debug_print_reg_buffer_p (arg1);
+ fputs_unfiltered (", ", gdb_stdlog);
+ target_debug_print_int (arg2);
fputs_unfiltered (")\n", gdb_stdlog);
}
diff --git a/gdb/target.c b/gdb/target.c
index 9dfb925..e701e6c 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3524,12 +3524,12 @@ target_fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno)
}
void
-target_store_registers (struct regcache *regcache, int regno)
+target_store_registers (ptid_t ptid, reg_buffer *regcache, int regno)
{
if (!may_write_registers)
error (_("Writing to registers is not allowed (regno %d)"), regno);
- target_stack->store_registers (regcache, regno);
+ target_stack->store_registers (ptid, regcache, regno);
if (targetdebug)
{
regcache->debug_print_register ("target_store_registers", regno);
diff --git a/gdb/target.h b/gdb/target.h
index d062113..9b179ac 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -475,7 +475,7 @@ struct target_ops
TARGET_DEFAULT_FUNC (default_target_wait);
virtual void fetch_registers (ptid_t, reg_buffer *, int)
TARGET_DEFAULT_IGNORE ();
- virtual void store_registers (struct regcache *, int)
+ virtual void store_registers (ptid_t, reg_buffer *, int)
TARGET_DEFAULT_NORETURN (noprocess ());
virtual void prepare_to_store (struct regcache *)
TARGET_DEFAULT_NORETURN (noprocess ());
@@ -1377,13 +1377,15 @@ extern ptid_t default_target_wait (struct target_ops *ops,
/* Fetch at least register REGNO, or all regs if regno == -1. No result. */
-extern void target_fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno);
+extern void target_fetch_registers (ptid_t ptid, reg_buffer *regcache,
+ int regno);
/* 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
must have been previously called. Calls error() if there are problems. */
-extern void target_store_registers (struct regcache *regcache, int regs);
+extern void target_store_registers (ptid_t ptid, reg_buffer *regcache,
+ int regs);
/* Get ready to modify the registers array. On machines which store
individual registers, this doesn't need to do anything. On machines
@@ -2537,7 +2539,7 @@ public:
{
}
- void store_registers (regcache *regs, int regno) override
+ void store_registers (ptid_t ptid, reg_buffer *regs, int regno) override
{
}
};