From dca08e1fe158d04517ba3ddd7ece9dd1596c8e8c Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 30 May 2018 14:54:38 -0400 Subject: [PATCH] Remove regcache_cooked_read Remove regcache_cooked_read, update callers to use readable_regcache::cooked_read instead. gdb/ChangeLog: * regcache.h (regcache_cooked_read): Remove, update callers to use readable_regcache::cooked_read instead. * regcache.c (regcache_cooked_read): Remove. --- gdb/ChangeLog | 6 +++ gdb/aarch64-linux-tdep.c | 2 +- gdb/aarch64-tdep.c | 12 +++--- gdb/alpha-tdep.c | 10 ++--- gdb/amd64-linux-tdep.c | 2 +- gdb/arm-tdep.c | 12 +++--- gdb/avr-tdep.c | 2 +- gdb/bfin-linux-tdep.c | 2 +- gdb/hppa-tdep.c | 2 +- gdb/i386-linux-tdep.c | 2 +- gdb/ia64-tdep.c | 4 +- gdb/microblaze-tdep.c | 8 ++-- gdb/mips-linux-tdep.c | 2 +- gdb/nds32-tdep.c | 10 ++--- gdb/nios2-tdep.c | 6 +-- gdb/ppc-linux-tdep.c | 2 +- gdb/ppc-sysv-tdep.c | 82 +++++++++++++++++---------------------- gdb/record-full.c | 2 +- gdb/regcache.c | 8 +--- gdb/regcache.h | 5 +-- gdb/riscv-tdep.c | 4 +- gdb/rs6000-aix-tdep.c | 9 ++--- gdb/rs6000-lynx178-tdep.c | 9 ++--- gdb/s390-tdep.c | 7 ++-- gdb/sparc-linux-tdep.c | 2 +- gdb/sparc-tdep.c | 20 +++++----- gdb/sparc64-linux-tdep.c | 2 +- gdb/sparc64-tdep.c | 18 ++++----- gdb/spu-tdep.c | 4 +- gdb/tic6x-tdep.c | 10 ++--- gdb/vax-tdep.c | 4 +- 31 files changed, 127 insertions(+), 143 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7142237acea..98b80d3d565 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-05-30 Simon Marchi + + * regcache.h (regcache_cooked_read): Remove, update callers to + use readable_regcache::cooked_read instead. + * regcache.c (regcache_cooked_read): Remove. + 2018-05-30 Simon Marchi * regcache.h (regcache_raw_write): Remove, update callers to use diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index ba5757d276b..eccefd9c9ae 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -376,7 +376,7 @@ aarch64_linux_get_syscall_number (struct gdbarch *gdbarch, LONGEST ret; /* Getting the system call number from the register x8. */ - regcache_cooked_read (regs, AARCH64_DWARF_X0 + 8, buf); + regs->cooked_read (AARCH64_DWARF_X0 + 8, buf); ret = extract_signed_integer (buf, X_REGISTER_SIZE, byte_order); diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 8e16e3df8c8..6f4878a1c4e 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1792,7 +1792,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs, bfd_byte buf[V_REGISTER_SIZE]; int len = TYPE_LENGTH (type); - regcache_cooked_read (regs, AARCH64_V0_REGNUM, buf); + regs->cooked_read (AARCH64_V0_REGNUM, buf); memcpy (valbuf, buf, len); } else if (TYPE_CODE (type) == TYPE_CODE_INT @@ -1828,10 +1828,10 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs, struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); int len = TYPE_LENGTH (target_type); - regcache_cooked_read (regs, regno, buf); + regs->cooked_read (regno, buf); memcpy (valbuf, buf, len); valbuf += len; - regcache_cooked_read (regs, regno + 1, buf); + regs->cooked_read (regno + 1, buf); memcpy (valbuf, buf, len); valbuf += len; } @@ -1853,7 +1853,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs, i + 1, gdbarch_register_name (gdbarch, regno)); } - regcache_cooked_read (regs, regno, buf); + regs->cooked_read (regno, buf); memcpy (valbuf, buf, len); valbuf += len; @@ -1865,7 +1865,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs, /* Short vector is returned in V register. */ gdb_byte buf[V_REGISTER_SIZE]; - regcache_cooked_read (regs, AARCH64_V0_REGNUM, buf); + regs->cooked_read (AARCH64_V0_REGNUM, buf); memcpy (valbuf, buf, TYPE_LENGTH (type)); } else @@ -1879,7 +1879,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs, while (len > 0) { - regcache_cooked_read (regs, regno++, buf); + regs->cooked_read (regno++, buf); memcpy (valbuf, buf, len > X_REGISTER_SIZE ? X_REGISTER_SIZE : len); len -= X_REGISTER_SIZE; valbuf += X_REGISTER_SIZE; diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 78422faa6c0..d55f3c6a5d2 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -483,12 +483,12 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache, switch (TYPE_LENGTH (valtype)) { case 4: - regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, raw_buffer); + regcache->cooked_read (ALPHA_FP0_REGNUM, raw_buffer); alpha_sts (gdbarch, valbuf, raw_buffer); break; case 8: - regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, valbuf); + regcache->cooked_read (ALPHA_FP0_REGNUM, valbuf); break; case 16: @@ -507,12 +507,12 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache, { case 8: /* ??? This isn't correct wrt the ABI, but it's what GCC does. */ - regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, valbuf); + regcache->cooked_read (ALPHA_FP0_REGNUM, valbuf); break; case 16: - regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, valbuf); - regcache_cooked_read (regcache, ALPHA_FP0_REGNUM + 1, valbuf + 8); + regcache->cooked_read (ALPHA_FP0_REGNUM, valbuf); + regcache->cooked_read (ALPHA_FP0_REGNUM + 1, valbuf + 8); break; case 32: diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 2bd3d31b752..521e32a9c24 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -234,7 +234,7 @@ amd64_linux_get_syscall_number (struct gdbarch *gdbarch, /* Getting the system call number from the register. When dealing with x86_64 architecture, this information is stored at %rax register. */ - regcache_cooked_read (regcache, AMD64_LINUX_ORIG_RAX_REGNUM, buf); + regcache->cooked_read (AMD64_LINUX_ORIG_RAX_REGNUM, buf); ret = extract_signed_integer (buf, 8, byte_order); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 4eeb6ea0b7f..abb1a88bfac 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -7893,7 +7893,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs, internal type. */ bfd_byte tmpbuf[FP_REGISTER_SIZE]; - regcache_cooked_read (regs, ARM_F0_REGNUM, tmpbuf); + regs->cooked_read (ARM_F0_REGNUM, tmpbuf); target_float_convert (tmpbuf, arm_ext_type (gdbarch), valbuf, type); } @@ -7904,10 +7904,9 @@ arm_extract_return_value (struct type *type, struct regcache *regs, /* ARM_FLOAT_VFP can arise if this is a variadic function so not using the VFP ABI code. */ case ARM_FLOAT_VFP: - regcache_cooked_read (regs, ARM_A1_REGNUM, valbuf); + regs->cooked_read (ARM_A1_REGNUM, valbuf); if (TYPE_LENGTH (type) > 4) - regcache_cooked_read (regs, ARM_A1_REGNUM + 1, - valbuf + INT_REGISTER_SIZE); + regs->cooked_read (ARM_A1_REGNUM + 1, valbuf + INT_REGISTER_SIZE); break; default: @@ -7955,7 +7954,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs, while (len > 0) { - regcache_cooked_read (regs, regno++, tmpbuf); + regs->cooked_read (regno++, tmpbuf); memcpy (valbuf, tmpbuf, len > INT_REGISTER_SIZE ? INT_REGISTER_SIZE : len); len -= INT_REGISTER_SIZE; @@ -8217,8 +8216,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function, regcache_cooked_write (regcache, regnum, writebuf + i * unit_length); if (readbuf) - regcache_cooked_read (regcache, regnum, - readbuf + i * unit_length); + regcache->cooked_read (regnum, readbuf + i * unit_length); } } return RETURN_VALUE_REGISTER_CONVENTION; diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 5aa61ba2d9e..2629d54d457 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -959,7 +959,7 @@ avr_return_value (struct gdbarch *gdbarch, struct value *function, if (readbuf != NULL) { for (i = 0; i < TYPE_LENGTH (valtype); i++) - regcache_cooked_read (regcache, lsb_reg + i, readbuf + i); + regcache->cooked_read (lsb_reg + i, readbuf + i); } return RETURN_VALUE_REGISTER_CONVENTION; diff --git a/gdb/bfin-linux-tdep.c b/gdb/bfin-linux-tdep.c index 9b9f3bedfb1..f84e2e0fc5f 100644 --- a/gdb/bfin-linux-tdep.c +++ b/gdb/bfin-linux-tdep.c @@ -140,7 +140,7 @@ bfin_linux_get_syscall_number (struct gdbarch *gdbarch, /* Getting the system call number from the register. When dealing with Blackfin architecture, this information is stored at %p0 register. */ - regcache_cooked_read (regcache, BFIN_P0_REGNUM, buf); + regcache->cooked_read (BFIN_P0_REGNUM, buf); ret = extract_signed_integer (buf, 4, byte_order); diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 9692b33e097..5fe7851afeb 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1165,7 +1165,7 @@ hppa32_return_value (struct gdbarch *gdbarch, struct value *function, for (b = part; b < TYPE_LENGTH (type); b += 4) { if (readbuf != NULL) - regcache_cooked_read (regcache, reg, readbuf + b); + regcache->cooked_read (reg, readbuf + b); if (writebuf != NULL) regcache_cooked_write (regcache, reg, writebuf + b); reg++; diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index c7b6d5262e1..1919c8b8cf8 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -547,7 +547,7 @@ i386_linux_get_syscall_number_from_regcache (struct regcache *regcache) /* Getting the system call number from the register. When dealing with x86 architecture, this information is stored at %eax register. */ - regcache_cooked_read (regcache, I386_LINUX_ORIG_EAX_REGNUM, buf); + regcache->cooked_read (I386_LINUX_ORIG_EAX_REGNUM, buf); ret = extract_signed_integer (buf, 4, byte_order); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 26e112e7bc5..7eb84ff02b2 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -2616,7 +2616,7 @@ ia64_access_rse_fpreg (unw_addr_space_t as, unw_regnum_t uw_regnum, /* We never call any libunwind routines that need to write registers. */ gdb_assert (!write); - regcache_cooked_read (regcache, regnum, (gdb_byte *) val); + regcache->cooked_read (regnum, (gdb_byte *) val); return 0; } @@ -3210,7 +3210,7 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache, while (n-- > 0) { - regcache_cooked_read (regcache, regnum, from); + regcache->cooked_read (regnum, from); target_float_convert (from, ia64_ext_type (gdbarch), valbuf + offset, float_elt_type); offset += TYPE_LENGTH (float_elt_type); diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index 0cb96338015..f5035904aec 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -529,17 +529,17 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache, switch (TYPE_LENGTH (type)) { case 1: /* return last byte in the register. */ - regcache_cooked_read (regcache, MICROBLAZE_RETVAL_REGNUM, buf); + regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf); memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1); return; case 2: /* return last 2 bytes in register. */ - regcache_cooked_read (regcache, MICROBLAZE_RETVAL_REGNUM, buf); + regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf); memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2); return; case 4: /* for sizes 4 or 8, copy the required length. */ case 8: - regcache_cooked_read (regcache, MICROBLAZE_RETVAL_REGNUM, buf); - regcache_cooked_read (regcache, MICROBLAZE_RETVAL_REGNUM+1, buf+4); + regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf); + regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM + 1, buf+4); memcpy (valbuf, buf, TYPE_LENGTH (type)); return; default: diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index e5804246855..84cc4058dac 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -1337,7 +1337,7 @@ mips_linux_get_syscall_number (struct gdbarch *gdbarch, /* Getting the system call number from the register. syscall number is in v0 or $2. */ - regcache_cooked_read (regcache, MIPS_V0_REGNUM, buf); + regcache->cooked_read (MIPS_V0_REGNUM, buf); ret = extract_signed_integer (buf, regsize, byte_order); diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index 14b091c0b59..35375fb1eeb 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -1740,9 +1740,9 @@ nds32_extract_return_value (struct gdbarch *gdbarch, struct type *type, if (abi_use_fpr && calling_use_fpr) { if (len == 4) - regcache_cooked_read (regcache, tdep->fs0_regnum, valbuf); + regcache->cooked_read (tdep->fs0_regnum, valbuf); else if (len == 8) - regcache_cooked_read (regcache, NDS32_FD0_REGNUM, valbuf); + regcache->cooked_read (NDS32_FD0_REGNUM, valbuf); else internal_error (__FILE__, __LINE__, _("Cannot extract return value of %d bytes " @@ -1788,7 +1788,7 @@ nds32_extract_return_value (struct gdbarch *gdbarch, struct type *type, } else if (len == 4) { - regcache_cooked_read (regcache, NDS32_R0_REGNUM, valbuf); + regcache->cooked_read (NDS32_R0_REGNUM, valbuf); } else if (len < 8) { @@ -1805,8 +1805,8 @@ nds32_extract_return_value (struct gdbarch *gdbarch, struct type *type, } else { - regcache_cooked_read (regcache, NDS32_R0_REGNUM, valbuf); - regcache_cooked_read (regcache, NDS32_R0_REGNUM + 1, valbuf + 4); + regcache->cooked_read (NDS32_R0_REGNUM, valbuf); + regcache->cooked_read (NDS32_R0_REGNUM + 1, valbuf + 4); } } } diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index f6088f38ef5..e1cbd976330 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -207,13 +207,13 @@ nios2_extract_return_value (struct gdbarch *gdbarch, struct type *valtype, /* Return values of up to 8 bytes are returned in $r2 $r3. */ if (len <= register_size (gdbarch, NIOS2_R2_REGNUM)) - regcache_cooked_read (regcache, NIOS2_R2_REGNUM, valbuf); + regcache->cooked_read (NIOS2_R2_REGNUM, valbuf); else { gdb_assert (len <= (register_size (gdbarch, NIOS2_R2_REGNUM) + register_size (gdbarch, NIOS2_R3_REGNUM))); - regcache_cooked_read (regcache, NIOS2_R2_REGNUM, valbuf); - regcache_cooked_read (regcache, NIOS2_R3_REGNUM, valbuf + 4); + regcache->cooked_read (NIOS2_R2_REGNUM, valbuf); + regcache->cooked_read (NIOS2_R3_REGNUM, valbuf + 4); } } diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 5716f828105..c114bee23c9 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -818,7 +818,7 @@ ppc_linux_get_syscall_number (struct gdbarch *gdbarch, /* Getting the system call number from the register. When dealing with PowerPC architecture, this information is stored at 0th register. */ - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum, buf.data ()); + regcache->cooked_read (tdep->ppc_gp0_regnum, buf.data ()); return extract_signed_integer (buf.data (), tdep->wordsize, byte_order); } diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index a6ba5d0ffd6..04f9447bad6 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -640,7 +640,7 @@ get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype, } if (readbuf != NULL) { - regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, readbuf); + regcache->cooked_read (tdep->ppc_fp0_regnum + 1, readbuf); /* Left align 32-bit decimal float. */ if (TYPE_LENGTH (valtype) == 4) @@ -660,8 +660,8 @@ get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype, regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 2 + i, writebuf + i * 8); if (readbuf != NULL) - regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 2 + i, - readbuf + i * 8); + regcache->cooked_read (tdep->ppc_fp0_regnum + 2 + i, + readbuf + i * 8); } } } @@ -710,7 +710,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, gdb_byte regval[PPC_MAX_REGISTER_SIZE]; struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum + 1); - regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval); + regcache->cooked_read (tdep->ppc_fp0_regnum + 1, regval); target_float_convert (regval, regtype, readbuf, type); } if (writebuf) @@ -733,9 +733,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, /* IBM long double stored in f1 and f2. */ if (readbuf) { - regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, readbuf); - regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 2, - readbuf + 8); + regcache->cooked_read (tdep->ppc_fp0_regnum + 1, readbuf); + regcache->cooked_read (tdep->ppc_fp0_regnum + 2, readbuf + 8); } if (writebuf) { @@ -755,13 +754,10 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, r5, r6. */ if (readbuf) { - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, readbuf); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, - readbuf + 4); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 5, - readbuf + 8); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 6, - readbuf + 12); + regcache->cooked_read (tdep->ppc_gp0_regnum + 3, readbuf); + regcache->cooked_read (tdep->ppc_gp0_regnum + 4, readbuf + 4); + regcache->cooked_read (tdep->ppc_gp0_regnum + 5, readbuf + 8); + regcache->cooked_read (tdep->ppc_gp0_regnum + 6, readbuf + 12); } if (writebuf) { @@ -784,10 +780,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, { /* A long long, double or _Decimal64 stored in the 32 bit r3/r4. */ - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, - readbuf + 0); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, - readbuf + 4); + regcache->cooked_read (tdep->ppc_gp0_regnum + 3, readbuf + 0); + regcache->cooked_read (tdep->ppc_gp0_regnum + 4, readbuf + 4); } if (writebuf) { @@ -859,7 +853,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } if (readbuf != NULL) { - regcache_cooked_read (regcache, regnum, regval); + regcache->cooked_read (regnum, regval); target_float_convert (regval, regtype, readbuf + offset, eltype); } @@ -903,7 +897,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, if (writebuf != NULL) regcache_cooked_write (regcache, regnum, writebuf + offset); if (readbuf != NULL) - regcache_cooked_read (regcache, regnum, readbuf + offset); + regcache->cooked_read (regnum, readbuf + offset); } return RETURN_VALUE_REGISTER_CONVENTION; @@ -916,7 +910,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, if (readbuf) { /* Altivec places the return value in "v2". */ - regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf); + regcache->cooked_read (tdep->ppc_vr0_regnum + 2, readbuf); } if (writebuf) { @@ -935,14 +929,10 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, ABI risks in that case; we don't try to support it. */ if (readbuf) { - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, - readbuf + 0); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, - readbuf + 4); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 5, - readbuf + 8); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 6, - readbuf + 12); + regcache->cooked_read (tdep->ppc_gp0_regnum + 3, readbuf + 0); + regcache->cooked_read (tdep->ppc_gp0_regnum + 4, readbuf + 4); + regcache->cooked_read (tdep->ppc_gp0_regnum + 5, readbuf + 8); + regcache->cooked_read (tdep->ppc_gp0_regnum + 6, readbuf + 12); } if (writebuf) { @@ -968,7 +958,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, only corresponds to the least significant 32-bits. So place the 64-bit DSP type's value in ev3. */ if (readbuf) - regcache_cooked_read (regcache, tdep->ppc_ev0_regnum + 3, readbuf); + regcache->cooked_read (tdep->ppc_ev0_regnum + 3, readbuf); if (writebuf) regcache_cooked_write (regcache, tdep->ppc_ev0_regnum + 3, writebuf); return RETURN_VALUE_REGISTER_CONVENTION; @@ -984,11 +974,11 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, if (readbuf) { - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, - regvals + 0 * tdep->wordsize); + regcache->cooked_read (tdep->ppc_gp0_regnum + 3, + regvals + 0 * tdep->wordsize); if (len > tdep->wordsize) - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, - regvals + 1 * tdep->wordsize); + regcache->cooked_read (tdep->ppc_gp0_regnum + 4, + regvals + 1 * tdep->wordsize); memcpy (readbuf, regvals + offset, len); } if (writebuf) @@ -1012,11 +1002,11 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, /* The value is right-padded to 8 bytes and then loaded, as two "words", into r3/r4. */ gdb_byte regvals[PPC_MAX_REGISTER_SIZE * 2]; - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, - regvals + 0 * tdep->wordsize); + regcache->cooked_read (tdep->ppc_gp0_regnum + 3, + regvals + 0 * tdep->wordsize); if (TYPE_LENGTH (type) > tdep->wordsize) - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, - regvals + 1 * tdep->wordsize); + regcache->cooked_read (tdep->ppc_gp0_regnum + 4, + regvals + 1 * tdep->wordsize); memcpy (readbuf, regvals, TYPE_LENGTH (type)); } if (writebuf) @@ -1824,7 +1814,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, } if (readbuf != NULL) { - regcache_cooked_read (regcache, regnum, regval); + regcache->cooked_read (regnum, regval); target_float_convert (regval, regtype, readbuf, valtype); } return 1; @@ -1865,8 +1855,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, } if (readbuf != NULL) { - regcache_cooked_read (regcache, regnum, readbuf); - regcache_cooked_read (regcache, regnum + 1, readbuf + 8); + regcache->cooked_read (regnum, readbuf); + regcache->cooked_read (regnum + 1, readbuf + 8); } return 1; } @@ -1887,8 +1877,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, } if (readbuf != NULL) { - regcache_cooked_read (regcache, regnum, readbuf + hipart); - regcache_cooked_read (regcache, regnum + 1, readbuf + lopart); + regcache->cooked_read (regnum, readbuf + hipart); + regcache->cooked_read (regnum + 1, readbuf + lopart); } return 1; } @@ -1903,7 +1893,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, if (writebuf != NULL) regcache_cooked_write (regcache, regnum, writebuf); if (readbuf != NULL) - regcache_cooked_read (regcache, regnum, readbuf); + regcache->cooked_read (regnum, readbuf); return 1; } @@ -2008,7 +1998,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, if (writebuf != NULL) regcache_cooked_write (regcache, regnum, writebuf); if (readbuf != NULL) - regcache_cooked_read (regcache, regnum, readbuf); + regcache->cooked_read (regnum, readbuf); return RETURN_VALUE_REGISTER_CONVENTION; } @@ -2092,7 +2082,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, } if (readbuf != NULL) { - regcache_cooked_read (regcache, regnum, regval); + regcache->cooked_read (regnum, regval); if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG && offset == 0) memcpy (readbuf, regval + tdep->wordsize - len, len); diff --git a/gdb/record-full.c b/gdb/record-full.c index 9b670076e7e..b8460d9c5d8 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -833,7 +833,7 @@ record_full_exec_insn (struct regcache *regcache, host_address_to_string (entry), entry->u.reg.num); - regcache_cooked_read (regcache, entry->u.reg.num, reg.data ()); + regcache->cooked_read (entry->u.reg.num, reg.data ()); regcache_cooked_write (regcache, entry->u.reg.num, record_full_get_loc (entry)); memcpy (record_full_get_loc (entry), reg.data (), entry->u.reg.len); diff --git a/gdb/regcache.c b/gdb/regcache.c index 470042c7dac..ec1bfb0876b 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -209,7 +209,7 @@ do_cooked_read (void *src, int regnum, gdb_byte *buf) { struct regcache *regcache = (struct regcache *) src; - return regcache_cooked_read (regcache, regnum, buf); + return regcache->cooked_read (regnum, buf); } readonly_detached_regcache::readonly_detached_regcache (const regcache &src) @@ -600,12 +600,6 @@ regcache_raw_get_signed (struct regcache *regcache, int regnum) return value; } -enum register_status -regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf) -{ - return regcache->cooked_read (regnum, buf); -} - enum register_status readable_regcache::cooked_read (int regnum, gdb_byte *buf) { diff --git a/gdb/regcache.h b/gdb/regcache.h index e9cbcbea5b5..f7228e40032 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -67,9 +67,6 @@ void regcache_invalidate (struct regcache *regcache, int regnum); constructed from valid, invalid or unavailable ``raw'' registers. */ -/* Transfer a cooked register [0..NUM_REGS+NUM_PSEUDO_REGS). */ -enum register_status regcache_cooked_read (struct regcache *regcache, - int rawnum, gdb_byte *buf); void regcache_cooked_write (struct regcache *regcache, int rawnum, const gdb_byte *buf); @@ -252,6 +249,8 @@ public: /* Make certain that the register REGNUM is up-to-date. */ virtual void raw_update (int regnum) = 0; + /* Transfer a raw register [0..NUM_REGS+NUM_PSEUDO_REGS) from core-gdb to + this regcache, return its value in *BUF and return its availability status. */ enum register_status cooked_read (int regnum, gdb_byte *buf); template> enum register_status cooked_read (int regnum, T *val); diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 9fa458b79b5..6943121007a 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -2248,7 +2248,7 @@ riscv_return_value (struct gdbarch *gdbarch, regnum = info.argloc[0].loc_data.regno; if (readbuf) - regcache_cooked_read (regcache, regnum, readbuf); + regcache->cooked_read (regnum, readbuf); if (writebuf) regcache_cooked_write (regcache, regnum, writebuf); @@ -2265,7 +2265,7 @@ riscv_return_value (struct gdbarch *gdbarch, if (readbuf) { readbuf += info.argloc[1].c_offset; - regcache_cooked_read (regcache, regnum, readbuf); + regcache->cooked_read (regnum, readbuf); } if (writebuf) diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index ecf6191df01..bb9e6be12ec 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -420,7 +420,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function, && TYPE_LENGTH (valtype) == 16) { if (readbuf) - regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf); + regcache->cooked_read (tdep->ppc_vr0_regnum + 2, readbuf); if (writebuf) regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2, writebuf); @@ -452,7 +452,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function, if (readbuf) { - regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval); + regcache->cooked_read (tdep->ppc_fp0_regnum + 1, regval); target_float_convert (regval, regtype, readbuf, valtype); } if (writebuf) @@ -504,9 +504,8 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function, { gdb_byte regval[8]; - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, regval); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, - regval + 4); + regcache->cooked_read (tdep->ppc_gp0_regnum + 3, regval); + regcache->cooked_read (tdep->ppc_gp0_regnum + 4, regval + 4); memcpy (readbuf, regval, 8); } if (writebuf) diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c index a18d9c3641d..37ac61719a6 100644 --- a/gdb/rs6000-lynx178-tdep.c +++ b/gdb/rs6000-lynx178-tdep.c @@ -281,7 +281,7 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function, && TYPE_LENGTH (valtype) == 16) { if (readbuf) - regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf); + regcache->cooked_read (tdep->ppc_vr0_regnum + 2, readbuf); if (writebuf) regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2, writebuf); @@ -313,7 +313,7 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function, if (readbuf) { - regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval); + regcache->cooked_read (tdep->ppc_fp0_regnum + 1, regval); target_float_convert (regval, regtype, readbuf, valtype); } if (writebuf) @@ -365,9 +365,8 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function, { gdb_byte regval[8]; - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, regval); - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, - regval + 4); + regcache->cooked_read (tdep->ppc_gp0_regnum + 3, regval); + regcache->cooked_read (tdep->ppc_gp0_regnum + 4, regval + 4); memcpy (readbuf, regval, 8); } if (writebuf) diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index bbf696ed9d3..8a82fb96da8 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -2024,9 +2024,8 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type, } else { - regcache_cooked_read (regcache, S390_R2_REGNUM, out); - regcache_cooked_read (regcache, S390_R3_REGNUM, - out + word_size); + regcache->cooked_read (S390_R2_REGNUM, out); + regcache->cooked_read (S390_R3_REGNUM, out + word_size); } } else @@ -2814,7 +2813,7 @@ s390_record_calc_disp_vsce (struct gdbarch *gdbarch, struct regcache *regcache, if (tdep->v0_full_regnum == -1 || el * es >= 16) return -1; if (vx < 16) - regcache_cooked_read (regcache, tdep->v0_full_regnum + vx, buf); + regcache->cooked_read (tdep->v0_full_regnum + vx, buf); else regcache->raw_read (S390_V16_REGNUM + vx - 16, buf); x = extract_unsigned_integer (buf + el * es, es, byte_order); diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c index f7fc8bbc610..00f4513489c 100644 --- a/gdb/sparc-linux-tdep.c +++ b/gdb/sparc-linux-tdep.c @@ -286,7 +286,7 @@ sparc32_linux_get_syscall_number (struct gdbarch *gdbarch, /* Getting the system call number from the register. When dealing with the sparc architecture, this information is stored at the %g1 register. */ - regcache_cooked_read (regcache, SPARC_G1_REGNUM, buf); + regcache->cooked_read (SPARC_G1_REGNUM, buf); ret = extract_signed_integer (buf, 4, byte_order); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index c61fa5006f6..b3b3dcb4085 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1409,20 +1409,20 @@ sparc32_extract_return_value (struct type *type, struct regcache *regcache, || TYPE_CODE (type) == TYPE_CODE_ARRAY) { /* Floating return values. */ - regcache_cooked_read (regcache, SPARC_F0_REGNUM, buf); + regcache->cooked_read (SPARC_F0_REGNUM, buf); if (len > 4) - regcache_cooked_read (regcache, SPARC_F1_REGNUM, buf + 4); + regcache->cooked_read (SPARC_F1_REGNUM, buf + 4); if (len > 8) { - regcache_cooked_read (regcache, SPARC_F2_REGNUM, buf + 8); - regcache_cooked_read (regcache, SPARC_F3_REGNUM, buf + 12); + regcache->cooked_read (SPARC_F2_REGNUM, buf + 8); + regcache->cooked_read (SPARC_F3_REGNUM, buf + 12); } if (len > 16) { - regcache_cooked_read (regcache, SPARC_F4_REGNUM, buf + 16); - regcache_cooked_read (regcache, SPARC_F5_REGNUM, buf + 20); - regcache_cooked_read (regcache, SPARC_F6_REGNUM, buf + 24); - regcache_cooked_read (regcache, SPARC_F7_REGNUM, buf + 28); + regcache->cooked_read (SPARC_F4_REGNUM, buf + 16); + regcache->cooked_read (SPARC_F5_REGNUM, buf + 20); + regcache->cooked_read (SPARC_F6_REGNUM, buf + 24); + regcache->cooked_read (SPARC_F7_REGNUM, buf + 28); } memcpy (valbuf, buf, len); } @@ -1431,10 +1431,10 @@ sparc32_extract_return_value (struct type *type, struct regcache *regcache, /* Integral and pointer return values. */ gdb_assert (sparc_integral_or_pointer_p (type)); - regcache_cooked_read (regcache, SPARC_O0_REGNUM, buf); + regcache->cooked_read (SPARC_O0_REGNUM, buf); if (len > 4) { - regcache_cooked_read (regcache, SPARC_O1_REGNUM, buf + 4); + regcache->cooked_read (SPARC_O1_REGNUM, buf + 4); gdb_assert (len == 8); memcpy (valbuf, buf, 8); } diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c index a48d54cd79b..8810c80f60f 100644 --- a/gdb/sparc64-linux-tdep.c +++ b/gdb/sparc64-linux-tdep.c @@ -294,7 +294,7 @@ sparc64_linux_get_syscall_number (struct gdbarch *gdbarch, /* Getting the system call number from the register. When dealing with the sparc architecture, this information is stored at the %g1 register. */ - regcache_cooked_read (regcache, SPARC_G1_REGNUM, buf); + regcache->cooked_read (SPARC_G1_REGNUM, buf); ret = extract_signed_integer (buf, 8, byte_order); diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 7b1c1d5a23c..ed1aaffb2c8 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -1310,12 +1310,12 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, if (len < 4) { gdb_byte buf[4]; - regcache_cooked_read (regcache, regnum, buf); + regcache->cooked_read (regnum, buf); memcpy (valbuf, buf + 4 - len, len); } else for (int i = 0; i < (len + 3) / 4; i++) - regcache_cooked_read (regcache, regnum + i, valbuf + i * 4); + regcache->cooked_read (regnum + i, valbuf + i * 4); } else if (sparc64_floating_p (type)) { @@ -1328,14 +1328,14 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, regnum = gdbarch_num_regs (gdbarch) + SPARC64_Q0_REGNUM + bitpos / 128; - regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8)); + regcache->cooked_read (regnum, valbuf + (bitpos / 8)); } else if (len == 8) { gdb_assert (bitpos % 64 == 0 && bitpos >= 0 && bitpos < 256); regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM + bitpos / 64; - regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8)); + regcache->cooked_read (regnum, valbuf + (bitpos / 8)); } else { @@ -1343,7 +1343,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, gdb_assert (bitpos % 32 == 0 && bitpos >= 0 && bitpos < 256); regnum = SPARC_F0_REGNUM + bitpos / 32; - regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8)); + regcache->cooked_read (regnum, valbuf + (bitpos / 8)); } } else if (sparc64_structure_or_union_p (type)) @@ -1660,7 +1660,7 @@ sparc64_extract_return_value (struct type *type, struct regcache *regcache, gdb_assert (len <= 32); for (i = 0; i < ((len + 7) / 8); i++) - regcache_cooked_read (regcache, SPARC_O0_REGNUM + i, buf + i * 8); + regcache->cooked_read (SPARC_O0_REGNUM + i, buf + i * 8); if (TYPE_CODE (type) != TYPE_CODE_UNION) sparc64_extract_floating_fields (regcache, type, buf, 0); memcpy (valbuf, buf, len); @@ -1669,7 +1669,7 @@ sparc64_extract_return_value (struct type *type, struct regcache *regcache, { /* Floating return values. */ for (i = 0; i < len / 4; i++) - regcache_cooked_read (regcache, SPARC_F0_REGNUM + i, buf + i * 4); + regcache->cooked_read (SPARC_F0_REGNUM + i, buf + i * 4); memcpy (valbuf, buf, len); } else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) @@ -1678,7 +1678,7 @@ sparc64_extract_return_value (struct type *type, struct regcache *regcache, gdb_assert (len <= 32); for (i = 0; i < ((len + 7) / 8); i++) - regcache_cooked_read (regcache, SPARC_O0_REGNUM + i, buf + i * 8); + regcache->cooked_read (SPARC_O0_REGNUM + i, buf + i * 8); memcpy (valbuf, buf, len); } else @@ -1688,7 +1688,7 @@ sparc64_extract_return_value (struct type *type, struct regcache *regcache, /* Just stripping off any unused bytes should preserve the signed-ness just fine. */ - regcache_cooked_read (regcache, SPARC_O0_REGNUM, buf); + regcache->cooked_read (SPARC_O0_REGNUM, buf); memcpy (valbuf, buf + 8 - len, len); } } diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 55d262fb1c2..46287762bf3 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1387,7 +1387,7 @@ spu_regcache_to_value (struct regcache *regcache, int regnum, { while (len >= 16) { - regcache_cooked_read (regcache, regnum++, out); + regcache->cooked_read (regnum++, out); out += 16; len -= 16; } @@ -1480,7 +1480,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function, sp -= 32; /* Store stack back chain. */ - regcache_cooked_read (regcache, SPU_RAW_SP_REGNUM, buf); + regcache->cooked_read (SPU_RAW_SP_REGNUM, buf); target_write_memory (sp, buf, 16); /* Finally, update all slots of the SP register. */ diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c index f11763d9925..b2db026b32d 100644 --- a/gdb/tic6x-tdep.c +++ b/gdb/tic6x-tdep.c @@ -725,7 +725,7 @@ tic6x_extract_return_value (struct type *valtype, struct regcache *regcache, regcache_cooked_read_part (regcache, TIC6X_A4_REGNUM, 4 - len, len, valbuf); else - regcache_cooked_read (regcache, TIC6X_A4_REGNUM, valbuf); + regcache->cooked_read (TIC6X_A4_REGNUM, valbuf); } else if (len <= 8) { @@ -736,13 +736,13 @@ tic6x_extract_return_value (struct type *valtype, struct regcache *regcache, lower (even) register. */ if (byte_order == BFD_ENDIAN_BIG) { - regcache_cooked_read (regcache, TIC6X_A4_REGNUM, valbuf + 4); - regcache_cooked_read (regcache, TIC6X_A5_REGNUM, valbuf); + regcache->cooked_read (TIC6X_A4_REGNUM, valbuf + 4); + regcache->cooked_read (TIC6X_A5_REGNUM, valbuf); } else { - regcache_cooked_read (regcache, TIC6X_A4_REGNUM, valbuf); - regcache_cooked_read (regcache, TIC6X_A5_REGNUM, valbuf + 4); + regcache->cooked_read (TIC6X_A4_REGNUM, valbuf); + regcache->cooked_read (TIC6X_A5_REGNUM, valbuf + 4); } } } diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 4c1ab2e73e6..a1783ec0011 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -227,9 +227,9 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function, if (readbuf) { /* Read the contents of R0 and (if necessary) R1. */ - regcache_cooked_read (regcache, VAX_R0_REGNUM, buf); + regcache->cooked_read (VAX_R0_REGNUM, buf); if (len > 4) - regcache_cooked_read (regcache, VAX_R1_REGNUM, buf + 4); + regcache->cooked_read (VAX_R1_REGNUM, buf + 4); memcpy (readbuf, buf, len); } if (writebuf) -- 2.30.2