From e4c4a59b48b2cec10cffac4f562937de00cb5f3f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 30 May 2018 14:54:44 -0400 Subject: [PATCH] Remove regcache_cooked_write_part Remove regcache_cooked_write_part, update callers to use regcache::cooked_write_part. gdb/ChangeLog: * regcache.h (regcache_cooked_write_part): Remove, update callers to use regcache::cooked_write_part. * regcache.c (regcache_cooked_write_part): Remove. --- gdb/ChangeLog | 6 ++++++ gdb/hppa-tdep.c | 15 +++++++-------- gdb/m32c-tdep.c | 2 +- gdb/mep-tdep.c | 5 ++--- gdb/mips-tdep.c | 3 +-- gdb/ppc-sysv-tdep.c | 21 ++++++++++----------- gdb/regcache.c | 7 ------- gdb/regcache.h | 8 ++------ gdb/s390-tdep.c | 17 ++++++----------- gdb/score-tdep.c | 4 ++-- gdb/spu-tdep.c | 6 +++--- gdb/tic6x-tdep.c | 17 +++++++---------- 12 files changed, 47 insertions(+), 64 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0f069263746..b0fb0c6f64f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-05-30 Simon Marchi + + * regcache.h (regcache_cooked_write_part): Remove, update + callers to use regcache::cooked_write_part. + * regcache.c (regcache_cooked_write_part): Remove. + 2018-05-30 Simon Marchi * regcache.h (regcache_cooked_read_part): Remove, update callers diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 81e8a4cc6f8..1ea36704279 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1044,8 +1044,8 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, passed in floating-point registers, are passed in the right halves of the floating point registers; the left halves are unused." */ - regcache_cooked_write_part (regcache, regnum, offset % 8, - len, value_contents (arg)); + regcache->cooked_write_part (regnum, offset % 8, len, + value_contents (arg)); } } } @@ -1086,8 +1086,8 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, regnum = HPPA_ARG0_REGNUM - offset / 8; while (regnum > HPPA_ARG0_REGNUM - 8 && len > 0) { - regcache_cooked_write_part (regcache, regnum, - offset % 8, std::min (len, 8), valbuf); + regcache->cooked_write_part (regnum, offset % 8, std::min (len, 8), + valbuf); offset += std::min (len, 8); valbuf += std::min (len, 8); len -= std::min (len, 8); @@ -1154,8 +1154,7 @@ hppa32_return_value (struct gdbarch *gdbarch, struct value *function, if (readbuf != NULL) regcache->cooked_read_part (reg, 4 - part, part, readbuf); if (writebuf != NULL) - regcache_cooked_write_part (regcache, reg, 4 - part, - part, writebuf); + regcache->cooked_write_part (reg, 4 - part, part, writebuf); reg++; } /* Now transfer the remaining register values. */ @@ -1254,8 +1253,8 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function, { while (len > 0) { - regcache_cooked_write_part (regcache, regnum, offset, - std::min (len, 8), writebuf); + regcache->cooked_write_part (regnum, offset, std::min (len, 8), + writebuf); writebuf += std::min (len, 8); len -= std::min (len, 8); regnum++; diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index b7cba1c3770..f696568e3a7 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -463,7 +463,7 @@ m32c_part_write (struct m32c_reg *reg, struct regcache *cache, int offset, len; m32c_find_part (reg, &offset, &len); - regcache_cooked_write_part (cache, reg->rx->num, offset, len, buf); + cache->cooked_write_part (reg->rx->num, offset, len, buf); return REG_VALID; } diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 1f3f2bb96f6..c8a5ecfbe07 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -2139,9 +2139,8 @@ mep_store_return_value (struct gdbarch *arch, else offset = 0; - regcache_cooked_write_part (regcache, MEP_R0_REGNUM, - offset, TYPE_LENGTH (type), - valbuf); + regcache->cooked_write_part (MEP_R0_REGNUM, offset, TYPE_LENGTH (type), + valbuf); } /* Return values larger than a single register are returned in diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index fdf00f0ca72..32b2d4062c7 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -512,8 +512,7 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache, if (in != NULL) regcache->cooked_read_part (reg_num, reg_offset, length, in + buf_offset); if (out != NULL) - regcache_cooked_write_part (regcache, reg_num, reg_offset, length, - out + buf_offset); + regcache->cooked_write_part (reg_num, reg_offset, length, out + buf_offset); if (mips_debug && in != NULL) { int i; diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index b7dfdca854b..0bac225112b 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1286,9 +1286,8 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, if (len > 0) { if (argpos->regcache && argpos->greg <= 10) - regcache_cooked_write_part (argpos->regcache, - tdep->ppc_gp0_regnum + argpos->greg, - offset, len, val); + argpos->regcache->cooked_write_part + (tdep->ppc_gp0_regnum + argpos->greg, offset, len, val); argpos->greg++; } } @@ -1352,8 +1351,8 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) offset = 8 - TYPE_LENGTH (type); - regcache_cooked_write_part (argpos->regcache, regnum, - offset, TYPE_LENGTH (type), val); + argpos->regcache->cooked_write_part (regnum, offset, + TYPE_LENGTH (type), val); } argpos->freg++; @@ -1802,8 +1801,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, offset = 8 - TYPE_LENGTH (valtype); if (writebuf != NULL) - regcache_cooked_write_part (regcache, regnum, - offset, TYPE_LENGTH (valtype), writebuf); + regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype), + writebuf); if (readbuf != NULL) regcache->cooked_read_part (regnum, offset, TYPE_LENGTH (valtype), readbuf); @@ -1878,8 +1877,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, offset = 8 - TYPE_LENGTH (valtype); if (writebuf != NULL) - regcache_cooked_write_part (regcache, regnum, - offset, TYPE_LENGTH (valtype), writebuf); + regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype), + writebuf); if (readbuf != NULL) regcache->cooked_read_part (regnum, offset, TYPE_LENGTH (valtype), readbuf); @@ -1983,8 +1982,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype)); if (writebuf != NULL) - regcache_cooked_write_part (regcache, regnum, - offset, TYPE_LENGTH (valtype), writebuf); + regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype), + writebuf); if (readbuf != NULL) regcache->cooked_read_part (regnum, offset, TYPE_LENGTH (valtype), readbuf); diff --git a/gdb/regcache.c b/gdb/regcache.c index d8fb36ef362..758f21c0898 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -871,13 +871,6 @@ readable_regcache::cooked_read_part (int regnum, int offset, int len, return read_part (regnum, offset, len, buf, false); } -void -regcache_cooked_write_part (struct regcache *regcache, int regnum, - int offset, int len, const gdb_byte *buf) -{ - regcache->cooked_write_part (regnum, offset, len, buf); -} - void regcache::cooked_write_part (int regnum, int offset, int len, const gdb_byte *buf) diff --git a/gdb/regcache.h b/gdb/regcache.h index f1a3b24d228..064930c6394 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -62,12 +62,6 @@ extern void regcache_cooked_write_signed (struct regcache *regcache, extern void regcache_cooked_write_unsigned (struct regcache *regcache, int regnum, ULONGEST val); -/* Partial transfer of a cooked register. These perform read, modify, - write style operations. */ - -void regcache_cooked_write_part (struct regcache *regcache, int regnum, - int offset, int len, const gdb_byte *buf); - /* Special routines to read/write the PC. */ /* For regcache_read_pc see common/common-regcache.h. */ @@ -315,6 +309,8 @@ public: operations. */ void raw_write_part (int regnum, int offset, int len, const gdb_byte *buf); + /* Partial transfer of a cooked register. Perform read, modify, write style + operations. */ void cooked_write_part (int regnum, int offset, int len, const gdb_byte *buf); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index a894b4ba27b..a3a3cb6c6c8 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1723,10 +1723,8 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg, /* When we store a single-precision value in an FP register, it occupies the leftmost bits. */ if (write_mode) - regcache_cooked_write_part (as->regcache, - S390_F0_REGNUM + as->fr, - 0, length, - value_contents (arg)); + as->regcache->cooked_write_part (S390_F0_REGNUM + as->fr, 0, length, + value_contents (arg)); as->fr += 2; } else @@ -1749,9 +1747,8 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg, int regnum = S390_V24_REGNUM + use_vr[as->vr] - 24; if (write_mode) - regcache_cooked_write_part (as->regcache, regnum, - 0, length, - value_contents (arg)); + as->regcache->cooked_write_part (regnum, 0, length, + value_contents (arg)); as->vr++; } else @@ -1980,8 +1977,7 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type, { /* Float-like value: left-aligned in f0. */ if (in != NULL) - regcache_cooked_write_part (regcache, S390_F0_REGNUM, - 0, length, in); + regcache->cooked_write_part (S390_F0_REGNUM, 0, length, in); else regcache->cooked_read_part (S390_F0_REGNUM, 0, length, out); } @@ -1989,8 +1985,7 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type, { /* Vector: left-aligned in v24. */ if (in != NULL) - regcache_cooked_write_part (regcache, S390_V24_REGNUM, - 0, length, in); + regcache->cooked_write_part (S390_V24_REGNUM, 0, length, in); else regcache->cooked_read_part (S390_V24_REGNUM, 0, length, out); } diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index aa50126916a..e764c659f0d 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -445,8 +445,8 @@ score_xfer_register (struct regcache *regcache, int regnum, int length, regcache->cooked_read_part (regnum, reg_offset, length, readbuf + buf_offset); if (writebuf != NULL) - regcache_cooked_write_part (regcache, regnum, reg_offset, length, - writebuf + buf_offset); + regcache->cooked_write_part (regnum, reg_offset, length, + writebuf + buf_offset); } static enum return_value_convention diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 583cb62987f..80458ab38e0 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1356,7 +1356,7 @@ spu_value_to_regcache (struct regcache *regcache, int regnum, if (spu_scalar_value_p (type)) { int preferred_slot = len < 4 ? 4 - len : 0; - regcache_cooked_write_part (regcache, regnum, preferred_slot, len, in); + regcache->cooked_write_part (regnum, preferred_slot, len, in); } else { @@ -1368,7 +1368,7 @@ spu_value_to_regcache (struct regcache *regcache, int regnum, } if (len > 0) - regcache_cooked_write_part (regcache, regnum, 0, len, in); + regcache->cooked_write_part (regnum, 0, len, in); } } @@ -1540,7 +1540,7 @@ spu_return_value (struct gdbarch *gdbarch, struct value *function, { case RETURN_VALUE_REGISTER_CONVENTION: if (opencl_vector && TYPE_LENGTH (type) == 2) - regcache_cooked_write_part (regcache, SPU_ARG1_REGNUM, 2, 2, in); + regcache->cooked_write_part (SPU_ARG1_REGNUM, 2, 2, in); else spu_value_to_regcache (regcache, SPU_ARG1_REGNUM, type, in); break; diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c index 274b02fa52a..efb8b0561b4 100644 --- a/gdb/tic6x-tdep.c +++ b/gdb/tic6x-tdep.c @@ -760,8 +760,7 @@ tic6x_store_return_value (struct type *valtype, struct regcache *regcache, if (len <= 4) { if (len < 3 && byte_order == BFD_ENDIAN_BIG) - regcache_cooked_write_part (regcache, TIC6X_A4_REGNUM, 4 - len, len, - valbuf); + regcache->cooked_write_part (TIC6X_A4_REGNUM, 4 - len, len, valbuf); else regcache->cooked_write (TIC6X_A4_REGNUM, valbuf); } @@ -957,8 +956,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, so, we write the contents in VAL to the lsp of register. */ if (len < 3 && byte_order == BFD_ENDIAN_BIG) - regcache_cooked_write_part (regcache, arg_regs[argreg], - 4 - len, len, val); + regcache->cooked_write_part (arg_regs[argreg], 4 - len, len, + val); else regcache->cooked_write (arg_regs[argreg], val); } @@ -988,16 +987,14 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (byte_order == BFD_ENDIAN_BIG) { regcache->cooked_write (arg_regs[argreg] + 1, val); - regcache_cooked_write_part (regcache, - arg_regs[argreg], 0, - len - 4, val + 4); + regcache->cooked_write_part (arg_regs[argreg], 0, + len - 4, val + 4); } else { regcache->cooked_write (arg_regs[argreg], val); - regcache_cooked_write_part (regcache, - arg_regs[argreg] + 1, 0, - len - 4, val + 4); + regcache->cooked_write_part (arg_regs[argreg] + 1, 0, + len - 4, val + 4); } } else -- 2.30.2