From 10eaee5f56611ce5f92ccd305849c0cc6addd130 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 30 May 2018 14:54:37 -0400 Subject: [PATCH] Remove regcache_raw_write Remove regcache_raw_write, update all callers to use regcache::raw_write instead. gdb/ChangeLog: * regcache.h (regcache_raw_write): Remove, update callers to use regcache::raw_write instead. * regcache.c (regcache_raw_write): Remove. --- gdb/ChangeLog | 6 +++++ gdb/aarch64-tdep.c | 10 +++---- gdb/amd64-tdep.c | 11 ++++---- gdb/arm-tdep.c | 6 ++--- gdb/bfin-tdep.c | 2 +- gdb/frv-tdep.c | 6 ++--- gdb/h8300-tdep.c | 2 +- gdb/i386-darwin-tdep.c | 3 +-- gdb/i386-tdep.c | 59 +++++++++++++----------------------------- gdb/i387-tdep.c | 2 +- gdb/iq2000-tdep.c | 8 +++--- gdb/m32c-tdep.c | 4 +-- gdb/m68hc11-tdep.c | 2 +- gdb/m68k-tdep.c | 8 +++--- gdb/mep-tdep.c | 6 ++--- gdb/mips-tdep.c | 2 +- gdb/mn10300-tdep.c | 2 +- gdb/nds32-tdep.c | 2 +- gdb/regcache.c | 8 ------ gdb/regcache.h | 8 +++--- gdb/rl78-tdep.c | 22 ++++++++-------- gdb/rs6000-tdep.c | 20 +++++++------- gdb/s390-tdep.c | 4 +-- gdb/sh-tdep.c | 12 ++++----- gdb/sparc-tdep.c | 4 +-- gdb/sparc64-tdep.c | 18 ++++++------- gdb/spu-tdep.c | 2 +- gdb/tilegx-tdep.c | 4 +-- gdb/v850-tdep.c | 2 +- gdb/xstormy16-tdep.c | 4 +-- gdb/xtensa-tdep.c | 6 ++--- 31 files changed, 113 insertions(+), 142 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4b7bfada9dc..7142237acea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-05-30 Simon Marchi + + * regcache.h (regcache_raw_write): Remove, update callers to use + regcache::raw_write instead. + * regcache.c (regcache_raw_write): Remove. + 2018-05-30 Simon Marchi * regcache.h (regcache_raw_read): Remove, update callers to use diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index c5ed80cdbe7..8e16e3df8c8 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2342,7 +2342,7 @@ aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache, v_regnum = AARCH64_V0_REGNUM + regnum - AARCH64_Q0_REGNUM; memcpy (reg_buf, buf, Q_REGISTER_SIZE); - regcache_raw_write (regcache, v_regnum, reg_buf); + regcache->raw_write (v_regnum, reg_buf); return; } @@ -2353,7 +2353,7 @@ aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache, v_regnum = AARCH64_V0_REGNUM + regnum - AARCH64_D0_REGNUM; memcpy (reg_buf, buf, D_REGISTER_SIZE); - regcache_raw_write (regcache, v_regnum, reg_buf); + regcache->raw_write (v_regnum, reg_buf); return; } @@ -2363,7 +2363,7 @@ aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache, v_regnum = AARCH64_V0_REGNUM + regnum - AARCH64_S0_REGNUM; memcpy (reg_buf, buf, S_REGISTER_SIZE); - regcache_raw_write (regcache, v_regnum, reg_buf); + regcache->raw_write (v_regnum, reg_buf); return; } @@ -2374,7 +2374,7 @@ aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache, v_regnum = AARCH64_V0_REGNUM + regnum - AARCH64_H0_REGNUM; memcpy (reg_buf, buf, H_REGISTER_SIZE); - regcache_raw_write (regcache, v_regnum, reg_buf); + regcache->raw_write (v_regnum, reg_buf); return; } @@ -2385,7 +2385,7 @@ aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache, v_regnum = AARCH64_V0_REGNUM + regnum - AARCH64_B0_REGNUM; memcpy (reg_buf, buf, B_REGISTER_SIZE); - regcache_raw_write (regcache, v_regnum, reg_buf); + regcache->raw_write (v_regnum, reg_buf); return; } diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 0eac35e536b..597bb0f737b 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -426,8 +426,7 @@ amd64_pseudo_register_write (struct gdbarch *gdbarch, /* ... Modify ... (always little endian). */ memcpy (raw_buf + 1, buf, 1); /* ... Write. */ - regcache_raw_write (regcache, - gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf); + regcache->raw_write (gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf); } else { @@ -436,7 +435,7 @@ amd64_pseudo_register_write (struct gdbarch *gdbarch, /* ... Modify ... (always little endian). */ memcpy (raw_buf, buf, 1); /* ... Write. */ - regcache_raw_write (regcache, gpnum, raw_buf); + regcache->raw_write (gpnum, raw_buf); } } else if (i386_dword_regnum_p (gdbarch, regnum)) @@ -448,7 +447,7 @@ amd64_pseudo_register_write (struct gdbarch *gdbarch, /* ... Modify ... (always little endian). */ memcpy (raw_buf, buf, 4); /* ... Write. */ - regcache_raw_write (regcache, gpnum, raw_buf); + regcache->raw_write (gpnum, raw_buf); } else i386_pseudo_register_write (gdbarch, regcache, regnum, buf); @@ -777,8 +776,8 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function, if (writebuf) { i387_return_value (gdbarch, regcache); - regcache_raw_write (regcache, AMD64_ST0_REGNUM, writebuf); - regcache_raw_write (regcache, AMD64_ST1_REGNUM, writebuf + 16); + regcache->raw_write (AMD64_ST0_REGNUM, writebuf); + regcache->raw_write (AMD64_ST1_REGNUM, writebuf + 16); /* Fix up the tag word such that both %st(0) and %st(1) are marked as valid. */ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 7fa0db38e1c..4eeb6ea0b7f 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -8765,9 +8765,9 @@ arm_neon_quad_write (struct gdbarch *gdbarch, struct regcache *regcache, else offset = 0; - regcache_raw_write (regcache, double_regnum, buf + offset); + regcache->raw_write (double_regnum, buf + offset); offset = 8 - offset; - regcache_raw_write (regcache, double_regnum + 1, buf + offset); + regcache->raw_write (double_regnum + 1, buf + offset); } static void @@ -8802,7 +8802,7 @@ arm_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache, regcache->raw_read (double_regnum, reg_buf); memcpy (reg_buf + offset, buf, 4); - regcache_raw_write (regcache, double_regnum, reg_buf); + regcache->raw_write (double_regnum, reg_buf); } } diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c index 66a94653791..a2b3464b347 100644 --- a/gdb/bfin-tdep.c +++ b/gdb/bfin-tdep.c @@ -721,7 +721,7 @@ bfin_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* Overlay the CC bit in the ASTAT register. */ regcache->raw_read (BFIN_ASTAT_REGNUM, buf); buf[0] = (buf[0] & ~ASTAT_CC) | ((buffer[0] & 1) << ASTAT_CC_POS); - regcache_raw_write (regcache, BFIN_ASTAT_REGNUM, buf); + regcache->raw_write (BFIN_ASTAT_REGNUM, buf); } static CORE_ADDR diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 04bb43ba016..7adffc479bb 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -337,8 +337,8 @@ frv_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, { if (reg == iacc0_regnum) { - regcache_raw_write (regcache, iacc0h_regnum, buffer); - regcache_raw_write (regcache, iacc0l_regnum, (bfd_byte *) buffer + 4); + regcache->raw_write (iacc0h_regnum, buffer); + regcache->raw_write (iacc0l_regnum, (bfd_byte *) buffer + 4); } else if (accg0_regnum <= reg && reg <= accg7_regnum) { @@ -351,7 +351,7 @@ frv_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, regcache->raw_read (raw_regnum, buf); buf[byte_num] = ((bfd_byte *) buffer)[0]; - regcache_raw_write (regcache, raw_regnum, buf); + regcache->raw_write (raw_regnum, buf); } } diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 55e77b6bb6e..65d33620c6a 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1218,7 +1218,7 @@ h8300_pseudo_register_write (struct gdbarch *gdbarch, else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch)) raw_from_pseudo_register (gdbarch, regcache, buf, E_EXR_REGNUM, regno); else - regcache_raw_write (regcache, regno, buf); + regcache->raw_write (regno, buf); } static int diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c index 7ee2f4cf2ac..21f0a4c6083 100644 --- a/gdb/i386-darwin-tdep.c +++ b/gdb/i386-darwin-tdep.c @@ -189,8 +189,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (write_pass) { const gdb_byte *val = value_contents_all (args[i]); - regcache_raw_write - (regcache, I387_MM0_REGNUM(tdep) + num_m128, val); + regcache->raw_write (I387_MM0_REGNUM(tdep) + num_m128, val); } num_m128++; } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 0a4e4d7c1ca..353fb894a03 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2859,7 +2859,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type, not exactly how it would happen on the target itself, but it is the best we can do. */ target_float_convert (valbuf, type, buf, i387_ext_type (gdbarch)); - regcache_raw_write (regcache, I386_ST0_REGNUM, buf); + regcache->raw_write (I386_ST0_REGNUM, buf); /* Set the top of the floating-point register stack to 7. The actual value doesn't really matter, but 7 is what a normal @@ -2883,7 +2883,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type, regcache_raw_write_part (regcache, LOW_RETURN_REGNUM, 0, len, valbuf); else if (len <= (low_size + high_size)) { - regcache_raw_write (regcache, LOW_RETURN_REGNUM, valbuf); + regcache->raw_write (LOW_RETURN_REGNUM, valbuf); regcache_raw_write_part (regcache, HIGH_RETURN_REGNUM, 0, len - low_size, valbuf + low_size); } @@ -3478,7 +3478,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* ... Modify ... (always little endian). */ memcpy (raw_buf, buf, register_size (gdbarch, regnum)); /* ... Write. */ - regcache_raw_write (regcache, fpnum, raw_buf); + regcache->raw_write (fpnum, raw_buf); } else { @@ -3505,18 +3505,13 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, memcpy (raw_buf, &lower, 8); memcpy (raw_buf + 8, &upper, 8); - - regcache_raw_write (regcache, - I387_BND0R_REGNUM (tdep) + regnum, - raw_buf); + regcache->raw_write (I387_BND0R_REGNUM (tdep) + regnum, raw_buf); } else if (i386_k_regnum_p (gdbarch, regnum)) { regnum -= tdep->k0_regnum; - regcache_raw_write (regcache, - tdep->k0_regnum + regnum, - buf); + regcache->raw_write (tdep->k0_regnum + regnum, buf); } else if (i386_zmm_regnum_p (gdbarch, regnum)) { @@ -3525,57 +3520,39 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, if (regnum < num_lower_zmm_regs) { /* Write lower 128bits. */ - regcache_raw_write (regcache, - I387_XMM0_REGNUM (tdep) + regnum, - buf); + regcache->raw_write (I387_XMM0_REGNUM (tdep) + regnum, buf); /* Write upper 128bits. */ - regcache_raw_write (regcache, - I387_YMM0_REGNUM (tdep) + regnum, - buf + 16); + regcache->raw_write (I387_YMM0_REGNUM (tdep) + regnum, buf + 16); } else { /* Write lower 128bits. */ - regcache_raw_write (regcache, - I387_XMM16_REGNUM (tdep) + regnum - - num_lower_zmm_regs, - buf); + regcache->raw_write (I387_XMM16_REGNUM (tdep) + regnum + - num_lower_zmm_regs, buf); /* Write upper 128bits. */ - regcache_raw_write (regcache, - I387_YMM16H_REGNUM (tdep) + regnum - - num_lower_zmm_regs, - buf + 16); + regcache->raw_write (I387_YMM16H_REGNUM (tdep) + regnum + - num_lower_zmm_regs, buf + 16); } /* Write upper 256bits. */ - regcache_raw_write (regcache, - tdep->zmm0h_regnum + regnum, - buf + 32); + regcache->raw_write (tdep->zmm0h_regnum + regnum, buf + 32); } else if (i386_ymm_regnum_p (gdbarch, regnum)) { regnum -= tdep->ymm0_regnum; /* ... Write lower 128bits. */ - regcache_raw_write (regcache, - I387_XMM0_REGNUM (tdep) + regnum, - buf); + regcache->raw_write (I387_XMM0_REGNUM (tdep) + regnum, buf); /* ... Write upper 128bits. */ - regcache_raw_write (regcache, - tdep->ymm0h_regnum + regnum, - buf + 16); + regcache->raw_write (tdep->ymm0h_regnum + regnum, buf + 16); } else if (i386_ymm_avx512_regnum_p (gdbarch, regnum)) { regnum -= tdep->ymm16_regnum; /* ... Write lower 128bits. */ - regcache_raw_write (regcache, - I387_XMM16_REGNUM (tdep) + regnum, - buf); + regcache->raw_write (I387_XMM16_REGNUM (tdep) + regnum, buf); /* ... Write upper 128bits. */ - regcache_raw_write (regcache, - tdep->ymm16h_regnum + regnum, - buf + 16); + regcache->raw_write (tdep->ymm16h_regnum + regnum, buf + 16); } else if (i386_word_regnum_p (gdbarch, regnum)) { @@ -3586,7 +3563,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* ... Modify ... (always little endian). */ memcpy (raw_buf, buf, 2); /* ... Write. */ - regcache_raw_write (regcache, gpnum, raw_buf); + regcache->raw_write (gpnum, raw_buf); } else if (i386_byte_regnum_p (gdbarch, regnum)) { @@ -3600,7 +3577,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, else memcpy (raw_buf, buf, 1); /* ... Write. */ - regcache_raw_write (regcache, gpnum % 4, raw_buf); + regcache->raw_write (gpnum % 4, raw_buf); } else internal_error (__FILE__, __LINE__, _("invalid regnum")); diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index fdd83f109ef..b465fda5afb 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -1962,6 +1962,6 @@ i387_reset_bnd_regs (struct gdbarch *gdbarch, struct regcache *regcache) memset (bnd_buf, 0, 16); for (int i = 0; i < I387_NUM_BND_REGS; i++) - regcache_raw_write (regcache, I387_BND0R_REGNUM (tdep) + i, bnd_buf); + regcache->raw_write (I387_BND0R_REGNUM (tdep) + i, bnd_buf); } } diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c index f8e2f234e02..9f7f35d287c 100644 --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c @@ -510,7 +510,7 @@ iq2000_store_return_value (struct type *type, struct regcache *regcache, memset (buf, 0, 4); memcpy (buf + 4 - size, valbuf, size); - regcache_raw_write (regcache, regno++, buf); + regcache->raw_write (regno++, buf); len -= size; valbuf = ((char *) valbuf) + size; } @@ -737,7 +737,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (argreg <= E_LAST_ARGREG) { /* Passed in a register. */ - regcache_raw_write (regcache, argreg++, buf); + regcache->raw_write (argreg++, buf); } else { @@ -756,8 +756,8 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, (must start with an even-numbered reg). */ if (((argreg - E_1ST_ARGREG) % 2) != 0) argreg++; - regcache_raw_write (regcache, argreg++, val); - regcache_raw_write (regcache, argreg++, val + 4); + regcache->raw_write (argreg++, val); + regcache->raw_write (argreg++, val + 4); } else { diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 173e8a41d19..2825efbb9cc 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -321,7 +321,7 @@ static enum register_status m32c_raw_write (struct m32c_reg *reg, struct regcache *cache, const gdb_byte *buf) { - regcache_raw_write (cache, reg->num, buf); + cache->raw_write (reg->num, buf); return REG_VALID; } @@ -368,7 +368,7 @@ m32c_banked_write (struct m32c_reg *reg, struct regcache *cache, const gdb_byte *buf) { struct m32c_reg *bank_reg = m32c_banked_register (reg, cache); - regcache_raw_write (cache, bank_reg->num, buf); + cache->raw_write (bank_reg->num, buf); return REG_VALID; } diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index bce95e9c68c..064bf5e5658 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1264,7 +1264,7 @@ m68hc11_store_return_value (struct type *type, struct regcache *regcache, { regcache_raw_write_part (regcache, HARD_X_REGNUM, 4 - len, len - 2, valbuf); - regcache_raw_write (regcache, HARD_D_REGNUM, valbuf + (len - 2)); + regcache->raw_write (HARD_D_REGNUM, valbuf + (len - 2)); } else error (_("return of value > 4 is not supported.")); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index a6a1bb498b2..31c27714cbf 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -334,7 +334,7 @@ m68k_store_return_value (struct type *type, struct regcache *regcache, { regcache_raw_write_part (regcache, M68K_D0_REGNUM, 8 - len, len - 4, valbuf); - regcache_raw_write (regcache, M68K_D1_REGNUM, valbuf + (len - 4)); + regcache->raw_write (M68K_D1_REGNUM, valbuf + (len - 4)); } else internal_error (__FILE__, __LINE__, @@ -353,12 +353,12 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM); gdb_byte buf[M68K_MAX_REGISTER_SIZE]; target_float_convert (valbuf, type, buf, fpreg_type); - regcache_raw_write (regcache, M68K_FP0_REGNUM, buf); + regcache->raw_write (M68K_FP0_REGNUM, buf); } else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) { - regcache_raw_write (regcache, M68K_A0_REGNUM, valbuf); - regcache_raw_write (regcache, M68K_D0_REGNUM, valbuf); + regcache->raw_write (M68K_A0_REGNUM, valbuf); + regcache->raw_write (M68K_D0_REGNUM, valbuf); } else m68k_store_return_value (type, regcache, valbuf); diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 0e8c3f97e22..727d24751bb 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1216,7 +1216,7 @@ mep_pseudo_cr32_write (struct gdbarch *gdbarch, /* Slow, but legible. */ store_unsigned_integer (buf64, 8, byte_order, extract_unsigned_integer (buf, 4, byte_order)); - regcache_raw_write (regcache, rawnum, buf64); + regcache->raw_write (rawnum, buf64); } @@ -1226,7 +1226,7 @@ mep_pseudo_cr64_write (struct gdbarch *gdbarch, int cookednum, const gdb_byte *buf) { - regcache_raw_write (regcache, mep_pseudo_to_raw[cookednum], buf); + regcache->raw_write (mep_pseudo_to_raw[cookednum], buf); } @@ -1245,7 +1245,7 @@ mep_pseudo_register_write (struct gdbarch *gdbarch, || IS_FP_CR64_REGNUM (cookednum)) mep_pseudo_cr64_write (gdbarch, regcache, cookednum, buf); else if (IS_CCR_REGNUM (cookednum)) - regcache_raw_write (regcache, mep_pseudo_to_raw[cookednum], buf); + regcache->raw_write (mep_pseudo_to_raw[cookednum], buf); else gdb_assert_not_reached ("unexpected pseudo register"); } diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index cc67cd3bddd..926b084fc1e 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -775,7 +775,7 @@ mips_pseudo_register_write (struct gdbarch *gdbarch, gdb_assert (cookednum >= gdbarch_num_regs (gdbarch) && cookednum < 2 * gdbarch_num_regs (gdbarch)); if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum)) - regcache_raw_write (regcache, rawnum, buf); + regcache->raw_write (rawnum, buf); else if (register_size (gdbarch, rawnum) > register_size (gdbarch, cookednum)) { diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index c8267cfd286..caaf8d4581f 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -185,7 +185,7 @@ mn10300_store_return_value (struct gdbarch *gdbarch, struct type *type, regcache_raw_write_part (regcache, reg, 0, len, valbuf); else if (len <= 2 * regsz) { - regcache_raw_write (regcache, reg, valbuf); + regcache->raw_write (reg, valbuf); gdb_assert (regsz == register_size (gdbarch, reg + 1)); regcache_raw_write_part (regcache, reg+1, 0, len - regsz, valbuf + regsz); diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index 991a870c746..14b091c0b59 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -502,7 +502,7 @@ nds32_pseudo_register_write (struct gdbarch *gdbarch, fdr_regnum = NDS32_FD0_REGNUM + (regnum >> 1); regcache->raw_read (fdr_regnum, reg_buf); memcpy (reg_buf + offset, buf, 4); - regcache_raw_write (regcache, fdr_regnum, reg_buf); + regcache->raw_write (fdr_regnum, reg_buf); return; } diff --git a/gdb/regcache.c b/gdb/regcache.c index 555140879c7..470042c7dac 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -751,14 +751,6 @@ regcache_cooked_write_unsigned (struct regcache *regcache, int regnum, regcache->cooked_write (regnum, val); } -void -regcache_raw_write (struct regcache *regcache, int regnum, - const gdb_byte *buf) -{ - gdb_assert (regcache != NULL && buf != NULL); - regcache->raw_write (regnum, buf); -} - void regcache::raw_write (int regnum, const gdb_byte *buf) { diff --git a/gdb/regcache.h b/gdb/regcache.h index 37358522db5..e9cbcbea5b5 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -35,11 +35,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t, struct gdbarch *, struct address_space *); -/* Transfer a raw register [0..NUM_REGS) between core-gdb and the - regcache. The read variants return the status of the register. */ - -void regcache_raw_write (struct regcache *regcache, int rawnum, - const gdb_byte *buf); extern enum register_status regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val); @@ -323,6 +318,9 @@ public: void cooked_write (int regnum, const gdb_byte *buf); + /* Update the value of raw register REGNUM (in the range [0..NUM_REGS)) and + transfer its value to core-gdb. */ + void raw_write (int regnum, const gdb_byte *buf); template> diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index af6a0896082..ace01b1171a 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -730,28 +730,28 @@ rl78_pseudo_register_write (struct gdbarch *gdbarch, int raw_regnum = RL78_RAW_BANK0_R0_REGNUM + (reg - RL78_BANK0_R0_REGNUM); - regcache_raw_write (regcache, raw_regnum, buffer); + regcache->raw_write (raw_regnum, buffer); } else if (RL78_BANK0_RP0_REGNUM <= reg && reg <= RL78_BANK3_RP3_REGNUM) { int raw_regnum = 2 * (reg - RL78_BANK0_RP0_REGNUM) + RL78_RAW_BANK0_R0_REGNUM; - regcache_raw_write (regcache, raw_regnum, buffer); - regcache_raw_write (regcache, raw_regnum + 1, buffer + 1); + regcache->raw_write (raw_regnum, buffer); + regcache->raw_write (raw_regnum + 1, buffer + 1); } else if (RL78_BANK0_RP0_PTR_REGNUM <= reg && reg <= RL78_BANK3_RP3_PTR_REGNUM) { int raw_regnum = 2 * (reg - RL78_BANK0_RP0_PTR_REGNUM) + RL78_RAW_BANK0_R0_REGNUM; - regcache_raw_write (regcache, raw_regnum, buffer); - regcache_raw_write (regcache, raw_regnum + 1, buffer + 1); + regcache->raw_write (raw_regnum, buffer); + regcache->raw_write (raw_regnum + 1, buffer + 1); } else if (reg == RL78_SP_REGNUM) { - regcache_raw_write (regcache, RL78_SPL_REGNUM, buffer); - regcache_raw_write (regcache, RL78_SPH_REGNUM, buffer + 1); + regcache->raw_write (RL78_SPL_REGNUM, buffer); + regcache->raw_write (RL78_SPH_REGNUM, buffer + 1); } else if (reg == RL78_PC_REGNUM) { @@ -759,7 +759,7 @@ rl78_pseudo_register_write (struct gdbarch *gdbarch, memcpy (rawbuf, buffer, 3); rawbuf[3] = 0; - regcache_raw_write (regcache, RL78_RAW_PC_REGNUM, rawbuf); + regcache->raw_write (RL78_RAW_PC_REGNUM, rawbuf); } else if (RL78_X_REGNUM <= reg && reg <= RL78_H_REGNUM) { @@ -772,7 +772,7 @@ rl78_pseudo_register_write (struct gdbarch *gdbarch, /* RSB0 is at bit 3; RSBS1 is at bit 5. */ raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK + (reg - RL78_X_REGNUM); - regcache_raw_write (regcache, raw_regnum, buffer); + regcache->raw_write (raw_regnum, buffer); } else if (RL78_AX_REGNUM <= reg && reg <= RL78_HL_REGNUM) { @@ -784,8 +784,8 @@ rl78_pseudo_register_write (struct gdbarch *gdbarch, /* RSB0 is at bit 3; RSBS1 is at bit 5. */ raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK + 2 * (reg - RL78_AX_REGNUM); - regcache_raw_write (regcache, raw_regnum, buffer); - regcache_raw_write (regcache, raw_regnum + 1, buffer + 1); + regcache->raw_write (raw_regnum, buffer); + regcache->raw_write (raw_regnum + 1, buffer + 1); } else gdb_assert_not_reached ("invalid pseudo register number"); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index ff4699c1918..594f3c41ef8 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2552,7 +2552,7 @@ e500_move_ev_register (move_ev_register_func move, static enum register_status do_regcache_raw_write (struct regcache *regcache, int regnum, void *buffer) { - regcache_raw_write (regcache, regnum, (const gdb_byte *) buffer); + regcache->raw_write (regnum, (const gdb_byte *) buffer); return REG_VALID; } @@ -2640,16 +2640,16 @@ dfp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, { /* Write each half of the dl register into a separate FP register. */ - regcache_raw_write (regcache, tdep->ppc_fp0_regnum + + regcache->raw_write (tdep->ppc_fp0_regnum + 2 * reg_index, buffer); - regcache_raw_write (regcache, tdep->ppc_fp0_regnum + + regcache->raw_write (tdep->ppc_fp0_regnum + 2 * reg_index + 1, buffer + 8); } else { - regcache_raw_write (regcache, tdep->ppc_fp0_regnum + + regcache->raw_write (tdep->ppc_fp0_regnum + 2 * reg_index + 1, buffer); - regcache_raw_write (regcache, tdep->ppc_fp0_regnum + + regcache->raw_write (tdep->ppc_fp0_regnum + 2 * reg_index, buffer + 8); } } @@ -2699,22 +2699,22 @@ vsx_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* Write the portion that overlaps the VMX registers. */ if (reg_index > 31) - regcache_raw_write (regcache, tdep->ppc_vr0_regnum + + regcache->raw_write (tdep->ppc_vr0_regnum + reg_index - 32, buffer); else /* Write the portion that overlaps the FPR registers. */ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) { - regcache_raw_write (regcache, tdep->ppc_fp0_regnum + + regcache->raw_write (tdep->ppc_fp0_regnum + reg_index, buffer); - regcache_raw_write (regcache, tdep->ppc_vsr0_upper_regnum + + regcache->raw_write (tdep->ppc_vsr0_upper_regnum + reg_index, buffer + 8); } else { - regcache_raw_write (regcache, tdep->ppc_fp0_regnum + + regcache->raw_write (tdep->ppc_fp0_regnum + reg_index, buffer + 8); - regcache_raw_write (regcache, tdep->ppc_vsr0_upper_regnum + + regcache->raw_write (tdep->ppc_vsr0_upper_regnum + reg_index, buffer); } } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index aecdbbdf9c1..bbf696ed9d3 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1402,8 +1402,8 @@ s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, if (regnum_is_vxr_full (tdep, regnum)) { regnum -= tdep->v0_full_regnum; - regcache_raw_write (regcache, S390_F0_REGNUM + regnum, buf); - regcache_raw_write (regcache, S390_V0_LOWER_REGNUM + regnum, buf + 8); + regcache->raw_write (S390_F0_REGNUM + regnum, buf); + regcache->raw_write (S390_V0_LOWER_REGNUM + regnum, buf + 8); return; } diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index c9439f8fc0a..7946430ffd4 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1374,7 +1374,7 @@ sh_store_return_value_nofpu (struct type *type, struct regcache *regcache, { int i, regnum = R0_REGNUM; for (i = 0; i < len; i += 4) - regcache_raw_write (regcache, regnum++, valbuf + i); + regcache->raw_write (regnum++, valbuf + i); } } @@ -1389,10 +1389,10 @@ sh_store_return_value_fpu (struct type *type, struct regcache *regcache, int i, regnum = gdbarch_fp0_regnum (gdbarch); for (i = 0; i < len; i += 4) if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) - regcache_raw_write (regcache, regnum++, + regcache->raw_write (regnum++, valbuf + len - 4 - i); else - regcache_raw_write (regcache, regnum++, valbuf + i); + regcache->raw_write (regnum++, valbuf + i); } else sh_store_return_value_nofpu (type, regcache, valbuf); @@ -1701,7 +1701,7 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, so that a re-read happens next time it's necessary. */ int bregnum; - regcache_raw_write (regcache, BANK_REGNUM, buffer); + regcache->raw_write (BANK_REGNUM, buffer); for (bregnum = R0_BANK0_REGNUM; bregnum < MACLB_REGNUM; ++bregnum) regcache_invalidate (regcache, bregnum); } @@ -1717,7 +1717,7 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) - regcache_raw_write (regcache, base_regnum + portion, + regcache->raw_write (base_regnum + portion, (temp_buffer + register_size (gdbarch, base_regnum) * portion)); @@ -1728,7 +1728,7 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 4; portion++) - regcache_raw_write (regcache, base_regnum + portion, + regcache->raw_write (base_regnum + portion, (buffer + register_size (gdbarch, base_regnum) * portion)); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 7300080d8df..c61fa5006f6 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -547,8 +547,8 @@ sparc32_pseudo_register_write (struct gdbarch *gdbarch, gdb_assert (regnum >= SPARC32_D0_REGNUM && regnum <= SPARC32_D30_REGNUM); regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC32_D0_REGNUM); - regcache_raw_write (regcache, regnum, buf); - regcache_raw_write (regcache, regnum + 1, buf + 4); + regcache->raw_write (regnum, buf); + regcache->raw_write (regnum + 1, buf + 4); } /* Implement the stack_frame_destroyed_p gdbarch method. */ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 9fd6a661992..7b1c1d5a23c 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -988,27 +988,27 @@ sparc64_pseudo_register_write (struct gdbarch *gdbarch, if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D30_REGNUM) { regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC64_D0_REGNUM); - regcache_raw_write (regcache, regnum, buf); - regcache_raw_write (regcache, regnum + 1, buf + 4); + regcache->raw_write (regnum, buf); + regcache->raw_write (regnum + 1, buf + 4); } else if (regnum >= SPARC64_D32_REGNUM && regnum <= SPARC64_D62_REGNUM) { regnum = SPARC64_F32_REGNUM + (regnum - SPARC64_D32_REGNUM); - regcache_raw_write (regcache, regnum, buf); + regcache->raw_write (regnum, buf); } else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q28_REGNUM) { regnum = SPARC_F0_REGNUM + 4 * (regnum - SPARC64_Q0_REGNUM); - regcache_raw_write (regcache, regnum, buf); - regcache_raw_write (regcache, regnum + 1, buf + 4); - regcache_raw_write (regcache, regnum + 2, buf + 8); - regcache_raw_write (regcache, regnum + 3, buf + 12); + regcache->raw_write (regnum, buf); + regcache->raw_write (regnum + 1, buf + 4); + regcache->raw_write (regnum + 2, buf + 8); + regcache->raw_write (regnum + 3, buf + 12); } else if (regnum >= SPARC64_Q32_REGNUM && regnum <= SPARC64_Q60_REGNUM) { regnum = SPARC64_F32_REGNUM + 2 * (regnum - SPARC64_Q32_REGNUM); - regcache_raw_write (regcache, regnum, buf); - regcache_raw_write (regcache, regnum + 1, buf + 8); + regcache->raw_write (regnum, buf); + regcache->raw_write (regnum + 1, buf + 8); } else if (regnum == SPARC64_CWP_REGNUM || regnum == SPARC64_PSTATE_REGNUM diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index fd6d098c244..55d262fb1c2 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -280,7 +280,7 @@ spu_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, case SPU_SP_REGNUM: regcache->raw_read (SPU_RAW_SP_REGNUM, reg); memcpy (reg, buf, 4); - regcache_raw_write (regcache, SPU_RAW_SP_REGNUM, reg); + regcache->raw_write (SPU_RAW_SP_REGNUM, reg); break; case SPU_FPSCR_REGNUM: diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index e11ecdd15a7..9ed696630eb 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -236,7 +236,7 @@ tilegx_store_return_value (struct type *type, struct regcache *regcache, gdb_byte buf[tilegx_reg_size] = { 0 }; memcpy (buf, valbuf, TYPE_LENGTH (type)); - regcache_raw_write (regcache, TILEGX_R0_REGNUM, buf); + regcache->raw_write (TILEGX_R0_REGNUM, buf); } else { @@ -244,7 +244,7 @@ tilegx_store_return_value (struct type *type, struct regcache *regcache, int i, regnum = TILEGX_R0_REGNUM; for (i = 0; i < len; i += tilegx_reg_size) - regcache_raw_write (regcache, regnum++, (gdb_byte *) valbuf + i); + regcache->raw_write (regnum++, (gdb_byte *) valbuf + i); } } diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index a8bc599f906..2a3812d6c08 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1150,7 +1150,7 @@ v850_store_return_value (struct type *type, struct regcache *regcache, { int i, regnum = E_V0_REGNUM; for (i = 0; i < len; i += 4) - regcache_raw_write (regcache, regnum++, valbuf + i); + regcache->raw_write (regnum++, valbuf + i); } } diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 805c7f2686e..b80d23e142d 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -181,7 +181,7 @@ xstormy16_store_return_value (struct type *type, struct regcache *regcache, gdb_byte buf[xstormy16_reg_size]; memset (buf, 0, xstormy16_reg_size); memcpy (buf, valbuf, 1); - regcache_raw_write (regcache, E_1ST_ARG_REGNUM, buf); + regcache->raw_write (E_1ST_ARG_REGNUM, buf); } else { @@ -189,7 +189,7 @@ xstormy16_store_return_value (struct type *type, struct regcache *regcache, int i, regnum = E_1ST_ARG_REGNUM; for (i = 0; i < len; i += xstormy16_reg_size) - regcache_raw_write (regcache, regnum++, valbuf + i); + regcache->raw_write (regnum++, valbuf + i); } } diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 32533e8c5fb..c23d7770f81 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -661,7 +661,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch, /* We can always write 'core' registers. Note: We might have converted Ax->ARy. */ if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)) - regcache_raw_write (regcache, regnum, buffer); + regcache->raw_write (regnum, buffer); /* We have to find out how to deal with priveleged registers. Let's treat them as pseudo-registers, but we cannot read/write them. */ @@ -718,7 +718,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch, } /* Assume that we can write the register. */ - regcache_raw_write (regcache, regnum, buffer); + regcache->raw_write (regnum, buffer); } else internal_error (__FILE__, __LINE__, @@ -1648,7 +1648,7 @@ xtensa_store_return_value (struct type *type, if (len < 4) regcache_raw_write_part (regcache, areg, offset, len, valbuf); else - regcache_raw_write (regcache, areg, valbuf); + regcache->raw_write (areg, valbuf); } } -- 2.30.2