From: Yao Qi Date: Wed, 21 Feb 2018 11:20:03 +0000 (+0000) Subject: class readable_regcache and pass readable_regcache to gdbarch pseudo_register_read... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=849d0ba8;p=binutils-gdb.git class readable_regcache and pass readable_regcache to gdbarch pseudo_register_read and pseudo_register_read_value pseudo registers are either from raw registers or memory, so gdbarch methods pseudo_register_read and pseudo_register_read_value should have regcache object which only have read methods. In other words, we should disallow writing to regcache in these two gdbarch methods. In order to apply this restriction, this patch adds a new class readable_regcache, derived from reg_buffer, and it only has raw_read and cooked_read methods. regcache is derived from readable_regcache. This patch also passes readable_regcache instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. This patch moves raw_read* and cooked_read* methods to readable_regcache, which is straightforward. One thing not straightforward is that I split regcache::xfer_part to readable_regcache::read_part and regcache::write_part, because readable_regcache can only have methods to read. readable_regcache is an abstract base class, and it has a pure virtual function raw_update, because I don't want readable_regcache know where these raw registers are from. They can be from either the target (readwrite regcache) or the regcache itself (readonly regcache). gdb: 2018-02-21 Yao Qi * aarch64-tdep.c (aarch64_pseudo_register_read_value): Change parameter type to 'readable_regcache *'. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. (arm_pseudo_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * gdbarch.c: Re-generated. * gdbarch.h: Re-generated. * gdbarch.sh (pseudo_register_read): Change parameter type to 'readable_regcache *'. (pseudo_register_read_value): Likewise. * h8300-tdep.c (pseudo_from_raw_register): Likewise. (h8300_pseudo_register_read): Likewise. * hppa-tdep.c (hppa_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. (i386_pseudo_register_read_value): Likewise. * i386-tdep.h (i386_pseudo_register_read_into_value): Update declaration. * ia64-tdep.c (ia64_pseudo_register_read): Likewise. * m32c-tdep.c (m32c_raw_read): Likewise. (m32c_read_flg): Likewise. (m32c_banked_register): Likewise. (m32c_banked_read): Likewise. (m32c_sb_read): Likewise. (m32c_part_read): Likewise. (m32c_cat_read): Likewise. (m32c_r3r2r1r0_read): Likewise. (m32c_pseudo_register_read): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_register_read): Likewise. * mips-tdep.c (mips_pseudo_register_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * regcache.c (regcache::raw_read): Move it to readable_regcache. (regcache::cooked_read): Likewise. (regcache::cooked_read_value): Likewise. (regcache_cooked_read_signed): (regcache::cooked_read): Likewise. * regcache.h (readable_regcache): New class. (regcache): Inherit readable_regcache. Move some methods to readable_regcache. * rl78-tdep.c (rl78_pseudo_register_read): Change parameter type to 'readable_regcache *'. * rs6000-tdep.c (do_regcache_raw_read): Remove. (e500_pseudo_register_read): Change parameter type to 'readable_regcache *'. (dfp_pseudo_register_read): Likewise. (vsx_pseudo_register_read): Likewise. (efpr_pseudo_register_read): Likewise. * s390-tdep.c (s390_pseudo_register_read): Likewise. * sh-tdep.c (sh_pseudo_register_read): Likewise. * sh64-tdep.c (pseudo_register_read_portions): Likewise. (sh64_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. (spu_pseudo_register_read): Likewise. * xtensa-tdep.c (xtensa_register_read_masked): Likewise. (xtensa_pseudo_register_read): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 50524abd51c..567a0dd4af5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,70 @@ +2018-02-21 Yao Qi + + * aarch64-tdep.c (aarch64_pseudo_register_read_value): Change + parameter type to 'readable_regcache *'. + * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. + * arm-tdep.c (arm_neon_quad_read): Likewise. + (arm_pseudo_read): Likewise. + * avr-tdep.c (avr_pseudo_register_read): Likewise. + * bfin-tdep.c (bfin_pseudo_register_read): Likewise. + * frv-tdep.c (frv_pseudo_register_read): Likewise. + * gdbarch.c: Re-generated. + * gdbarch.h: Re-generated. + * gdbarch.sh (pseudo_register_read): Change parameter type to + 'readable_regcache *'. + (pseudo_register_read_value): Likewise. + * h8300-tdep.c (pseudo_from_raw_register): Likewise. + (h8300_pseudo_register_read): Likewise. + * hppa-tdep.c (hppa_pseudo_register_read): Likewise. + * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. + (i386_pseudo_register_read_into_value): Likewise. + (i386_pseudo_register_read_value): Likewise. + * i386-tdep.h (i386_pseudo_register_read_into_value): Update + declaration. + * ia64-tdep.c (ia64_pseudo_register_read): Likewise. + * m32c-tdep.c (m32c_raw_read): Likewise. + (m32c_read_flg): Likewise. + (m32c_banked_register): Likewise. + (m32c_banked_read): Likewise. + (m32c_sb_read): Likewise. + (m32c_part_read): Likewise. + (m32c_cat_read): Likewise. + (m32c_r3r2r1r0_read): Likewise. + (m32c_pseudo_register_read): Likewise. + * m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise. + * mep-tdep.c (mep_pseudo_cr32_read): Likewise. + (mep_pseudo_cr64_read): Likewise. + (mep_pseudo_register_read): Likewise. + * mips-tdep.c (mips_pseudo_register_read): Likewise. + * msp430-tdep.c (msp430_pseudo_register_read): Likewise. + * nds32-tdep.c (nds32_pseudo_register_read): Likewise. + * regcache.c (regcache::raw_read): Move it to readable_regcache. + (regcache::cooked_read): Likewise. + (regcache::cooked_read_value): Likewise. + (regcache_cooked_read_signed): + (regcache::cooked_read): Likewise. + * regcache.h (readable_regcache): New class. + (regcache): Inherit readable_regcache. Move some methods to + readable_regcache. + * rl78-tdep.c (rl78_pseudo_register_read): Change + parameter type to 'readable_regcache *'. + * rs6000-tdep.c (do_regcache_raw_read): Remove. + (e500_pseudo_register_read): Change parameter type to + 'readable_regcache *'. + (dfp_pseudo_register_read): Likewise. + (vsx_pseudo_register_read): Likewise. + (efpr_pseudo_register_read): Likewise. + * s390-tdep.c (s390_pseudo_register_read): Likewise. + * sh-tdep.c (sh_pseudo_register_read): Likewise. + * sh64-tdep.c (pseudo_register_read_portions): Likewise. + (sh64_pseudo_register_read): Likewise. + * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. + * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. + * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. + (spu_pseudo_register_read): Likewise. + * xtensa-tdep.c (xtensa_register_read_masked): Likewise. + (xtensa_pseudo_register_read): Likewise. + 2018-02-21 Yao Qi * regcache.c (regcache::regcache): Call reg_buffer ctor. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 6b59f0365c7..f08945ea071 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2225,7 +2225,7 @@ aarch64_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum, static struct value * aarch64_pseudo_read_value (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum) { gdb_byte reg_buf[V_REGISTER_SIZE]; diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index b589d93940f..6b92c9244c6 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -347,7 +347,7 @@ amd64_pseudo_register_name (struct gdbarch *gdbarch, int regnum) static struct value * amd64_pseudo_register_read_value (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum) { gdb_byte *raw_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum)); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 8be0d4d063f..ef7e66b36af 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -227,7 +227,7 @@ static void show_disassembly_style_sfunc (struct ui_file *, int, const char *); static enum register_status arm_neon_quad_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum, gdb_byte *buf); static void arm_neon_quad_write (struct gdbarch *gdbarch, struct regcache *regcache, @@ -8678,7 +8678,7 @@ arm_write_pc (struct regcache *regcache, CORE_ADDR pc) the quad register, in [0, 15]. */ static enum register_status -arm_neon_quad_read (struct gdbarch *gdbarch, struct regcache *regcache, +arm_neon_quad_read (struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buf) { char name_buf[4]; @@ -8711,7 +8711,7 @@ arm_neon_quad_read (struct gdbarch *gdbarch, struct regcache *regcache, } static enum register_status -arm_pseudo_read (struct gdbarch *gdbarch, struct regcache *regcache, +arm_pseudo_read (struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buf) { const int num_regs = gdbarch_num_regs (gdbarch); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 177717f1bbd..7f88e8f5fdb 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -382,7 +382,7 @@ avr_write_pc (struct regcache *regcache, CORE_ADDR val) } static enum register_status -avr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +avr_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buf) { ULONGEST val; diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c index db8de822d99..63fbf6209e2 100644 --- a/gdb/bfin-tdep.c +++ b/gdb/bfin-tdep.c @@ -688,7 +688,7 @@ bfin_register_name (struct gdbarch *gdbarch, int i) } static enum register_status -bfin_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +bfin_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buffer) { gdb_byte buf[BFIN_MAX_REGISTER_SIZE]; diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index b6906fa495a..2f9a8d27c46 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -295,7 +295,7 @@ frv_register_type (struct gdbarch *gdbarch, int reg) } static enum register_status -frv_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +frv_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int reg, gdb_byte *buffer) { enum register_status status; diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index fe3c12e2959..705a6d36b0b 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -1971,7 +1971,7 @@ gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch) } enum register_status -gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf) +gdbarch_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->pseudo_register_read != NULL); @@ -1995,7 +1995,7 @@ gdbarch_pseudo_register_read_value_p (struct gdbarch *gdbarch) } struct value * -gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum) +gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->pseudo_register_read_value != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 5664c4dc585..249ad614fc8 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -265,8 +265,8 @@ extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_ extern int gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch); -typedef enum register_status (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf); -extern enum register_status gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf); +typedef enum register_status (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf); +extern enum register_status gdbarch_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf); extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype *pseudo_register_read); /* Read a register into a new struct value. If the register is wholly @@ -276,8 +276,8 @@ extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_p extern int gdbarch_pseudo_register_read_value_p (struct gdbarch *gdbarch); -typedef struct value * (gdbarch_pseudo_register_read_value_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum); -extern struct value * gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum); +typedef struct value * (gdbarch_pseudo_register_read_value_ftype) (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum); +extern struct value * gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum); extern void set_gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value); extern int gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index a929e13b812..8477dd7e91e 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -429,12 +429,12 @@ F;void;write_pc;struct regcache *regcache, CORE_ADDR val;regcache, val # serious shakedown. m;void;virtual_frame_pointer;CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset;pc, frame_regnum, frame_offset;0;legacy_virtual_frame_pointer;;0 # -M;enum register_status;pseudo_register_read;struct regcache *regcache, int cookednum, gdb_byte *buf;regcache, cookednum, buf +M;enum register_status;pseudo_register_read;readable_regcache *regcache, int cookednum, gdb_byte *buf;regcache, cookednum, buf # Read a register into a new struct value. If the register is wholly # or partly unavailable, this should call mark_value_bytes_unavailable # as appropriate. If this is defined, then pseudo_register_read will # never be called. -M;struct value *;pseudo_register_read_value;struct regcache *regcache, int cookednum;regcache, cookednum +M;struct value *;pseudo_register_read_value;readable_regcache *regcache, int cookednum;regcache, cookednum M;void;pseudo_register_write;struct regcache *regcache, int cookednum, const gdb_byte *buf;regcache, cookednum, buf # v;int;num_regs;;;0;-1 diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index bf5b9ec6583..55e77b6bb6e 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1160,7 +1160,7 @@ h8300_register_type (struct gdbarch *gdbarch, int regno) raw registers. These helpers extend/narrow the values. */ static enum register_status -pseudo_from_raw_register (struct gdbarch *gdbarch, struct regcache *regcache, +pseudo_from_raw_register (struct gdbarch *gdbarch, readable_regcache *regcache, gdb_byte *buf, int pseudo_regno, int raw_regno) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -1191,7 +1191,7 @@ raw_from_pseudo_register (struct gdbarch *gdbarch, struct regcache *regcache, static enum register_status h8300_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, int regno, + readable_regcache *regcache, int regno, gdb_byte *buf) { if (regno == E_PSEUDO_CCR_REGNUM (gdbarch)) diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 814b8a836e5..cc9434e14eb 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2747,7 +2747,7 @@ hppa_fetch_pointer_argument (struct frame_info *frame, int argi, } static enum register_status -hppa_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +hppa_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index cd56642c301..6b59278e226 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -3248,7 +3248,7 @@ i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum) the MMX registers need to be mapped onto floating point registers. */ static int -i386_mmx_regnum_to_fp_regnum (struct regcache *regcache, int regnum) +i386_mmx_regnum_to_fp_regnum (readable_regcache *regcache, int regnum) { struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); int mmxreg, fpreg; @@ -3269,7 +3269,7 @@ i386_mmx_regnum_to_fp_regnum (struct regcache *regcache, int regnum) void i386_pseudo_register_read_into_value (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum, struct value *result_value) { @@ -3448,7 +3448,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch, static struct value * i386_pseudo_register_read_value (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum) { struct value *result; diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index a71c103a881..81a93f11af5 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -364,7 +364,7 @@ extern struct type *i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum); extern void i386_pseudo_register_read_into_value (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum, struct value *result); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 18f517dfa1b..6c9b341af80 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -927,7 +927,7 @@ rse_address_add(CORE_ADDR addr, int nslots) } static enum register_status -ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 45dc4383fb2..173e8a41d19 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -51,7 +51,7 @@ typedef enum register_status (m32c_write_reg_t) (struct m32c_reg *reg, const gdb_byte *buf); typedef enum register_status (m32c_read_reg_t) (struct m32c_reg *reg, - struct regcache *cache, + readable_regcache *cache, gdb_byte *buf); struct m32c_reg @@ -310,7 +310,7 @@ static m32c_write_reg_t m32c_r3r2r1r0_write; /* Copy the value of the raw register REG from CACHE to BUF. */ static enum register_status -m32c_raw_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf) +m32c_raw_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf) { return cache->raw_read (reg->num, buf); } @@ -329,7 +329,7 @@ m32c_raw_write (struct m32c_reg *reg, struct regcache *cache, /* Return the value of the 'flg' register in CACHE. */ static int -m32c_read_flg (struct regcache *cache) +m32c_read_flg (readable_regcache *cache) { struct gdbarch_tdep *tdep = gdbarch_tdep (cache->arch ()); ULONGEST flg; @@ -341,7 +341,7 @@ m32c_read_flg (struct regcache *cache) /* Evaluate the real register number of a banked register. */ static struct m32c_reg * -m32c_banked_register (struct m32c_reg *reg, struct regcache *cache) +m32c_banked_register (struct m32c_reg *reg, readable_regcache *cache) { return ((m32c_read_flg (cache) & reg->n) ? reg->ry : reg->rx); } @@ -352,7 +352,7 @@ m32c_banked_register (struct m32c_reg *reg, struct regcache *cache) masked in REG->n set, then read REG->ry. Otherwise, read REG->rx. */ static enum register_status -m32c_banked_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf) +m32c_banked_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf) { struct m32c_reg *bank_reg = m32c_banked_register (reg, cache); return cache->raw_read (bank_reg->num, buf); @@ -377,7 +377,7 @@ m32c_banked_write (struct m32c_reg *reg, struct regcache *cache, /* Move the value of SB from CACHE to BUF. On bfd_mach_m32c, SB is a banked register; on bfd_mach_m16c, it's not. */ static enum register_status -m32c_sb_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf) +m32c_sb_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf) { if (gdbarch_bfd_arch_info (reg->arch)->mach == bfd_mach_m16c) return m32c_raw_read (reg->rx, cache, buf); @@ -442,7 +442,7 @@ m32c_find_part (struct m32c_reg *reg, int *offset_p, int *len_p) REG->type values, where higher indices refer to more significant bits, read the value of the REG->n'th element. */ static enum register_status -m32c_part_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf) +m32c_part_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf) { int offset, len; @@ -473,7 +473,7 @@ m32c_part_write (struct m32c_reg *reg, struct regcache *cache, concatenation of the values of the registers REG->rx and REG->ry, with REG->rx contributing the more significant bits. */ static enum register_status -m32c_cat_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf) +m32c_cat_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf) { int high_bytes = TYPE_LENGTH (reg->rx->type); int low_bytes = TYPE_LENGTH (reg->ry->type); @@ -528,7 +528,7 @@ m32c_cat_write (struct m32c_reg *reg, struct regcache *cache, the concatenation (from most significant to least) of r3, r2, r1, and r0. */ static enum register_status -m32c_r3r2r1r0_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf) +m32c_r3r2r1r0_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf) { struct gdbarch_tdep *tdep = gdbarch_tdep (reg->arch); int len = TYPE_LENGTH (tdep->r0->type); @@ -590,7 +590,7 @@ m32c_r3r2r1r0_write (struct m32c_reg *reg, struct regcache *cache, static enum register_status m32c_pseudo_register_read (struct gdbarch *arch, - struct regcache *cache, + readable_regcache *cache, int cookednum, gdb_byte *buf) { diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index b34548b310b..58ef4a32927 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -279,7 +279,7 @@ m68hc11_which_soft_register (CORE_ADDR addr) fetch into a memory read. */ static enum register_status m68hc11_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regno, gdb_byte *buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 7b1fb23fe05..1cda2b35af9 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1114,7 +1114,7 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr) static enum register_status mep_pseudo_cr32_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int cookednum, gdb_byte *buf) { @@ -1140,7 +1140,7 @@ mep_pseudo_cr32_read (struct gdbarch *gdbarch, static enum register_status mep_pseudo_cr64_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int cookednum, gdb_byte *buf) { @@ -1150,7 +1150,7 @@ mep_pseudo_cr64_read (struct gdbarch *gdbarch, static enum register_status mep_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int cookednum, gdb_byte *buf) { diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 6b780936aab..2c1a8f0d9e5 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -737,7 +737,7 @@ mips_tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regnum, registers. Take care of alignment and size problems. */ static enum register_status -mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +mips_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf) { int rawnum = cookednum % gdbarch_num_regs (gdbarch); diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index 4ae71f79b55..169b7e95058 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -218,7 +218,7 @@ msp430_register_reggroup_p (struct gdbarch *gdbarch, int regnum, static enum register_status msp430_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum, gdb_byte *buffer) { if (MSP430_NUM_REGS <= regnum && regnum < MSP430_NUM_TOTAL_REGS) diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index 73a71b92c0b..8cc9d5bc84c 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -437,7 +437,7 @@ nds32_pseudo_register_name (struct gdbarch *gdbarch, int regnum) static enum register_status nds32_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, int regnum, + readable_regcache *regcache, int regnum, gdb_byte *buf) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); diff --git a/gdb/regcache.c b/gdb/regcache.c index 8addc82c68c..ad5e0a24709 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -205,7 +205,7 @@ regcache::regcache (gdbarch *gdbarch, const address_space *aspace_, /* The register buffers. A read-only register cache can hold the full [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs) while a read/write register cache can only hold [0 .. gdbarch_num_regs). */ - : reg_buffer (gdbarch, readonly_p_), + : readable_regcache (gdbarch, readonly_p_), m_aspace (aspace_), m_readonly_p (readonly_p_) { m_ptid = minus_one_ptid; @@ -581,7 +581,7 @@ regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf) } enum register_status -regcache::raw_read (int regnum, gdb_byte *buf) +readable_regcache::raw_read (int regnum, gdb_byte *buf) { gdb_assert (buf != NULL); raw_update (regnum); @@ -604,7 +604,7 @@ regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val) template enum register_status -regcache::raw_read (int regnum, T *val) +readable_regcache::raw_read (int regnum, T *val) { gdb_byte *buf; enum register_status status; @@ -677,17 +677,15 @@ regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf) } enum register_status -regcache::cooked_read (int regnum, gdb_byte *buf) +readable_regcache::cooked_read (int regnum, gdb_byte *buf) { gdb_assert (regnum >= 0); gdb_assert (regnum < m_descr->nr_cooked_registers); if (regnum < num_raw_registers ()) return raw_read (regnum, buf); - else if (m_readonly_p + else if (m_has_pseudo && m_register_status[regnum] != REG_UNKNOWN) { - /* Read-only register cache, perhaps the cooked value was - cached? */ if (m_register_status[regnum] == REG_VALID) memcpy (buf, register_buffer (regnum), m_descr->sizeof_register[regnum]); @@ -730,13 +728,13 @@ regcache_cooked_read_value (struct regcache *regcache, int regnum) } struct value * -regcache::cooked_read_value (int regnum) +readable_regcache::cooked_read_value (int regnum) { gdb_assert (regnum >= 0); gdb_assert (regnum < m_descr->nr_cooked_registers); if (regnum < num_raw_registers () - || (m_readonly_p && m_register_status[regnum] != REG_UNKNOWN) + || (m_has_pseudo && m_register_status[regnum] != REG_UNKNOWN) || !gdbarch_pseudo_register_read_value_p (m_descr->gdbarch)) { struct value *result; @@ -770,7 +768,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum, template enum register_status -regcache::cooked_read (int regnum, T *val) +readable_regcache::cooked_read (int regnum, T *val) { enum register_status status; gdb_byte *buf; @@ -910,20 +908,49 @@ typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum, const void *buf); enum register_status -regcache::xfer_part (int regnum, int offset, int len, void *in, +readable_regcache::read_part (int regnum, int offset, int len, void *in, + bool is_raw) +{ + struct gdbarch *gdbarch = arch (); + gdb_byte *reg = (gdb_byte *) alloca (register_size (gdbarch, regnum)); + + gdb_assert (in != NULL); + gdb_assert (offset >= 0 && offset <= m_descr->sizeof_register[regnum]); + gdb_assert (len >= 0 && offset + len <= m_descr->sizeof_register[regnum]); + /* Something to do? */ + if (offset + len == 0) + return REG_VALID; + /* Read (when needed) ... */ + enum register_status status; + + if (is_raw) + status = raw_read (regnum, reg); + else + status = cooked_read (regnum, reg); + if (status != REG_VALID) + return status; + + /* ... modify ... */ + memcpy (in, reg + offset, len); + + return REG_VALID; +} + +enum register_status +regcache::write_part (int regnum, int offset, int len, const void *out, bool is_raw) { struct gdbarch *gdbarch = arch (); gdb_byte *reg = (gdb_byte *) alloca (register_size (gdbarch, regnum)); + gdb_assert (out != NULL); gdb_assert (offset >= 0 && offset <= m_descr->sizeof_register[regnum]); gdb_assert (len >= 0 && offset + len <= m_descr->sizeof_register[regnum]); /* Something to do? */ if (offset + len == 0) return REG_VALID; /* Read (when needed) ... */ - if (in != NULL - || offset > 0 + if (offset > 0 || offset + len < m_descr->sizeof_register[regnum]) { enum register_status status; @@ -935,19 +962,13 @@ regcache::xfer_part (int regnum, int offset, int len, void *in, if (status != REG_VALID) return status; } - /* ... modify ... */ - if (in != NULL) - memcpy (in, reg + offset, len); - if (out != NULL) - memcpy (reg + offset, out, len); + + memcpy (reg + offset, out, len); /* ... write (when needed). */ - if (out != NULL) - { - if (is_raw) - raw_write (regnum, reg); - else - cooked_write (regnum, reg); - } + if (is_raw) + raw_write (regnum, reg); + else + cooked_write (regnum, reg); return REG_VALID; } @@ -960,10 +981,10 @@ regcache_raw_read_part (struct regcache *regcache, int regnum, } enum register_status -regcache::raw_read_part (int regnum, int offset, int len, gdb_byte *buf) +readable_regcache::raw_read_part (int regnum, int offset, int len, gdb_byte *buf) { assert_regnum (regnum); - return xfer_part (regnum, offset, len, buf, NULL, true); + return read_part (regnum, offset, len, buf, true); } void @@ -978,7 +999,7 @@ regcache::raw_write_part (int regnum, int offset, int len, const gdb_byte *buf) { assert_regnum (regnum); - xfer_part (regnum, offset, len, NULL, buf, true); + write_part (regnum, offset, len, buf, true); } enum register_status @@ -990,10 +1011,11 @@ regcache_cooked_read_part (struct regcache *regcache, int regnum, enum register_status -regcache::cooked_read_part (int regnum, int offset, int len, gdb_byte *buf) +readable_regcache::cooked_read_part (int regnum, int offset, int len, + gdb_byte *buf) { gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers); - return xfer_part (regnum, offset, len, buf, NULL, false); + return read_part (regnum, offset, len, buf, false); } void @@ -1008,7 +1030,7 @@ regcache::cooked_write_part (int regnum, int offset, int len, const gdb_byte *buf) { gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers); - xfer_part (regnum, offset, len, NULL, buf, false); + write_part (regnum, offset, len, buf, false); } /* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */ diff --git a/gdb/regcache.h b/gdb/regcache.h index e2c762119d3..1c7ee8cdc33 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -262,9 +262,41 @@ protected: signed char *m_register_status; }; +/* An abstract class which only has methods doing read. */ + +class readable_regcache : public reg_buffer +{ +public: + readable_regcache (gdbarch *gdbarch, bool has_pseudo) + : reg_buffer (gdbarch, has_pseudo) + {} + + enum register_status raw_read (int regnum, gdb_byte *buf); + template> + enum register_status raw_read (int regnum, T *val); + + enum register_status raw_read_part (int regnum, int offset, int len, + gdb_byte *buf); + + virtual void raw_update (int regnum) = 0; + + enum register_status cooked_read (int regnum, gdb_byte *buf); + template> + enum register_status cooked_read (int regnum, T *val); + + enum register_status cooked_read_part (int regnum, int offset, int len, + gdb_byte *buf); + + struct value *cooked_read_value (int regnum); + +protected: + enum register_status read_part (int regnum, int offset, int len, void *in, + bool is_raw); +}; + /* The register cache for storing raw register values. */ -class regcache : public reg_buffer +class regcache : public readable_regcache { public: regcache (gdbarch *gdbarch) @@ -287,28 +319,17 @@ public: void save (regcache_cooked_read_ftype *cooked_read, void *src); - enum register_status cooked_read (int regnum, gdb_byte *buf); void cooked_write (int regnum, const gdb_byte *buf); - enum register_status raw_read (int regnum, gdb_byte *buf); - void raw_write (int regnum, const gdb_byte *buf); - template> - enum register_status raw_read (int regnum, T *val); - template> void raw_write (int regnum, T val); - struct value *cooked_read_value (int regnum); - - template> - enum register_status cooked_read (int regnum, T *val); - template> void cooked_write (int regnum, T val); - void raw_update (int regnum); + void raw_update (int regnum) override; void raw_collect (int regnum, void *buf) const; @@ -328,14 +349,8 @@ public: void invalidate (int regnum); - enum register_status raw_read_part (int regnum, int offset, int len, - gdb_byte *buf); - void raw_write_part (int regnum, int offset, int len, const gdb_byte *buf); - enum register_status cooked_read_part (int regnum, int offset, int len, - gdb_byte *buf); - void cooked_write_part (int regnum, int offset, int len, const gdb_byte *buf); @@ -370,14 +385,15 @@ protected: private: void restore (struct regcache *src); - enum register_status xfer_part (int regnum, int offset, int len, void *in, - const void *out, bool is_raw); - 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); + + /* The address space of this register cache (for registers where it makes sense, like PC or SP). */ const address_space * const m_aspace; diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index 55653dbdc27..af6a0896082 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -640,7 +640,7 @@ rl78_make_data_address (CORE_ADDR addr) static enum register_status rl78_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int reg, gdb_byte *buffer) { enum register_status status; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 70dc55fb510..a5b70917b7e 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2705,12 +2705,6 @@ e500_move_ev_register (move_ev_register_func move, return status; } -static enum register_status -do_regcache_raw_read (struct regcache *regcache, int regnum, void *buffer) -{ - return regcache_raw_read (regcache, regnum, (gdb_byte *) buffer); -} - static enum register_status do_regcache_raw_write (struct regcache *regcache, int regnum, void *buffer) { @@ -2720,10 +2714,36 @@ do_regcache_raw_write (struct regcache *regcache, int regnum, void *buffer) } static enum register_status -e500_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, - int reg_nr, gdb_byte *buffer) +e500_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, + int ev_reg, gdb_byte *buffer) { - return e500_move_ev_register (do_regcache_raw_read, regcache, reg_nr, buffer); + struct gdbarch *arch = regcache->arch (); + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + int reg_index; + enum register_status status; + + gdb_assert (IS_SPE_PSEUDOREG (tdep, ev_reg)); + + reg_index = ev_reg - tdep->ppc_ev0_regnum; + + if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG) + { + status = regcache->raw_read (tdep->ppc_ev0_upper_regnum + reg_index, + buffer); + if (status == REG_VALID) + status = regcache->raw_read (tdep->ppc_gp0_regnum + reg_index, + buffer + 4); + } + else + { + status = regcache->raw_read (tdep->ppc_gp0_regnum + reg_index, buffer); + if (status == REG_VALID) + status = regcache->raw_read (tdep->ppc_ev0_upper_regnum + reg_index, + buffer + 4); + } + + return status; + } static void @@ -2736,7 +2756,7 @@ e500_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* Read method for DFP pseudo-registers. */ static enum register_status -dfp_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +dfp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int reg_nr, gdb_byte *buffer) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -2792,7 +2812,7 @@ dfp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* Read method for POWER7 VSX pseudo-registers. */ static enum register_status -vsx_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +vsx_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int reg_nr, gdb_byte *buffer) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -2857,7 +2877,7 @@ vsx_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* Read method for POWER7 Extended FP pseudo-registers. */ static enum register_status -efpr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +efpr_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int reg_nr, gdb_byte *buffer) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -2865,9 +2885,9 @@ efpr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8; /* Read the portion that overlaps the VMX register. */ - return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index, - offset, register_size (gdbarch, reg_nr), - buffer); + return regcache->raw_read_part (tdep->ppc_vr0_regnum + reg_index, + offset, register_size (gdbarch, reg_nr), + buffer); } /* Write method for POWER7 Extended FP pseudo-registers. */ @@ -2887,7 +2907,7 @@ efpr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, static enum register_status rs6000_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int reg_nr, gdb_byte *buffer) { struct gdbarch *regcache_arch = regcache->arch (); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 9626e050e47..408bb875d20 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1281,7 +1281,7 @@ s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum) /* Implement pseudo_register_read gdbarch method. */ static enum register_status -s390_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +s390_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buf) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index a82c5b3f5bf..75ea673b82a 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1628,7 +1628,7 @@ dr_reg_base_num (struct gdbarch *gdbarch, int dr_regnum) static enum register_status pseudo_register_read_portions (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int portions, int base_regnum, gdb_byte *buffer) { @@ -1649,7 +1649,7 @@ pseudo_register_read_portions (struct gdbarch *gdbarch, } static enum register_status -sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +sh_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int reg_nr, gdb_byte *buffer) { int base_regnum; diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 5da517a4f12..8eb88eb3adf 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -1504,7 +1504,7 @@ sh64_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, static enum register_status pseudo_register_read_portions (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int portions, int base_regnum, gdb_byte *buffer) { @@ -1525,7 +1525,7 @@ pseudo_register_read_portions (struct gdbarch *gdbarch, } static enum register_status -sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +sh64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int reg_nr, gdb_byte *buffer) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 1ce7ee0e544..633bd685bce 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -503,7 +503,7 @@ sparc32_register_type (struct gdbarch *gdbarch, int regnum) static enum register_status sparc32_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum, gdb_byte *buf) { enum register_status status; diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 67103cc2ecb..6f3ca198b3e 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -899,7 +899,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum) static enum register_status sparc64_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum, gdb_byte *buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index f2f4f656479..da7b93764d2 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -182,7 +182,7 @@ spu_register_type (struct gdbarch *gdbarch, int reg_nr) /* Pseudo registers for preferred slots - stack pointer. */ static enum register_status -spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname, +spu_pseudo_register_read_spu (readable_regcache *regcache, const char *regname, gdb_byte *buf) { struct gdbarch *gdbarch = regcache->arch (); @@ -207,7 +207,7 @@ spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname, } static enum register_status -spu_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, +spu_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buf) { gdb_byte reg[16]; diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 6eb6fd3f185..a1ecf5f56a4 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -453,7 +453,7 @@ xtensa_register_write_masked (struct regcache *regcache, of the registers and assemble them into a single value. */ static enum register_status -xtensa_register_read_masked (struct regcache *regcache, +xtensa_register_read_masked (readable_regcache *regcache, xtensa_register_t *reg, gdb_byte *buffer) { unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4]; @@ -547,7 +547,7 @@ xtensa_register_read_masked (struct regcache *regcache, static enum register_status xtensa_pseudo_register_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum, gdb_byte *buffer) {