From: Simon Marchi Date: Thu, 31 May 2018 00:56:30 +0000 (-0400) Subject: Use reg_buffer in target_fetch_registers interface X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79f5641f99ea86b6f903a845aeb7caef3bd1932c;p=thirdparty%2Fbinutils-gdb.git Use reg_buffer in target_fetch_registers interface --- diff --git a/gdb/aarch32-linux-nat.c b/gdb/aarch32-linux-nat.c index e390361c790..b35ab4db486 100644 --- a/gdb/aarch32-linux-nat.c +++ b/gdb/aarch32-linux-nat.c @@ -28,7 +28,7 @@ is true if the 32-bit mode is in use, otherwise, it is false. */ void -aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs, +aarch32_gp_regcache_supply (reg_buffer *regcache, uint32_t *regs, int arm_apcs_32) { int regno; @@ -81,7 +81,7 @@ aarch32_gp_regcache_collect (const struct regcache *regcache, uint32_t *regs, VFP_REGISTER_COUNT is the number of VFP registers. */ void -aarch32_vfp_regcache_supply (struct regcache *regcache, gdb_byte *regs, +aarch32_vfp_regcache_supply (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 ac2de376aeb..9cdd432bfc9 100644 --- a/gdb/aarch32-linux-nat.h +++ b/gdb/aarch32-linux-nat.h @@ -20,13 +20,13 @@ VFPv3D16 target. */ #define VFP_REGS_SIZE (32 * 8 + 4) -void aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs, +void aarch32_gp_regcache_supply (reg_buffer *regcache, uint32_t *regs, int arm_apcs_32); void aarch32_gp_regcache_collect (const struct regcache *regcache, uint32_t *regs, int arm_apcs_32); -void aarch32_vfp_regcache_supply (struct regcache *regcache, gdb_byte *regs, +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, diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 94d18c315a1..37420d36dc0 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -53,7 +53,7 @@ class aarch64_linux_nat_target final : public linux_nat_target { public: /* Add our register access methods. */ - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; void store_registers (struct regcache *, int) override; const struct target_desc *read_description () override; @@ -197,7 +197,7 @@ aarch64_get_debug_reg_state (pid_t pid) from the current thread. */ static void -fetch_gregs_from_thread (struct regcache *regcache) +fetch_gregs_from_thread (ptid_t ptid, reg_buffer *regcache) { int ret, tid; struct gdbarch *gdbarch = regcache->arch (); @@ -208,7 +208,7 @@ fetch_gregs_from_thread (struct regcache *regcache) and arm. */ gdb_static_assert (sizeof (regs) >= 18 * 4); - tid = ptid_get_lwp (regcache->ptid ()); + tid = ptid.lwp (); iovec.iov_base = ®s; if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) @@ -277,7 +277,7 @@ store_gregs_to_thread (const struct regcache *regcache) from the current thread. */ static void -fetch_fpregs_from_thread (struct regcache *regcache) +fetch_fpregs_from_thread (ptid_t ptid, reg_buffer *regcache) { int ret, tid; elf_fpregset_t regs; @@ -288,7 +288,7 @@ fetch_fpregs_from_thread (struct regcache *regcache) and arm. */ gdb_static_assert (sizeof regs >= VFP_REGS_SIZE); - tid = ptid_get_lwp (regcache->ptid ()); + tid = ptid.lwp (); iovec.iov_base = ®s; @@ -386,18 +386,18 @@ store_fpregs_to_thread (const struct regcache *regcache) /* Implement the "fetch_registers" target_ops method. */ void -aarch64_linux_nat_target::fetch_registers (struct regcache *regcache, +aarch64_linux_nat_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) { if (regno == -1) { - fetch_gregs_from_thread (regcache); - fetch_fpregs_from_thread (regcache); + fetch_gregs_from_thread (ptid, regcache); + fetch_fpregs_from_thread (ptid, regcache); } else if (regno < AARCH64_V0_REGNUM) - fetch_gregs_from_thread (regcache); + fetch_gregs_from_thread (ptid, regcache); else - fetch_fpregs_from_thread (regcache); + fetch_fpregs_from_thread (ptid, regcache); } /* Implement the "store_registers" target_ops method. */ diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c index 8bacb10aa11..c5ee53721c5 100644 --- a/gdb/alpha-linux-tdep.c +++ b/gdb/alpha-linux-tdep.c @@ -160,7 +160,7 @@ alpha_linux_sigcontext_addr (struct frame_info *this_frame) static void alpha_linux_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) gregs; @@ -193,7 +193,7 @@ alpha_linux_collect_gregset (const struct regset *regset, static void alpha_linux_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) fpregs; diff --git a/gdb/alpha-nbsd-tdep.c b/gdb/alpha-nbsd-tdep.c index dffab3fb37f..94119f48ea9 100644 --- a/gdb/alpha-nbsd-tdep.c +++ b/gdb/alpha-nbsd-tdep.c @@ -47,7 +47,7 @@ static void alphanbsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) fpregs; @@ -71,7 +71,7 @@ alphanbsd_supply_fpregset (const struct regset *regset, static void alphanbsd_aout_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) gregs; @@ -115,7 +115,7 @@ alphanbsd_aout_supply_gregset (const struct regset *regset, static void alphanbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) gregs; diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 53943e1d77a..3ce006e2ad8 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1491,7 +1491,7 @@ alpha_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) targets don't supply this value in their core files. */ void -alpha_supply_int_regs (struct regcache *regcache, int regno, +alpha_supply_int_regs (reg_buffer *regcache, int regno, const void *r0_r30, const void *pc, const void *unique) { const gdb_byte *regs = (const gdb_byte *) r0_r30; @@ -1534,7 +1534,7 @@ alpha_fill_int_regs (const struct regcache *regcache, } void -alpha_supply_fp_regs (struct regcache *regcache, int regno, +alpha_supply_fp_regs (reg_buffer *regcache, int regno, const void *f0_f30, const void *fpcr) { const gdb_byte *regs = (const gdb_byte *) f0_f30; diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h index 104410ad726..b48358e92cd 100644 --- a/gdb/alpha-tdep.h +++ b/gdb/alpha-tdep.h @@ -110,11 +110,11 @@ extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc); extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *); extern void alpha_dwarf2_init_abi (struct gdbarch_info, struct gdbarch *); -extern void alpha_supply_int_regs (struct regcache *, int, const void *, +extern void alpha_supply_int_regs (reg_buffer *, int, const void *, const void *, const void *); extern void alpha_fill_int_regs (const struct regcache *, int, void *, void *, void *); -extern void alpha_supply_fp_regs (struct regcache *, int, +extern void alpha_supply_fp_regs (reg_buffer *, int, const void *, const void *); extern void alpha_fill_fp_regs (const struct regcache *, int, void *, void *); diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c index 9b2ee136530..6b9ed6466ac 100644 --- a/gdb/amd64-fbsd-tdep.c +++ b/gdb/amd64-fbsd-tdep.c @@ -163,7 +163,7 @@ amd64fbsd_core_read_description (struct gdbarch *gdbarch, static void amd64fbsd_supply_xstateregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *xstateregs, size_t len) { amd64_supply_xsave (regcache, regnum, xstateregs); diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 5a39fa87741..32ce2cb9cc0 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -48,7 +48,7 @@ struct amd64_linux_nat_target final : public x86_linux_nat_target { /* Add our register access methods. */ - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; void store_registers (struct regcache *, int) override; bool low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction) @@ -142,15 +142,11 @@ fill_fpregset (const struct regcache *regcache, registers). */ void -amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) +amd64_linux_nat_target::fetch_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-linux-tdep.c b/gdb/amd64-linux-tdep.c index 521e32a9c24..78fdd880881 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -1617,7 +1617,7 @@ amd64_linux_core_read_description (struct gdbarch *gdbarch, static void amd64_linux_supply_xstateregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *xstateregs, size_t len) { amd64_supply_xsave (regcache, regnum, xstateregs); diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c index 155683c29a3..f7795c99bfe 100644 --- a/gdb/amd64-nat.c +++ b/gdb/amd64-nat.c @@ -92,7 +92,7 @@ amd64_native_gregset_supplies_p (struct gdbarch *gdbarch, int regnum) REGCACHE. If REGNUM is -1, supply all appropriate registers. */ void -amd64_supply_native_gregset (struct regcache *regcache, +amd64_supply_native_gregset (reg_buffer *regcache, const void *gregs, int regnum) { const char *regs = (const char *) gregs; diff --git a/gdb/amd64-nat.h b/gdb/amd64-nat.h index 11bddf5c9e4..7748239baa2 100644 --- a/gdb/amd64-nat.h +++ b/gdb/amd64-nat.h @@ -39,7 +39,7 @@ extern int amd64_native_gregset_supplies_p (struct gdbarch *gdbarch, /* Supply register REGNUM, whose contents are store in BUF, to REGCACHE. If REGNUM is -1, supply all appropriate registers. */ -extern void amd64_supply_native_gregset (struct regcache *regcache, +extern void amd64_supply_native_gregset (reg_buffer *regcache, const void *gregs, int regnum); /* Collect register REGNUM from REGCACHE and store its contents in diff --git a/gdb/amd64-obsd-tdep.c b/gdb/amd64-obsd-tdep.c index 1e078b14f8b..434b8374208 100644 --- a/gdb/amd64-obsd-tdep.c +++ b/gdb/amd64-obsd-tdep.c @@ -218,7 +218,7 @@ static int amd64obsd_uthread_reg_offset[] = #define AMD64OBSD_UTHREAD_RSP_OFFSET 400 static void -amd64obsd_supply_uthread (struct regcache *regcache, +amd64obsd_supply_uthread (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 9f8f018dd15..7ceadd83715 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -2959,7 +2959,7 @@ amd64_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ static void -amd64_supply_fpregset (const struct regset *regset, struct regcache *regcache, +amd64_supply_fpregset (const struct regset *regset, reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); @@ -3335,7 +3335,7 @@ _initialize_amd64_tdep (void) reserved bits in *FXSAVE. */ void -amd64_supply_fxsave (struct regcache *regcache, int regnum, +amd64_supply_fxsave (reg_buffer *regcache, int regnum, const void *fxsave) { struct gdbarch *gdbarch = regcache->arch (); @@ -3358,7 +3358,7 @@ amd64_supply_fxsave (struct regcache *regcache, int regnum, /* Similar to amd64_supply_fxsave, but use XSAVE extended state. */ void -amd64_supply_xsave (struct regcache *regcache, int regnum, +amd64_supply_xsave (reg_buffer *regcache, int regnum, const void *xsave) { struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h index 7d3791ad936..84a2977d77f 100644 --- a/gdb/amd64-tdep.h +++ b/gdb/amd64-tdep.h @@ -113,11 +113,11 @@ extern const struct target_desc *amd64_target_description (uint64_t xcr0); -1, do this for all registers. This function masks off any of the reserved bits in *FXSAVE. */ -extern void amd64_supply_fxsave (struct regcache *regcache, int regnum, +extern void amd64_supply_fxsave (reg_buffer *regcache, int regnum, const void *fxsave); /* Similar to amd64_supply_fxsave, but use XSAVE extended state. */ -extern void amd64_supply_xsave (struct regcache *regcache, int regnum, +extern void amd64_supply_xsave (reg_buffer *regcache, int regnum, const void *xsave); /* Fill register REGNUM (if it is a floating-point or SSE register) in diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 76bc16f3750..c32d43b2616 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -930,7 +930,7 @@ default_addressable_memory_unit_size (struct gdbarch *gdbarch) void default_guess_tracepoint_registers (struct gdbarch *gdbarch, - struct regcache *regcache, + reg_buffer *regcache, CORE_ADDR addr) { int pc_regno = gdbarch_pc_regnum (gdbarch); diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 77ee9af2bfc..aed7c729726 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -251,7 +251,7 @@ extern const char *default_gnu_triplet_regexp (struct gdbarch *gdbarch); extern int default_addressable_memory_unit_size (struct gdbarch *gdbarch); extern void default_guess_tracepoint_registers (struct gdbarch *gdbarch, - struct regcache *regcache, + reg_buffer *regcache, CORE_ADDR addr); extern int default_print_insn (bfd_vma memaddr, disassemble_info *info); diff --git a/gdb/arm-bsd-tdep.c b/gdb/arm-bsd-tdep.c index a2719caa4c5..cf463a570aa 100644 --- a/gdb/arm-bsd-tdep.c +++ b/gdb/arm-bsd-tdep.c @@ -47,7 +47,7 @@ armbsd_fpreg_offset (int regnum) static void armbsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) fpregs; @@ -68,7 +68,7 @@ armbsd_supply_fpregset (const struct regset *regset, static void armbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) gregs; diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index eb4e2065964..e6259d240b7 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -475,7 +475,7 @@ static struct tramp_frame arm_kernel_linux_restart_syscall_tramp_frame = { void arm_linux_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs_buf, size_t len) { struct gdbarch *gdbarch = regcache->arch (); @@ -546,7 +546,7 @@ arm_linux_collect_gregset (const struct regset *regset, #define typeExtended 0x03 void -supply_nwfpe_register (struct regcache *regcache, int regno, +supply_nwfpe_register (reg_buffer *regcache, int regno, const gdb_byte *regs) { const gdb_byte *reg_data; @@ -619,7 +619,7 @@ collect_nwfpe_register (const struct regcache *regcache, int regno, void arm_linux_supply_nwfpe (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *regs_buf, size_t len) { const gdb_byte *regs = (const gdb_byte *) regs_buf; @@ -657,7 +657,7 @@ arm_linux_collect_nwfpe (const struct regset *regset, static void arm_linux_supply_vfp (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *regs_buf, size_t len) { const gdb_byte *regs = (const gdb_byte *) regs_buf; diff --git a/gdb/arm-linux-tdep.h b/gdb/arm-linux-tdep.h index 1889c43dcbe..b9624d56611 100644 --- a/gdb/arm-linux-tdep.h +++ b/gdb/arm-linux-tdep.h @@ -44,7 +44,7 @@ void arm_linux_collect_gregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs_buf, size_t len); -void supply_nwfpe_register (struct regcache *regcache, int regno, +void supply_nwfpe_register (reg_buffer *regcache, int regno, const gdb_byte *regs); void collect_nwfpe_register (const struct regcache *regcache, int regno, gdb_byte *regs); diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 9ead7c2b3de..e13dfc5ca36 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -51,7 +51,7 @@ struct bsd_uthread_target final : public target_ops void mourn_inferior () override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; void store_registers (struct regcache *, int) override; ptid_t wait (ptid_t, struct target_waitstatus *, int) override; @@ -77,7 +77,7 @@ static struct gdbarch_data *bsd_uthread_data; struct bsd_uthread_ops { /* Supply registers for an inactive thread to a register cache. */ - void (*supply_uthread)(struct regcache *, int, CORE_ADDR); + 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); @@ -97,8 +97,8 @@ bsd_uthread_init (struct obstack *obstack) void bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch, - void (*supply_uthread) (struct regcache *, - int, CORE_ADDR)) + void (*supply_uthread) (reg_buffer *, int, + CORE_ADDR)) { struct bsd_uthread_ops *ops = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data); @@ -316,12 +316,11 @@ bsd_uthread_target::mourn_inferior () } void -bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum) +bsd_uthread_target::fetch_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); - ptid_t ptid = regcache->ptid (); CORE_ADDR addr = ptid_get_tid (ptid); struct target_ops *beneath = find_target_beneath (this); CORE_ADDR active_addr; @@ -332,7 +331,7 @@ bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum) inferior_ptid = ptid; /* Always fetch the appropriate registers from the layer beneath. */ - beneath->fetch_registers (regcache, regnum); + beneath->fetch_registers (ptid, regcache, regnum); /* FIXME: That might have gotten us more than we asked for. Make sure we overwrite all relevant registers with values from the diff --git a/gdb/bsd-uthread.h b/gdb/bsd-uthread.h index 06eb2c0bb3c..1b63e3c6f23 100644 --- a/gdb/bsd-uthread.h +++ b/gdb/bsd-uthread.h @@ -24,7 +24,7 @@ architecture GDBARCH to SUPPLY_UTHREAD. */ extern void bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch, - void (*supply_uthread) (struct regcache *, + void (*supply_uthread) (reg_buffer *, int, CORE_ADDR)); diff --git a/gdb/corelow.c b/gdb/corelow.c index a81639542b9..41fc7f2ca9e 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -72,7 +72,7 @@ public: void close () override; void detach (inferior *, int) override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; enum target_xfer_status xfer_partial (enum target_object object, const char *annex, @@ -103,7 +103,8 @@ public: } /* See definition. */ - void get_core_register_section (struct regcache *regcache, + void get_core_register_section (ptid_t ptid, + struct reg_buffer *regcache, const struct regset *regset, const char *name, int min_size, @@ -517,7 +518,7 @@ core_target_open (const char *arg, int from_tty) } /* Fetch all registers from core file. */ - target_fetch_registers (get_current_regcache (), -1); + target_fetch_registers (inferior_ptid, get_current_regcache (), -1); /* Now, set up the frame cache, and print the top of stack. */ reinit_frame_cache (); @@ -569,7 +570,8 @@ core_target::detach (inferior *inf, int from_tty) section by the appropriate name. Otherwise, just do nothing. */ void -core_target::get_core_register_section (struct regcache *regcache, +core_target::get_core_register_section (ptid_t ptid, + struct reg_buffer *regcache, const struct regset *regset, const char *name, int min_size, @@ -583,7 +585,7 @@ core_target::get_core_register_section (struct regcache *regcache, bool variable_size_section = (regset != NULL && regset->flags & REGSET_VARIABLE_SIZE); - thread_section_name section_name (name, regcache->ptid ()); + thread_section_name section_name (name, ptid); section = bfd_get_section_by_name (core_bfd, section_name.c_str ()); if (! section) @@ -632,7 +634,8 @@ core_target::get_core_register_section (struct regcache *regcache, struct get_core_registers_cb_data { core_target *target; - struct regcache *regcache; + ptid_t ptid; + reg_buffer *regcache; }; /* Callback for get_core_registers that handles a single core file @@ -660,8 +663,9 @@ get_core_registers_cb (const char *sect_name, int size, /* The 'which' parameter is only used when no regset is provided. Thus we just set it to -1. */ - data->target->get_core_register_section (data->regcache, regset, sect_name, - size, -1, human_name, required); + data->target->get_core_register_section (data->ptid, data->regcache, regset, + sect_name, size, -1, human_name, + required); } /* Get the registers out of a core file. This is the machine- @@ -672,7 +676,7 @@ get_core_registers_cb (const char *sect_name, int size, /* We just get all the registers, so we don't use regno. */ void -core_target::fetch_registers (struct regcache *regcache, int regno) +core_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) { int i; struct gdbarch *gdbarch; @@ -689,16 +693,16 @@ core_target::fetch_registers (struct regcache *regcache, int regno) gdbarch = regcache->arch (); if (gdbarch_iterate_over_regset_sections_p (gdbarch)) { - get_core_registers_cb_data data = { this, regcache }; + get_core_registers_cb_data data = { this, ptid, regcache }; gdbarch_iterate_over_regset_sections (gdbarch, get_core_registers_cb, (void *) &data, NULL); } else { - get_core_register_section (regcache, NULL, + get_core_register_section (ptid, regcache, NULL, ".reg", 0, 0, "general-purpose", 1); - get_core_register_section (regcache, NULL, + get_core_register_section (ptid, regcache, NULL, ".reg2", 0, 2, "floating-point", 0); } diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index e0371a2a282..6dcbe433882 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -3798,7 +3798,7 @@ typedef cris_elf_greg_t crisv32_elf_gregset_t[CRISV32_ELF_NGREG]; /* Unpack a cris_elf_gregset_t into GDB's register cache. */ static void -cris_supply_gregset (struct regcache *regcache, cris_elf_gregset_t *gregsetp) +cris_supply_gregset (reg_buffer *regcache, cris_elf_gregset_t *gregsetp) { struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -3829,7 +3829,7 @@ cris_supply_gregset (struct regcache *regcache, cris_elf_gregset_t *gregsetp) regsets, until multi-arch core support is ready. */ static void -fetch_core_registers (struct regcache *regcache, +fetch_core_registers (reg_buffer *regcache, char *core_reg_sect, unsigned core_reg_size, int which, CORE_ADDR reg_addr) { diff --git a/gdb/ctf.c b/gdb/ctf.c index 7e2207484c4..51446677240 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -48,7 +48,7 @@ public: { return ctf_target_info; } void close () override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; enum target_xfer_status xfer_partial (enum target_object object, const char *annex, gdb_byte *readbuf, @@ -1203,7 +1203,7 @@ ctf_target::files_info () If no matched events are found, mark registers unavailable. */ void -ctf_target::fetch_registers (struct regcache *regcache, int regno) +ctf_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); struct bt_ctf_event *event = NULL; diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index e49a9aff098..272d73b8495 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -505,7 +505,7 @@ fbsd_corefile_thread (struct thread_info *info, regcache = get_thread_arch_regcache (info->ptid, args->gdbarch); - target_fetch_registers (regcache, -1); + target_fetch_registers (info->ptid, regcache, -1); args->note_data = fbsd_collect_thread_registers (regcache, info->ptid, args->obfd, args->note_data, diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c index c47f1f24f0b..c9522a4c532 100644 --- a/gdb/frv-linux-tdep.c +++ b/gdb/frv-linux-tdep.c @@ -409,7 +409,7 @@ static const struct regcache_map_entry frv_linux_fpregmap[] = static void frv_linux_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { int regi; diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 558cc555b4b..596d9a4ad93 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -4668,7 +4668,7 @@ set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, } void -gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr) +gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, reg_buffer *regcache, CORE_ADDR addr) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->guess_tracepoint_registers != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 09edcd5eb28..35ec19bf6f7 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1376,8 +1376,8 @@ extern void set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, gdbar allowing us to guess the PC value, and perhaps some other registers. On entry, regcache has all registers marked as unavailable. */ -typedef void (gdbarch_guess_tracepoint_registers_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr); -extern void gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr); +typedef void (gdbarch_guess_tracepoint_registers_ftype) (struct gdbarch *gdbarch, reg_buffer *regcache, CORE_ADDR addr); +extern void gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, reg_buffer *regcache, CORE_ADDR addr); extern void set_gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers); /* Return the "auto" target charset. */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 0a23b1ee0e7..aa687aea718 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -1051,7 +1051,7 @@ m;int;fast_tracepoint_valid_at;CORE_ADDR addr, std::string *msg;addr, msg;;defau # where no registers have been collected, but there's only one location, # allowing us to guess the PC value, and perhaps some other registers. # On entry, regcache has all registers marked as unavailable. -m;void;guess_tracepoint_registers;struct regcache *regcache, CORE_ADDR addr;regcache, addr;;default_guess_tracepoint_registers;;0 +m;void;guess_tracepoint_registers;reg_buffer *regcache, CORE_ADDR addr;regcache, addr;;default_guess_tracepoint_registers;;0 # Return the "auto" target charset. f;const char *;auto_charset;void;;default_auto_charset;default_auto_charset;;0 diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index 18ba0d72267..8fe20048977 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -212,7 +212,7 @@ struct core_fns registers in a large upage-plus-stack ".reg" section. Original upage address X is at location core_reg_sect+x+reg_addr. */ - void (*core_read_registers) (struct regcache *regcache, + void (*core_read_registers) (reg_buffer *regcache, char *core_reg_sect, unsigned core_reg_size, int which, CORE_ADDR reg_addr); diff --git a/gdb/hppa-nbsd-tdep.c b/gdb/hppa-nbsd-tdep.c index f9932b5b805..cd2c8656d2b 100644 --- a/gdb/hppa-nbsd-tdep.c +++ b/gdb/hppa-nbsd-tdep.c @@ -160,7 +160,7 @@ static int hppanbsd_reg_offset[] = static void hppanbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) gregs; diff --git a/gdb/hppa-obsd-tdep.c b/gdb/hppa-obsd-tdep.c index 403e9ddc827..e0e47bf0e8b 100644 --- a/gdb/hppa-obsd-tdep.c +++ b/gdb/hppa-obsd-tdep.c @@ -40,7 +40,7 @@ static void hppaobsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { gdb_byte zero[4] = { 0 }; @@ -110,7 +110,7 @@ hppaobsd_supply_gregset (const struct regset *regset, static void hppaobsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) fpregs; diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c index ebc75a8d585..1571147952a 100644 --- a/gdb/i386-fbsd-tdep.c +++ b/gdb/i386-fbsd-tdep.c @@ -274,7 +274,7 @@ i386fbsd_core_read_description (struct gdbarch *gdbarch, static void i386fbsd_supply_xstateregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *xstateregs, size_t len) { i387_supply_xsave (regcache, regnum, xstateregs); diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 1919c8b8cf8..3b32ce139dc 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -723,7 +723,7 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, static void i386_linux_supply_xstateregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *xstateregs, size_t len) { i387_supply_xsave (regcache, regnum, xstateregs); diff --git a/gdb/i386-obsd-tdep.c b/gdb/i386-obsd-tdep.c index 851fec60249..071846cc490 100644 --- a/gdb/i386-obsd-tdep.c +++ b/gdb/i386-obsd-tdep.c @@ -187,7 +187,7 @@ static int i386obsd_uthread_reg_offset[] = #define I386OBSD_UTHREAD_ESP_OFFSET 176 static void -i386obsd_supply_uthread (struct regcache *regcache, +i386obsd_supply_uthread (reg_buffer *regcache, int regnum, CORE_ADDR addr) { struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index b1d502f4827..cad9b01a6e1 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -3801,7 +3801,7 @@ i386_value_to_register (struct frame_info *frame, int regnum, REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ void -i386_supply_gregset (const struct regset *regset, struct regcache *regcache, +i386_supply_gregset (const struct regset *regset, reg_buffer *regcache, int regnum, const void *gregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); @@ -3849,7 +3849,7 @@ i386_collect_gregset (const struct regset *regset, REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ static void -i386_supply_fpregset (const struct regset *regset, struct regcache *regcache, +i386_supply_fpregset (const struct regset *regset, reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index d0f64adcbb0..aa8220760fc 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -435,7 +435,7 @@ static int fsave_offset[] = *FSAVE. */ void -i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave) +i387_supply_fsave (reg_buffer *regcache, int regnum, const void *fsave) { struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -583,7 +583,7 @@ static int i387_tag (const gdb_byte *raw); masks off any of the reserved bits in *FXSAVE. */ void -i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave) +i387_supply_fxsave (reg_buffer *regcache, int regnum, const void *fxsave) { struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); const gdb_byte *regs = (const gdb_byte *) fxsave; @@ -916,7 +916,7 @@ i387_xsave_get_clear_bv (struct gdbarch *gdbarch, const void *xsave) /* Similar to i387_supply_fxsave, but use XSAVE extended state. */ void -i387_supply_xsave (struct regcache *regcache, int regnum, +i387_supply_xsave (reg_buffer *regcache, int regnum, const void *xsave) { struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h index b2fa75aa122..d230c151231 100644 --- a/gdb/i387-tdep.h +++ b/gdb/i387-tdep.h @@ -120,7 +120,7 @@ extern void i387_value_to_register (struct frame_info *frame, int regnum, *FSAVE. This function masks off any of the reserved bits in *FSAVE. */ -extern void i387_supply_fsave (struct regcache *regcache, int regnum, +extern void i387_supply_fsave (reg_buffer *regcache, int regnum, const void *fsave); /* Fill register REGNUM (if it is a floating-point register) in *FSAVE @@ -135,12 +135,12 @@ extern void i387_collect_fsave (const struct regcache *regcache, int regnum, floating-point or SSE register value from *FXSAVE. This function masks off any of the reserved bits in *FXSAVE. */ -extern void i387_supply_fxsave (struct regcache *regcache, int regnum, +extern void i387_supply_fxsave (reg_buffer *regcache, int regnum, const void *fxsave); /* Similar to i387_supply_fxsave, but use XSAVE extended state. */ -extern void i387_supply_xsave (struct regcache *regcache, int regnum, +extern void i387_supply_xsave (reg_buffer *regcache, int regnum, const void *xsave); /* Fill register REGNUM (if it is a floating-point or SSE register) in diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c index 19d0cf2debf..37c8f09baaf 100644 --- a/gdb/ia64-linux-tdep.c +++ b/gdb/ia64-linux-tdep.c @@ -171,7 +171,7 @@ static const struct regcache_map_entry ia64_linux_fpregmap[] = static void ia64_linux_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *regs, size_t len) { const gdb_byte f_zero[16] = { 0 }; diff --git a/gdb/inf-child.h b/gdb/inf-child.h index 6316f3062da..00f812c5089 100644 --- a/gdb/inf-child.h +++ b/gdb/inf-child.h @@ -38,7 +38,7 @@ public: void disconnect (const char *, int) override; - void fetch_registers (struct regcache *, int) override = 0; + void fetch_registers (ptid_t, reg_buffer *, int) override = 0; void store_registers (struct regcache *, int) override = 0; void prepare_to_store (struct regcache *) override; diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 4d3919df318..68dcaae88a8 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -1689,7 +1689,7 @@ linux_corefile_thread (struct thread_info *info, regcache = get_thread_arch_regcache (info->ptid, args->gdbarch); - target_fetch_registers (regcache, -1); + target_fetch_registers (info->ptid, regcache, -1); gdb::byte_vector siginfo_data = linux_get_siginfo_data (info, args->gdbarch); args->note_data = linux_collect_thread_registers diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c index be35b699c21..c5d6802b313 100644 --- a/gdb/m32r-linux-tdep.c +++ b/gdb/m32r-linux-tdep.c @@ -348,7 +348,7 @@ static int m32r_pt_regs_offset[] = { static void m32r_linux_supply_gregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *gregs, size_t size) { const gdb_byte *regs = (const gdb_byte *) gregs; diff --git a/gdb/m68k-bsd-tdep.c b/gdb/m68k-bsd-tdep.c index 2f53870b98d..893f75c682e 100644 --- a/gdb/m68k-bsd-tdep.c +++ b/gdb/m68k-bsd-tdep.c @@ -55,7 +55,7 @@ m68kbsd_fpreg_offset (struct gdbarch *gdbarch, int regnum) static void m68kbsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); @@ -77,7 +77,7 @@ m68kbsd_supply_fpregset (const struct regset *regset, static void m68kbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) gregs; diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c index c3075b23fc1..cb36b13e5e8 100644 --- a/gdb/mips-fbsd-tdep.c +++ b/gdb/mips-fbsd-tdep.c @@ -47,7 +47,7 @@ regcache->raw_supply_integer (). */ static void -mips_fbsd_supply_reg (struct regcache *regcache, int regnum, const void *addr, +mips_fbsd_supply_reg (reg_buffer *regcache, int regnum, const void *addr, size_t len) { regcache->raw_supply_integer (regnum, (const gdb_byte *) addr, len, true); @@ -68,7 +68,7 @@ mips_fbsd_collect_reg (const struct regcache *regcache, int regnum, void *addr, length. */ void -mips_fbsd_supply_fpregs (struct regcache *regcache, int regnum, +mips_fbsd_supply_fpregs (reg_buffer *regcache, int regnum, const void *fpregs, size_t regsize) { struct gdbarch *gdbarch = regcache->arch (); @@ -97,7 +97,7 @@ mips_fbsd_supply_fpregs (struct regcache *regcache, int regnum, length. */ void -mips_fbsd_supply_gregs (struct regcache *regcache, int regnum, +mips_fbsd_supply_gregs (reg_buffer *regcache, int regnum, const void *gregs, size_t regsize) { struct gdbarch *gdbarch = regcache->arch (); @@ -159,7 +159,7 @@ mips_fbsd_collect_gregs (const struct regcache *regcache, int regnum, static void mips_fbsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { size_t regsize = mips_abi_regsize (regcache->arch ()); @@ -192,7 +192,7 @@ mips_fbsd_collect_fpregset (const struct regset *regset, static void mips_fbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { size_t regsize = mips_abi_regsize (regcache->arch ()); diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 30d5feb56d1..556a65b8f0a 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -119,7 +119,7 @@ mips_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) is 8. */ static void -supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr) +supply_32bit_reg (reg_buffer *regcache, int regnum, const void *addr) { regcache->raw_supply_integer (regnum, (const gdb_byte *) addr, 4, true); } @@ -127,7 +127,7 @@ supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr) /* Unpack an elf_gregset_t into GDB's register cache. */ void -mips_supply_gregset (struct regcache *regcache, +mips_supply_gregset (reg_buffer *regcache, const mips_elf_gregset_t *gregsetp) { int regi; @@ -157,7 +157,7 @@ mips_supply_gregset (struct regcache *regcache, static void mips_supply_gregset_wrapper (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { gdb_assert (len >= sizeof (mips_elf_gregset_t)); @@ -276,7 +276,7 @@ mips64_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) /* Supply a 64-bit register. */ static void -supply_64bit_reg (struct regcache *regcache, int regnum, +supply_64bit_reg (reg_buffer *regcache, int regnum, const gdb_byte *buf) { struct gdbarch *gdbarch = regcache->arch (); @@ -290,7 +290,7 @@ supply_64bit_reg (struct regcache *regcache, int regnum, /* Unpack a 64-bit elf_gregset_t into GDB's register cache. */ void -mips64_supply_gregset (struct regcache *regcache, +mips64_supply_gregset (reg_buffer *regcache, const mips64_elf_gregset_t *gregsetp) { int regi; @@ -325,7 +325,7 @@ mips64_supply_gregset (struct regcache *regcache, static void mips64_supply_gregset_wrapper (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { gdb_assert (len >= sizeof (mips64_elf_gregset_t)); @@ -409,7 +409,7 @@ mips64_fill_gregset_wrapper (const struct regset *regset, MIPS I FP context layout"). */ void -mips64_supply_fpregset (struct regcache *regcache, +mips64_supply_fpregset (reg_buffer *regcache, const mips64_elf_fpregset_t *fpregsetp) { struct gdbarch *gdbarch = regcache->arch (); @@ -442,7 +442,7 @@ mips64_supply_fpregset (struct regcache *regcache, static void mips64_supply_fpregset_wrapper (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { gdb_assert (len >= sizeof (mips64_elf_fpregset_t)); diff --git a/gdb/mips-nbsd-tdep.c b/gdb/mips-nbsd-tdep.c index 5f4db87498e..5dd0b8fb6d0 100644 --- a/gdb/mips-nbsd-tdep.c +++ b/gdb/mips-nbsd-tdep.c @@ -52,7 +52,7 @@ static void mipsnbsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { size_t regsize = mips_isa_regsize (regcache->arch ()); @@ -74,7 +74,7 @@ mipsnbsd_supply_fpregset (const struct regset *regset, static void mipsnbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { size_t regsize = mips_isa_regsize (regcache->arch ()); diff --git a/gdb/mips64-obsd-tdep.c b/gdb/mips64-obsd-tdep.c index ab910edfc4c..68a95321d85 100644 --- a/gdb/mips64-obsd-tdep.c +++ b/gdb/mips64-obsd-tdep.c @@ -43,7 +43,7 @@ static void mips64obsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const char *regs = (const char *) gregs; diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c index 070fb205fca..78c9e9397b7 100644 --- a/gdb/mn10300-linux-tdep.c +++ b/gdb/mn10300-linux-tdep.c @@ -83,7 +83,7 @@ typedef struct static void am33_supply_gregset_method (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const mn10300_elf_greg_t *regp = (const mn10300_elf_greg_t *) gregs; @@ -233,7 +233,7 @@ am33_supply_gregset_method (const struct regset *regset, static void am33_supply_fpregset_method (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { const mn10300_elf_fpregset_t *fpregset diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c index e7f4ecf16e2..e4f9f8003e7 100644 --- a/gdb/nios2-linux-tdep.c +++ b/gdb/nios2-linux-tdep.c @@ -56,7 +56,7 @@ static const int reg_offsets[NIOS2_NUM_REGS] = static void nios2_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs_buf, size_t len) { const gdb_byte *gregs = (const gdb_byte *) gregs_buf; diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c index c5104e3959d..e7cfd43ffc7 100644 --- a/gdb/or1k-tdep.c +++ b/gdb/or1k-tdep.c @@ -610,7 +610,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct type *func_type = value_type (function); /* Return address */ - regcache_cooked_write_unsigned (regcache, OR1K_LR_REGNUM, bp_addr); + regcache->cooked_write (OR1K_LR_REGNUM, bp_addr); /* Register for the next argument. */ argreg = OR1K_FIRST_ARG_REGNUM; @@ -619,8 +619,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, argument. */ if (struct_return) { - regcache_cooked_write_unsigned (regcache, OR1K_FIRST_ARG_REGNUM, - struct_addr); + regcache->cooked_write (OR1K_FIRST_ARG_REGNUM, struct_addr); argreg++; } @@ -685,8 +684,8 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, ULONGEST lo = regval & mask; ULONGEST hi = regval >> bits_per_word; - regcache_cooked_write_unsigned (regcache, argreg, hi); - regcache_cooked_write_unsigned (regcache, argreg + 1, lo); + regcache->cooked_write (argreg, hi); + regcache->cooked_write (argreg + 1, lo); argreg += 2; } else @@ -698,9 +697,8 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, else if (argreg <= OR1K_LAST_ARG_REGNUM) { /* Smaller scalars fit in a single register. */ - regcache_cooked_write_unsigned - (regcache, argreg, extract_unsigned_integer (val, len, - byte_order)); + regcache->cooked_write + (argreg, extract_unsigned_integer (val, len, byte_order)); argreg++; } else @@ -781,7 +779,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } /* Save the updated stack pointer. */ - regcache_cooked_write_unsigned (regcache, OR1K_SP_REGNUM, sp); + regcache->cooked_write (OR1K_SP_REGNUM, sp); if (heap_offset > 0) sp = heap_sp; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index c114bee23c9..679d2a1264a 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -390,7 +390,7 @@ ppc_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) static void ppc_linux_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const struct ppc_reg_offsets *offsets diff --git a/gdb/ppc-obsd-tdep.c b/gdb/ppc-obsd-tdep.c index 838783111a2..c3313f5d37d 100644 --- a/gdb/ppc-obsd-tdep.c +++ b/gdb/ppc-obsd-tdep.c @@ -45,7 +45,7 @@ struct ppc_reg_offsets ppcobsd_fpreg_offsets; void ppcobsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { ppc_supply_gregset (regset, regcache, regnum, gregs, len); diff --git a/gdb/ppc-ravenscar-thread.c b/gdb/ppc-ravenscar-thread.c index 7b83e451ff2..408df214b98 100644 --- a/gdb/ppc-ravenscar-thread.c +++ b/gdb/ppc-ravenscar-thread.c @@ -116,7 +116,7 @@ struct ravenscar_reg_info regcache. */ static void -supply_register_at_address (struct regcache *regcache, int regnum, +supply_register_at_address (reg_buffer *regcache, int regnum, CORE_ADDR register_addr) { struct gdbarch *gdbarch = regcache->arch (); @@ -144,8 +144,8 @@ register_in_thread_descriptor_p (const struct ravenscar_reg_info *reg_info, static void ppc_ravenscar_generic_fetch_registers - (const struct ravenscar_reg_info *reg_info, - struct regcache *regcache, int regnum) + (const struct ravenscar_reg_info *reg_info, ptid_t ptid, + reg_buffer *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); const int num_regs = gdbarch_num_regs (gdbarch); @@ -215,9 +215,10 @@ static const struct ravenscar_reg_info ppc_reg_info = for most PowerPC targets. */ static void -ppc_ravenscar_powerpc_fetch_registers (struct regcache *regcache, int regnum) +ppc_ravenscar_powerpc_fetch_registers (ptid_t ptid, reg_buffer *regcache, + int regnum) { - ppc_ravenscar_generic_fetch_registers (&ppc_reg_info, regcache, regnum); + ppc_ravenscar_generic_fetch_registers (&ppc_reg_info, ptid, regcache, regnum); } /* Implement the to_store_registers ravenscar_arch_ops method @@ -258,9 +259,11 @@ static const struct ravenscar_reg_info e500_reg_info = for E500 targets. */ static void -ppc_ravenscar_e500_fetch_registers (struct regcache *regcache, int regnum) +ppc_ravenscar_e500_fetch_registers (ptid_t ptid, reg_buffer *regcache, + int regnum) { - ppc_ravenscar_generic_fetch_registers (&e500_reg_info, regcache, regnum); + ppc_ravenscar_generic_fetch_registers (&e500_reg_info, ptid, regcache, + regnum); } /* Implement the to_store_registers ravenscar_arch_ops method diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index c3571cbd51b..64fe02d81cc 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -102,7 +102,7 @@ struct ppc_reg_offsets int fpscr_size; }; -extern void ppc_supply_reg (struct regcache *regcache, int regnum, +extern void ppc_supply_reg (reg_buffer *regcache, int regnum, const gdb_byte *regs, size_t offset, int regsize); extern void ppc_collect_reg (const struct regcache *regcache, int regnum, @@ -113,7 +113,7 @@ extern void ppc_collect_reg (const struct regcache *regcache, int regnum, REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len); /* Supply register REGNUM in the floating-point register set REGSET @@ -121,7 +121,7 @@ extern void ppc_supply_gregset (const struct regset *regset, REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ extern void ppc_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len); /* Supply register REGNUM in the Altivec register set REGSET diff --git a/gdb/proc-service.c b/gdb/proc-service.c index 8afa667a06a..06c927b2b37 100644 --- a/gdb/proc-service.c +++ b/gdb/proc-service.c @@ -135,7 +135,7 @@ ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset) struct regcache *regcache = get_thread_arch_regcache (ptid, target_gdbarch ()); - target_fetch_registers (regcache, -1); + target_fetch_registers (ptid, regcache, -1); fill_gregset (regcache, (gdb_gregset_t *) gregset, -1); return PS_OK; @@ -167,7 +167,7 @@ ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, gdb_prfpregset_t *fpregs struct regcache *regcache = get_thread_arch_regcache (ptid, target_gdbarch ()); - target_fetch_registers (regcache, -1); + target_fetch_registers (ptid, regcache, -1); fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1); return PS_OK; diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index b8630c3f3a1..31a975cacf3 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -90,7 +90,7 @@ struct ravenscar_thread_target final : public target_ops ptid_t wait (ptid_t, struct target_waitstatus *, int) override; void resume (ptid_t, int, enum gdb_signal) override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; void store_registers (struct regcache *, int) override; void prepare_to_store (struct regcache *) override; @@ -413,10 +413,10 @@ ravenscar_thread_target::pid_to_str (ptid_t ptid) } void -ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum) +ravenscar_thread_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, + int regnum) { struct target_ops *beneath = find_target_beneath (this); - ptid_t ptid = regcache->ptid (); if (ravenscar_runtime_initialized () && is_ravenscar_task (ptid) @@ -426,10 +426,10 @@ ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum) struct ravenscar_arch_ops *arch_ops = gdbarch_ravenscar_ops (gdbarch); - arch_ops->to_fetch_registers (regcache, regnum); + arch_ops->to_fetch_registers (ptid, regcache, regnum); } else - beneath->fetch_registers (regcache, regnum); + beneath->fetch_registers (ptid, regcache, regnum); } void diff --git a/gdb/ravenscar-thread.h b/gdb/ravenscar-thread.h index a52f7f67b7c..6d1bbb7fbb0 100644 --- a/gdb/ravenscar-thread.h +++ b/gdb/ravenscar-thread.h @@ -24,7 +24,7 @@ struct ravenscar_arch_ops { - void (*to_fetch_registers) (struct regcache *, int); + void (*to_fetch_registers) (ptid_t, reg_buffer *, int); void (*to_store_registers) (struct regcache *, int); void (*to_prepare_to_store) (struct regcache *); }; diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 47a31b74ae7..03fc2538448 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -104,7 +104,7 @@ public: int remove_breakpoint (struct gdbarch *, struct bp_target_info *, enum remove_bp_reason) override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; void store_registers (struct regcache *, int) override; void prepare_to_store (struct regcache *) override; @@ -1531,12 +1531,12 @@ record_btrace_target::remove_breakpoint (struct gdbarch *gdbarch, /* The fetch_registers method of target record-btrace. */ void -record_btrace_target::fetch_registers (struct regcache *regcache, int regno) +record_btrace_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) { struct btrace_insn_iterator *replay; struct thread_info *tp; - tp = find_thread_ptid (regcache->ptid ()); + tp = find_thread_ptid (ptid); gdb_assert (tp != NULL); replay = tp->btrace.replay; @@ -1561,7 +1561,7 @@ record_btrace_target::fetch_registers (struct regcache *regcache, int regno) regcache->raw_supply (regno, &insn->pc); } else - this->beneath->fetch_registers (regcache, regno); + this->beneath->fetch_registers (ptid, regcache, regno); } /* The store_registers method of target record-btrace. */ diff --git a/gdb/record-full.c b/gdb/record-full.c index bf65701fb78..d14e21ddcc9 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -304,7 +304,7 @@ public: 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 (ptid_t ptid, reg_buffer *regcache, int regno) 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, @@ -919,7 +919,7 @@ record_full_core_open_1 (const char *name, int from_tty) int i; /* Get record_full_core_regbuf. */ - target_fetch_registers (regcache, -1); + target_fetch_registers (regcache->ptid (), regcache, -1); record_full_core_regbuf = new detached_regcache (regcache->arch (), false); for (i = 0; i < regnum; i ++) @@ -2099,7 +2099,7 @@ record_full_core_target::kill () /* "fetch_registers" method for prec over corefile. */ void -record_full_core_target::fetch_registers (struct regcache *regcache, +record_full_core_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) { if (regno < 0) diff --git a/gdb/regcache.c b/gdb/regcache.c index 0a06b9f0096..d75b3052e47 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -494,7 +494,7 @@ regcache::raw_update (int regnum) if (get_register_status (regnum) == REG_UNKNOWN) { - target_fetch_registers (this, regnum); + target_fetch_registers (this->ptid (), this, regnum); /* A number of targets can't access the whole set of raw registers (because the debug API provides no means to get at @@ -991,10 +991,10 @@ reg_buffer::raw_collect_integer (int regnum, gdb_byte *addr, int addr_len, } void -regcache::transfer_regset (const struct regset *regset, - struct regcache *out_regcache, - int regnum, const void *in_buf, - void *out_buf, size_t size) const +reg_buffer::transfer_regset (const struct regset *regset, + struct reg_buffer *out_regcache, + int regnum, const void *in_buf, + void *out_buf, size_t size) const { const struct regcache_map_entry *map; int offs = 0, count; @@ -1051,15 +1051,15 @@ regcache::transfer_regset (const struct regset *regset, void regcache_supply_regset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *buf, size_t size) { regcache->supply_regset (regset, regnum, buf, size); } void -regcache::supply_regset (const struct regset *regset, - int regnum, const void *buf, size_t size) +reg_buffer::supply_regset (const struct regset *regset, + int regnum, const void *buf, size_t size) { transfer_regset (regset, this, regnum, buf, NULL, size); } @@ -1077,7 +1077,7 @@ regcache_collect_regset (const struct regset *regset, } void -regcache::collect_regset (const struct regset *regset, +reg_buffer::collect_regset (const struct regset *regset, int regnum, void *buf, size_t size) const { transfer_regset (regset, NULL, regnum, NULL, buf, size); @@ -1139,7 +1139,7 @@ reg_buffer::num_raw_registers () const } void -regcache::debug_print_register (const char *func, int regno) +reg_buffer::debug_print_register (const char *func, int regno) { struct gdbarch *gdbarch = arch (); @@ -1388,7 +1388,7 @@ public: xfer_partial_called = 0; } - void fetch_registers (regcache *regs, int regno) override; + void fetch_registers (ptid_t ptid, reg_buffer *regs, int regno) override; void store_registers (regcache *regs, int regno) override; enum target_xfer_status xfer_partial (enum target_object object, @@ -1403,7 +1403,8 @@ public: }; void -target_ops_no_register::fetch_registers (regcache *regs, int regno) +target_ops_no_register::fetch_registers (ptid_t ptid, reg_buffer *regs, + int regno) { /* Mark register available. */ regs->raw_supply_zeroed (regno); diff --git a/gdb/regcache.h b/gdb/regcache.h index 23018fce8e1..f84138f5439 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -95,24 +95,6 @@ enum REGCACHE_MAP_SKIP = -1, }; -/* Transfer a set of registers (as described by REGSET) between - REGCACHE and BUF. If REGNUM == -1, transfer all registers - belonging to the regset, otherwise just the register numbered - REGNUM. The REGSET's 'regmap' field must point to an array of - 'struct regcache_map_entry'. - - These functions are suitable for the 'regset_supply' and - 'regset_collect' fields in a regset structure. */ - -extern void regcache_supply_regset (const struct regset *regset, - struct regcache *regcache, - int regnum, const void *buf, - size_t size); -extern void regcache_collect_regset (const struct regset *regset, - const struct regcache *regcache, - int regnum, void *buf, size_t size); - - /* The type of a register. This function is slightly more efficient then its gdbarch vector counterpart since it returns a precomputed value stored in a table. */ @@ -153,11 +135,15 @@ public: buffer. */ enum register_status get_register_status (int regnum) const; + /* Collect register REGNUM from REGCACHE and store its contents in BUF. */ void raw_collect (int regnum, void *buf) const; void raw_collect_integer (int regnum, gdb_byte *addr, int addr_len, bool is_signed) const; + void collect_regset (const struct regset *regset, int regnum, + void *buf, size_t size) const; + /* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */ void raw_supply (int regnum, const void *buf); @@ -171,8 +157,15 @@ public: void raw_supply_zeroed (int regnum); + void supply_regset (const struct regset *regset, + int regnum, const void *buf, size_t size); + void invalidate (int regnum); + /* Dump the contents of a register from the register cache to the target + debug. */ + void debug_print_register (const char *func, int regno); + virtual ~reg_buffer () = 0; protected: @@ -188,6 +181,11 @@ protected: zero iff the register's value can't be returned. */ void save (regcache_cooked_read_ftype *cooked_read, void *src); + void transfer_regset (const struct regset *regset, + struct reg_buffer *out_regcache, + int regnum, const void *in_buf, + void *out_buf, size_t size) const; + struct regcache_descr *m_descr; bool m_has_pseudo; @@ -200,6 +198,23 @@ protected: friend class detached_regcache; }; +/* Transfer a set of registers (as described by REGSET) between + REGCACHE and BUF. If REGNUM == -1, transfer all registers + belonging to the regset, otherwise just the register numbered + REGNUM. The REGSET's 'regmap' field must point to an array of + 'struct regcache_map_entry'. + + These functions are suitable for the 'regset_supply' and + 'regset_collect' fields in a regset structure. */ + +extern void regcache_supply_regset (const struct regset *regset, + reg_buffer *regcache, + int regnum, const void *buf, + size_t size); +extern void regcache_collect_regset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *buf, size_t size); + /* An abstract class which only has methods doing read. */ class readable_regcache : public reg_buffer @@ -304,13 +319,6 @@ public: void cooked_write_part (int regnum, int offset, int len, const gdb_byte *buf); - void supply_regset (const struct regset *regset, - int regnum, const void *buf, size_t size); - - - void collect_regset (const struct regset *regset, int regnum, - void *buf, size_t size) const; - /* Return REGCACHE's ptid. */ ptid_t ptid () const @@ -325,10 +333,6 @@ public: this->m_ptid = ptid; } -/* Dump the contents of a register from the register cache to the target - debug. */ - void debug_print_register (const char *func, int regno); - static void regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid); protected: regcache (gdbarch *gdbarch, const address_space *aspace_); @@ -336,11 +340,6 @@ protected: private: - void transfer_regset (const struct regset *regset, - struct regcache *out_regcache, - int regnum, const void *in_buf, - void *out_buf, size_t size) const; - enum register_status write_part (int regnum, int offset, int len, const void *out, bool is_raw); diff --git a/gdb/regset.h b/gdb/regset.h index 7a38f4085f4..b30a875ee3a 100644 --- a/gdb/regset.h +++ b/gdb/regset.h @@ -25,7 +25,7 @@ struct regcache; /* Data structure describing a register set. */ -typedef void (supply_regset_ftype) (const struct regset *, struct regcache *, +typedef void (supply_regset_ftype) (const struct regset *, reg_buffer *, int, const void *, size_t); typedef void (collect_regset_ftype) (const struct regset *, const struct regcache *, diff --git a/gdb/remote.c b/gdb/remote.c index 3013fbe5e6a..0f1fa1d3dbb 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -424,7 +424,7 @@ public: void resume (ptid_t, int, enum gdb_signal) override; ptid_t wait (ptid_t, struct target_waitstatus *, int) override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; void store_registers (struct regcache *, int) override; void prepare_to_store (struct regcache *) override; @@ -839,11 +839,10 @@ public: /* Remote specific methods. */ void remote_notif_get_pending_events (notif_client *nc); - int fetch_register_using_p (struct regcache *regcache, - packet_reg *reg); + int fetch_register_using_p (reg_buffer *regcache, packet_reg *reg); int send_g_packet (); - void process_g_packet (struct regcache *regcache); - void fetch_registers_using_g (struct regcache *regcache); + void process_g_packet (reg_buffer *regcache); + void fetch_registers_using_g (reg_buffer *regcache); int store_register_using_P (const struct regcache *regcache, packet_reg *reg); void store_registers_using_G (const struct regcache *regcache); @@ -8040,7 +8039,7 @@ remote_target::wait (ptid_t ptid, struct target_waitstatus *status, int options) /* Fetch a single register using a 'p' packet. */ int -remote_target::fetch_register_using_p (struct regcache *regcache, +remote_target::fetch_register_using_p (reg_buffer *regcache, packet_reg *reg) { struct gdbarch *gdbarch = regcache->arch (); @@ -8138,7 +8137,7 @@ remote_target::send_g_packet () } void -remote_target::process_g_packet (struct regcache *regcache) +remote_target::process_g_packet (reg_buffer *regcache) { struct gdbarch *gdbarch = regcache->arch (); struct remote_state *rs = get_remote_state (); @@ -8242,7 +8241,7 @@ remote_target::process_g_packet (struct regcache *regcache) } void -remote_target::fetch_registers_using_g (struct regcache *regcache) +remote_target::fetch_registers_using_g (reg_buffer *regcache) { send_g_packet (); process_g_packet (regcache); @@ -8272,7 +8271,7 @@ remote_target::set_remote_traceframe () } void -remote_target::fetch_registers (struct regcache *regcache, int regnum) +remote_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); struct remote_state *rs = get_remote_state (); @@ -8280,7 +8279,7 @@ remote_target::fetch_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 8e69c465fa7..7b8d40fbf3f 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -100,7 +100,7 @@ static struct ppc_reg_offsets rs6000_aix64_reg_offsets = static void rs6000_aix_supply_regset (const struct regset *regset, - struct regcache *regcache, int regnum, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { ppc_supply_gregset (regset, regcache, regnum, gregs, len); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index a0f290f61b8..b2a0f31896e 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -376,7 +376,7 @@ rs6000_register_sim_regno (struct gdbarch *gdbarch, int reg) Write the register to REGCACHE. */ void -ppc_supply_reg (struct regcache *regcache, int regnum, +ppc_supply_reg (reg_buffer *regcache, int regnum, const gdb_byte *regs, size_t offset, int regsize) { if (regnum != -1 && offset != -1) @@ -480,7 +480,7 @@ ppc_fpreg_offset (struct gdbarch_tdep *tdep, REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ void -ppc_supply_gregset (const struct regset *regset, struct regcache *regcache, +ppc_supply_gregset (const struct regset *regset, reg_buffer *regcache, int regnum, const void *gregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); @@ -530,7 +530,7 @@ ppc_supply_gregset (const struct regset *regset, struct regcache *regcache, REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ void -ppc_supply_fpregset (const struct regset *regset, struct regcache *regcache, +ppc_supply_fpregset (const struct regset *regset, reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index cd840c86d65..d966ff26abb 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -183,15 +183,23 @@ static const struct regcache_map_entry s390_regmap_gsbc[] = the TDB registers unless the TDB format field is valid. */ static void -s390_supply_tdb_regset (const struct regset *regset, struct regcache *regcache, - int regnum, const void *regs, size_t len) +s390_supply_tdb_regset (const struct regset *regset, reg_buffer *regcache, + int regnum, const void *regs, size_t len) { ULONGEST tdw; enum register_status ret; + gdb_byte buf[register_size (regcache->arch (), S390_TDB_DWORD0_REGNUM)]; regcache_supply_regset (regset, regcache, regnum, regs, len); - ret = regcache_cooked_read_unsigned (regcache, S390_TDB_DWORD0_REGNUM, &tdw); - if (ret != REG_VALID || (tdw >> 56) != 1) + if (regcache->get_register_status (S390_TDB_DWORD0_REGNUM) != REG_VALID) + { + regcache_supply_regset (regset, regcache, regnum, NULL, len); + return; + } + + regcache->raw_collect (S390_TDB_DWORD0_REGNUM, buf); + tdw = extract_unsigned_integer(buf, register_size (regcache->arch (), S390_TDB_DWORD0_REGNUM), gdbarch_byte_order (regcache->arch ())); + if ((tdw >> 56) != 1) regcache_supply_regset (regset, regcache, regnum, NULL, len); } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index e4e08c706a1..810b18cfa82 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1050,7 +1050,7 @@ s390_register_call_saved (struct gdbarch *gdbarch, int regnum) static void s390_guess_tracepoint_registers (struct gdbarch *gdbarch, - struct regcache *regcache, + reg_buffer *regcache, CORE_ADDR addr) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index 16bf00ea024..871d7fed22d 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -1418,7 +1418,7 @@ static const struct regcache_map_entry score7_linux_gregmap[] = static void score7_linux_supply_gregset(const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *buf, size_t size) { diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index d1a143414df..be6b95457f3 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2161,7 +2161,7 @@ sh_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) void sh_corefile_supply_regset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *regs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c index 00f4513489c..cc76abc905a 100644 --- a/gdb/sparc-linux-tdep.c +++ b/gdb/sparc-linux-tdep.c @@ -214,7 +214,7 @@ const struct sparc_gregmap sparc32_linux_core_gregmap = static void sparc32_linux_supply_core_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { sparc32_supply_gregset (&sparc32_linux_core_gregmap, @@ -232,7 +232,7 @@ sparc32_linux_collect_core_gregset (const struct regset *regset, static void sparc32_linux_supply_core_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs); diff --git a/gdb/sparc-nbsd-tdep.c b/gdb/sparc-nbsd-tdep.c index a58c6e469fd..4dfd401b21e 100644 --- a/gdb/sparc-nbsd-tdep.c +++ b/gdb/sparc-nbsd-tdep.c @@ -52,7 +52,7 @@ const struct sparc_gregmap sparc32nbsd_gregmap = static void sparc32nbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { sparc32_supply_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs); @@ -67,7 +67,7 @@ sparc32nbsd_supply_gregset (const struct regset *regset, static void sparc32nbsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs); diff --git a/gdb/sparc-obsd-tdep.c b/gdb/sparc-obsd-tdep.c index 0f6caa63254..ac5a00c017b 100644 --- a/gdb/sparc-obsd-tdep.c +++ b/gdb/sparc-obsd-tdep.c @@ -149,7 +149,7 @@ static const struct frame_unwind sparc32obsd_sigtramp_frame_unwind = #define SPARC32OBSD_UTHREAD_PC_OFFSET 132 static void -sparc32obsd_supply_uthread (struct regcache *regcache, +sparc32obsd_supply_uthread (reg_buffer *regcache, int regnum, CORE_ADDR addr) { struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c index 0b4d68a4a42..70a7edfe5f5 100644 --- a/gdb/sparc-ravenscar-thread.c +++ b/gdb/sparc-ravenscar-thread.c @@ -25,7 +25,7 @@ #include "ravenscar-thread.h" #include "sparc-ravenscar-thread.h" -static void sparc_ravenscar_fetch_registers (struct regcache *regcache, +static void sparc_ravenscar_fetch_registers (ptid_t ptid, reg_buffer *regcache, int regnum); static void sparc_ravenscar_store_registers (struct regcache *regcache, int regnum); @@ -59,8 +59,8 @@ static const int sparc_register_offsets[] = regcache. */ static void -supply_register_at_address (struct regcache *regcache, int regnum, - CORE_ADDR register_addr) +supply_register_at_address (reg_buffer *regcache, int regnum, + CORE_ADDR register_addr) { struct gdbarch *gdbarch = regcache->arch (); int buf_size = register_size (gdbarch, regnum); @@ -101,7 +101,7 @@ register_in_thread_descriptor_p (int regnum) thread. */ static void -sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum) +sparc_ravenscar_fetch_registers (ptid_t ptid, reg_buffer *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); const int sp_regnum = gdbarch_sp_regnum (gdbarch); @@ -110,6 +110,7 @@ sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum) CORE_ADDR current_address; CORE_ADDR thread_descriptor_address; ULONGEST stack_address; + gdb_byte buf[register_size (gdbarch, sp_regnum)]; /* The tid is the thread_id field, which is a pointer to the thread. */ thread_descriptor_address = (CORE_ADDR) ptid_get_tid (inferior_ptid); @@ -118,7 +119,10 @@ sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum) current_address = thread_descriptor_address + sparc_register_offsets [sp_regnum]; supply_register_at_address (regcache, sp_regnum, current_address); - regcache_cooked_read_unsigned (regcache, sp_regnum, &stack_address); + regcache->raw_collect (sp_regnum, buf); + stack_address + = extract_unsigned_integer (buf, register_size (gdbarch, sp_regnum), + gdbarch_byte_order (gdbarch)); /* Read registers. */ for (current_regnum = 0; current_regnum < num_regs; current_regnum ++) diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c index f3747466d2c..5659abcf007 100644 --- a/gdb/sparc-sol2-tdep.c +++ b/gdb/sparc-sol2-tdep.c @@ -54,7 +54,7 @@ const struct sparc_fpregmap sparc32_sol2_fpregmap = static void sparc32_sol2_supply_core_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { sparc32_supply_gregset (&sparc32_sol2_gregmap, regcache, regnum, gregs); @@ -70,7 +70,7 @@ sparc32_sol2_collect_core_gregset (const struct regset *regset, static void sparc32_sol2_supply_core_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { sparc32_supply_fpregset (&sparc32_sol2_fpregmap, regcache, regnum, fpregs); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 65c1f006204..8a61ad98f57 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1940,7 +1940,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Helper functions for dealing with register windows. */ void -sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum) +sparc_supply_rwindow (reg_buffer *regcache, CORE_ADDR sp, int regnum) { struct gdbarch *gdbarch = regcache->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -2085,7 +2085,7 @@ sparc_collect_rwindow (const struct regcache *regcache, void sparc32_supply_gregset (const struct sparc_gregmap *gregmap, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs) { const gdb_byte *regs = (const gdb_byte *) gregs; @@ -2126,8 +2126,12 @@ sparc32_supply_gregset (const struct sparc_gregmap *gregmap, if (gregmap->r_l0_offset == -1) { ULONGEST sp; + struct gdbarch *gdbarch = regcache->arch (); + int sz = register_size (gdbarch, SPARC_SP_REGNUM); + gdb_byte buf[sz]; - regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp); + regcache->raw_collect (SPARC_SP_REGNUM, buf); + sp = extract_unsigned_integer (buf, sz, gdbarch_byte_order (gdbarch)); sparc_supply_rwindow (regcache, sp, regnum); } else diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h index 4ca67d01b61..3f0d46e12c4 100644 --- a/gdb/sparc-tdep.h +++ b/gdb/sparc-tdep.h @@ -214,7 +214,7 @@ extern int -extern void sparc_supply_rwindow (struct regcache *regcache, +extern void sparc_supply_rwindow (reg_buffer *regcache, CORE_ADDR sp, int regnum); extern void sparc_collect_rwindow (const struct regcache *regcache, CORE_ADDR sp, int regnum); @@ -225,13 +225,13 @@ extern const struct sparc_fpregmap sparc32_sunos4_fpregmap; extern const struct sparc_fpregmap sparc32_bsd_fpregmap; extern void sparc32_supply_gregset (const struct sparc_gregmap *gregmap, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs); extern void sparc32_collect_gregset (const struct sparc_gregmap *gregmap, const struct regcache *regcache, int regnum, void *gregs); extern void sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs); extern void sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap, const struct regcache *regcache, diff --git a/gdb/sparc64-fbsd-tdep.c b/gdb/sparc64-fbsd-tdep.c index 72b523d984c..0bb4f9c0987 100644 --- a/gdb/sparc64-fbsd-tdep.c +++ b/gdb/sparc64-fbsd-tdep.c @@ -48,7 +48,7 @@ const struct sparc_gregmap sparc64fbsd_gregmap = static void sparc64fbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { sparc64_supply_gregset (&sparc64fbsd_gregmap, regcache, regnum, gregs); @@ -64,7 +64,7 @@ sparc64fbsd_collect_gregset (const struct regset *regset, static void sparc64fbsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs); diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c index 8810c80f60f..3978fa900e5 100644 --- a/gdb/sparc64-linux-tdep.c +++ b/gdb/sparc64-linux-tdep.c @@ -222,7 +222,7 @@ const struct sparc_gregmap sparc64_linux_core_gregmap = static void sparc64_linux_supply_core_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { sparc64_supply_gregset (&sparc64_linux_core_gregmap, @@ -240,7 +240,7 @@ sparc64_linux_collect_core_gregset (const struct regset *regset, static void sparc64_linux_supply_core_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs); diff --git a/gdb/sparc64-nbsd-tdep.c b/gdb/sparc64-nbsd-tdep.c index cf26885e64a..a2f723d0a2d 100644 --- a/gdb/sparc64-nbsd-tdep.c +++ b/gdb/sparc64-nbsd-tdep.c @@ -50,7 +50,7 @@ const struct sparc_gregmap sparc64nbsd_gregmap = static void sparc64nbsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { sparc64_supply_gregset (&sparc64nbsd_gregmap, regcache, regnum, gregs); @@ -58,7 +58,7 @@ sparc64nbsd_supply_gregset (const struct regset *regset, static void sparc64nbsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs); diff --git a/gdb/sparc64-obsd-tdep.c b/gdb/sparc64-obsd-tdep.c index 48b45c400cd..7a1b4cc12de 100644 --- a/gdb/sparc64-obsd-tdep.c +++ b/gdb/sparc64-obsd-tdep.c @@ -72,7 +72,7 @@ const struct sparc_gregmap sparc64obsd_core_gregmap = static void sparc64obsd_supply_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const void *fpregs = (char *)gregs + 288; @@ -89,7 +89,7 @@ sparc64obsd_supply_gregset (const struct regset *regset, static void sparc64obsd_supply_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs); @@ -320,7 +320,7 @@ static const struct frame_unwind sparc64obsd_trapframe_unwind = #define SPARC64OBSD_UTHREAD_PC_OFFSET 240 static void -sparc64obsd_supply_uthread (struct regcache *regcache, +sparc64obsd_supply_uthread (reg_buffer *regcache, int regnum, CORE_ADDR addr) { struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c index 96a482d5077..6768eeef166 100644 --- a/gdb/sparc64-sol2-tdep.c +++ b/gdb/sparc64-sol2-tdep.c @@ -53,7 +53,7 @@ const struct sparc_fpregmap sparc64_sol2_fpregmap = static void sparc64_sol2_supply_core_gregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs, size_t len) { sparc64_supply_gregset (&sparc64_sol2_gregmap, regcache, regnum, gregs); @@ -69,7 +69,7 @@ sparc64_sol2_collect_core_gregset (const struct regset *regset, static void sparc64_sol2_supply_core_fpregset (const struct regset *regset, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs, size_t len) { sparc64_supply_fpregset (&sparc64_sol2_fpregmap, regcache, regnum, fpregs); diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 86b5fcf47bf..c108ee8bbb3 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -1875,7 +1875,7 @@ sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) void sparc64_supply_gregset (const struct sparc_gregmap *gregmap, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs) { struct gdbarch *gdbarch = regcache->arch (); @@ -1969,8 +1969,12 @@ sparc64_supply_gregset (const struct sparc_gregmap *gregmap, if (gregmap->r_l0_offset == -1) { ULONGEST sp; + struct gdbarch *gdbarch = regcache->arch (); + int sz = register_size (gdbarch, SPARC_SP_REGNUM); + gdb_byte buf[sz]; - regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp); + regcache->raw_collect (SPARC_SP_REGNUM, buf); + sp = extract_unsigned_integer (buf, sz, gdbarch_byte_order (gdbarch)); sparc_supply_rwindow (regcache, sp, regnum); } else diff --git a/gdb/sparc64-tdep.h b/gdb/sparc64-tdep.h index 45442b3ac42..e8752cf989c 100644 --- a/gdb/sparc64-tdep.h +++ b/gdb/sparc64-tdep.h @@ -101,13 +101,13 @@ extern void sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); extern void sparc64_supply_gregset (const struct sparc_gregmap *gregmap, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *gregs); extern void sparc64_collect_gregset (const struct sparc_gregmap *gregmap, const struct regcache *regcache, int regnum, void *gregs); extern void sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap, - struct regcache *regcache, + reg_buffer *regcache, int regnum, const void *fpregs); extern void sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap, const struct regcache *regcache, diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c index 39a657ff1a9..3681b76587e 100644 --- a/gdb/spu-multiarch.c +++ b/gdb/spu-multiarch.c @@ -52,7 +52,7 @@ struct spu_multiarch_target final : public target_ops void mourn_inferior () override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t, reg_buffer *, int) override; void store_registers (struct regcache *, int) override; enum target_xfer_status xfer_partial (enum target_object object, @@ -178,7 +178,7 @@ spu_multiarch_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) /* Override the to_fetch_registers routine. */ void -spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno) +spu_multiarch_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -189,12 +189,12 @@ spu_multiarch_target::fetch_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->fetch_registers (regcache, regno); + ops_beneath->fetch_registers (ptid, regcache, regno); return; } diff --git a/gdb/target-debug.h b/gdb/target-debug.h index 5f3001b89f0..fb2b1b45952 100644 --- a/gdb/target-debug.h +++ b/gdb/target-debug.h @@ -102,6 +102,8 @@ target_debug_do_print (plongest (*(X))) #define target_debug_print_struct_regcache_p(X) \ target_debug_do_print (host_address_to_string (X)) +#define target_debug_print_reg_buffer_p(X) \ + target_debug_do_print (host_address_to_string (X)) #define target_debug_print_struct_thread_info_p(X) \ target_debug_do_print (host_address_to_string (X)) #define target_debug_print_struct_ui_file_p(X) \ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index da743471224..f76edaef095 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -16,7 +16,7 @@ struct dummy_target : public target_ops void resume (ptid_t arg0, int arg1, enum gdb_signal arg2) override; void commit_resume () override; ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2) override; - void fetch_registers (struct regcache *arg0, int arg1) override; + void fetch_registers (ptid_t arg0, reg_buffer *arg1, int arg2) override; void store_registers (struct regcache *arg0, int arg1) override; void prepare_to_store (struct regcache *arg0) override; void files_info () override; @@ -184,7 +184,7 @@ struct debug_target : public target_ops void resume (ptid_t arg0, int arg1, enum gdb_signal arg2) override; void commit_resume () override; ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2) override; - void fetch_registers (struct regcache *arg0, int arg1) override; + void fetch_registers (ptid_t arg0, reg_buffer *arg1, int arg2) override; void store_registers (struct regcache *arg0, int arg1) override; void prepare_to_store (struct regcache *arg0) override; void files_info () override; @@ -485,25 +485,27 @@ debug_target::wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2) } void -target_ops::fetch_registers (struct regcache *arg0, int arg1) +target_ops::fetch_registers (ptid_t arg0, reg_buffer *arg1, int 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 (ptid_t arg0, reg_buffer *arg1, int arg2) { } void -debug_target::fetch_registers (struct regcache *arg0, int arg1) +debug_target::fetch_registers (ptid_t arg0, reg_buffer *arg1, int arg2) { fprintf_unfiltered (gdb_stdlog, "-> %s->fetch_registers (...)\n", this->beneath->shortname ()); - this->beneath->fetch_registers (arg0, arg1); + this->beneath->fetch_registers (arg0, arg1, arg2); fprintf_unfiltered (gdb_stdlog, "<- %s->fetch_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 d96cdec4188..9dfb925e01c 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3516,9 +3516,9 @@ target_options_to_string (int target_options) } void -target_fetch_registers (struct regcache *regcache, int regno) +target_fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) { - target_stack->fetch_registers (regcache, regno); + target_stack->fetch_registers (ptid, regcache, regno); if (targetdebug) regcache->debug_print_register ("target_fetch_registers", regno); } diff --git a/gdb/target.h b/gdb/target.h index e2d1e61cdcd..d062113cf11 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -473,7 +473,7 @@ struct target_ops virtual ptid_t wait (ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER (target_debug_print_options)) TARGET_DEFAULT_FUNC (default_target_wait); - virtual void fetch_registers (struct regcache *, int) + virtual void fetch_registers (ptid_t, reg_buffer *, int) TARGET_DEFAULT_IGNORE (); virtual void store_registers (struct regcache *, int) TARGET_DEFAULT_NORETURN (noprocess ()); @@ -1377,7 +1377,7 @@ 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 (struct regcache *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 diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 2327d9e47e3..8ad99b2073d 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -53,7 +53,7 @@ class tfile_target final : public tracefile_target { return tfile_target_info; } void close () override; - void fetch_registers (struct regcache *, int) override; + void fetch_registers (ptid_t ptid, reg_buffer *, int) override; enum target_xfer_status xfer_partial (enum target_object object, const char *annex, gdb_byte *readbuf, @@ -868,7 +868,7 @@ traceframe_find_block_type (char type_wanted, int pos) requested register from it. */ void -tfile_target::fetch_registers (struct regcache *regcache, int regno) +tfile_target::fetch_registers (ptid_t ptid, reg_buffer *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); int offset, regn, regsize, dummy; diff --git a/gdb/tracefile.c b/gdb/tracefile.c index ab34ecfdf99..e4f553c16b5 100644 --- a/gdb/tracefile.c +++ b/gdb/tracefile.c @@ -385,7 +385,7 @@ trace_save_ctf (const char *dirname, int target_does_save) ctf. */ void -tracefile_fetch_registers (struct regcache *regcache, int regno) +tracefile_fetch_registers (reg_buffer *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); struct tracepoint *tp = get_tracepoint (get_tracepoint_number ()); diff --git a/gdb/tracefile.h b/gdb/tracefile.h index 47f8bee8f27..c764b5d2d4d 100644 --- a/gdb/tracefile.h +++ b/gdb/tracefile.h @@ -129,6 +129,6 @@ public: bool thread_alive (ptid_t ptid) override; }; -extern void tracefile_fetch_registers (struct regcache *regcache, int regno); +extern void tracefile_fetch_registers (reg_buffer *regcache, int regno); #endif /* TRACEFILE_H */ diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index d07a4779076..e81f948be5b 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -67,7 +67,7 @@ vax_register_type (struct gdbarch *gdbarch, int regnum) REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ static void -vax_supply_gregset (const struct regset *regset, struct regcache *regcache, +vax_supply_gregset (const struct regset *regset, reg_buffer *regcache, int regnum, const void *gregs, size_t len) { const gdb_byte *regs = (const gdb_byte *) gregs; diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 60e34c3075b..2078526b50c 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -836,7 +836,7 @@ xtensa_register_reggroup_p (struct gdbarch *gdbarch, static void xtensa_supply_gregset (const struct regset *regset, - struct regcache *rc, + reg_buffer *rc, int regnum, const void *gregs, size_t len)