Remove regcache_raw_read

Remove regcache_raw_read, update all callers to use
readable_regcache::raw_read instead.

gdb/ChangeLog:

	* regcache.h (regcache_raw_read): Remove, update callers to use
	readable_regcache::raw_read instead.
	* regcache.c (regcache_raw_read): Remove.
This commit is contained in:
Simon Marchi 2018-05-30 14:54:36 -04:00
parent 0b47d9858c
commit 0b8835861c
21 changed files with 61 additions and 63 deletions

View File

@ -1,3 +1,9 @@
2018-05-30 Simon Marchi <simon.marchi@ericsson.com>
* regcache.h (regcache_raw_read): Remove, update callers to use
readable_regcache::raw_read instead.
* regcache.c (regcache_raw_read): Remove.
2018-05-30 Simon Marchi <simon.marchi@ericsson.com>
* regcache.h (regcache_raw_update): Remove, update callers to

View File

@ -422,8 +422,7 @@ amd64_pseudo_register_write (struct gdbarch *gdbarch,
if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
{
/* Read ... AH, BH, CH, DH. */
regcache_raw_read (regcache,
gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
regcache->raw_read (gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf + 1, buf, 1);
/* ... Write. */
@ -433,7 +432,7 @@ amd64_pseudo_register_write (struct gdbarch *gdbarch,
else
{
/* Read ... */
regcache_raw_read (regcache, gpnum, raw_buf);
regcache->raw_read (gpnum, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf, buf, 1);
/* ... Write. */
@ -445,7 +444,7 @@ amd64_pseudo_register_write (struct gdbarch *gdbarch,
int gpnum = regnum - tdep->eax_regnum;
/* Read ... */
regcache_raw_read (regcache, gpnum, raw_buf);
regcache->raw_read (gpnum, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf, buf, 4);
/* ... Write. */
@ -771,8 +770,8 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
{
if (readbuf)
{
regcache_raw_read (regcache, AMD64_ST0_REGNUM, readbuf);
regcache_raw_read (regcache, AMD64_ST1_REGNUM, readbuf + 16);
regcache->raw_read (AMD64_ST0_REGNUM, readbuf);
regcache->raw_read (AMD64_ST1_REGNUM, readbuf + 16);
}
if (writebuf)

View File

@ -8800,7 +8800,7 @@ arm_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
regcache_raw_read (regcache, double_regnum, reg_buf);
regcache->raw_read (double_regnum, reg_buf);
memcpy (reg_buf + offset, buf, 4);
regcache_raw_write (regcache, double_regnum, reg_buf);
}

View File

@ -719,7 +719,7 @@ bfin_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
_("invalid register number %d"), regnum);
/* Overlay the CC bit in the ASTAT register. */
regcache_raw_read (regcache, BFIN_ASTAT_REGNUM, buf);
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);
}

View File

@ -349,7 +349,7 @@ frv_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int byte_num = (reg - accg0_regnum) % 4;
gdb_byte buf[4];
regcache_raw_read (regcache, raw_regnum, buf);
regcache->raw_read (raw_regnum, buf);
buf[byte_num] = ((bfd_byte *) buffer)[0];
regcache_raw_write (regcache, raw_regnum, buf);
}

View File

@ -2802,7 +2802,7 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
its contents to the desired type. This is probably not
exactly how it would happen on the target itself, but it is
the best we can do. */
regcache_raw_read (regcache, I386_ST0_REGNUM, buf);
regcache->raw_read (I386_ST0_REGNUM, buf);
target_float_convert (buf, i387_ext_type (gdbarch), valbuf, type);
}
else
@ -2812,14 +2812,14 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
if (len <= low_size)
{
regcache_raw_read (regcache, LOW_RETURN_REGNUM, buf);
regcache->raw_read (LOW_RETURN_REGNUM, buf);
memcpy (valbuf, buf, len);
}
else if (len <= (low_size + high_size))
{
regcache_raw_read (regcache, LOW_RETURN_REGNUM, buf);
regcache->raw_read (LOW_RETURN_REGNUM, buf);
memcpy (valbuf, buf, low_size);
regcache_raw_read (regcache, HIGH_RETURN_REGNUM, buf);
regcache->raw_read (HIGH_RETURN_REGNUM, buf);
memcpy (valbuf + low_size, buf, len - low_size);
}
else
@ -3474,7 +3474,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum);
/* Read ... */
regcache_raw_read (regcache, fpnum, raw_buf);
regcache->raw_read (fpnum, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf, buf, register_size (gdbarch, regnum));
/* ... Write. */
@ -3496,9 +3496,8 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
upper = extract_unsigned_integer (buf + size, size, byte_order);
/* Fetching register buffer. */
regcache_raw_read (regcache,
I387_BND0R_REGNUM (tdep) + regnum,
raw_buf);
regcache->raw_read (I387_BND0R_REGNUM (tdep) + regnum,
raw_buf);
upper = ~upper;
@ -3583,7 +3582,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int gpnum = regnum - tdep->ax_regnum;
/* Read ... */
regcache_raw_read (regcache, gpnum, raw_buf);
regcache->raw_read (gpnum, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf, buf, 2);
/* ... Write. */
@ -3594,7 +3593,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int gpnum = regnum - tdep->al_regnum;
/* Read ... We read both lower and upper registers. */
regcache_raw_read (regcache, gpnum % 4, raw_buf);
regcache->raw_read (gpnum % 4, raw_buf);
/* ... Modify ... (always little endian). */
if (gpnum >= 4)
memcpy (raw_buf + 1, buf, 1);

View File

@ -1280,7 +1280,7 @@ m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
{
gdb_byte buf[M68HC11_REG_SIZE];
regcache_raw_read (regcache, HARD_D_REGNUM, buf);
regcache->raw_read (HARD_D_REGNUM, buf);
switch (TYPE_LENGTH (type))
{
case 1:
@ -1293,13 +1293,13 @@ m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
case 3:
memcpy ((char*) valbuf + 1, buf, 2);
regcache_raw_read (regcache, HARD_X_REGNUM, buf);
regcache->raw_read (HARD_X_REGNUM, buf);
memcpy (valbuf, buf + 1, 1);
break;
case 4:
memcpy ((char*) valbuf + 2, buf, 2);
regcache_raw_read (regcache, HARD_X_REGNUM, buf);
regcache->raw_read (HARD_X_REGNUM, buf);
memcpy (valbuf, buf, 2);
break;

View File

@ -286,14 +286,14 @@ m68k_extract_return_value (struct type *type, struct regcache *regcache,
if (len <= 4)
{
regcache_raw_read (regcache, M68K_D0_REGNUM, buf);
regcache->raw_read (M68K_D0_REGNUM, buf);
memcpy (valbuf, buf + (4 - len), len);
}
else if (len <= 8)
{
regcache_raw_read (regcache, M68K_D0_REGNUM, buf);
regcache->raw_read (M68K_D0_REGNUM, buf);
memcpy (valbuf, buf + (8 - len), len - 4);
regcache_raw_read (regcache, M68K_D1_REGNUM, valbuf + (len - 4));
regcache->raw_read (M68K_D1_REGNUM, valbuf + (len - 4));
}
else
internal_error (__FILE__, __LINE__,
@ -311,11 +311,11 @@ m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache,
if (tdep->float_return && TYPE_CODE (type) == TYPE_CODE_FLT)
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
regcache_raw_read (regcache, M68K_FP0_REGNUM, buf);
regcache->raw_read (M68K_FP0_REGNUM, buf);
target_float_convert (buf, fpreg_type, valbuf, type);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf);
regcache->raw_read (M68K_A0_REGNUM, valbuf);
else
m68k_extract_return_value (type, regcache, valbuf);
}

View File

@ -212,15 +212,15 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
gdb_assert (regsz <= MN10300_MAX_REGISTER_SIZE);
if (len <= regsz)
{
regcache_raw_read (regcache, reg, buf);
regcache->raw_read (reg, buf);
memcpy (valbuf, buf, len);
}
else if (len <= 2 * regsz)
{
regcache_raw_read (regcache, reg, buf);
regcache->raw_read (reg, buf);
memcpy (valbuf, buf, regsz);
gdb_assert (regsz == register_size (gdbarch, reg + 1));
regcache_raw_read (regcache, reg + 1, buf);
regcache->raw_read (reg + 1, buf);
memcpy ((char *) valbuf + regsz, buf, len - regsz);
}
else

View File

@ -433,8 +433,7 @@ moxie_software_single_step (struct regcache *regcache)
case 0x19: /* jsr */
case 0x25: /* jmp */
regcache_raw_read (regcache,
(inst >> 4) & 0xf, (gdb_byte *) & tmpu32);
regcache->raw_read ((inst >> 4) & 0xf, (gdb_byte *) & tmpu32);
next_pcs.push_back (tmpu32);
break;
@ -734,7 +733,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
case 0x03: /* jsra */
{
regcache_raw_read (regcache,
regcache->raw_read (
MOXIE_SP_REGNUM, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
@ -763,7 +762,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x06: /* push */
{
int reg = (inst >> 4) & 0xf;
regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
if (record_full_arch_list_add_reg (regcache, reg)
@ -805,7 +804,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x0b: /* st.l */
{
int reg = (inst >> 4) & 0xf;
regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 4))
@ -824,7 +823,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
int reg = (inst >> 4) & 0xf;
uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
byte_order)) << 16 ) >> 16;
regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
tmpu32 += offset;
@ -864,7 +863,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
case 0x19: /* jsr */
{
regcache_raw_read (regcache,
regcache->raw_read (
MOXIE_SP_REGNUM, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
@ -892,7 +891,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x1e: /* st.b */
{
int reg = (inst >> 4) & 0xf;
regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 1))
@ -918,7 +917,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x23: /* st.s */
{
int reg = (inst >> 4) & 0xf;
regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 2))
@ -978,12 +977,12 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
uint32_t length, ptr;
/* Read buffer pointer is in $r1. */
regcache_raw_read (regcache, 3, (gdb_byte *) & ptr);
regcache->raw_read (3, (gdb_byte *) & ptr);
ptr = extract_unsigned_integer ((gdb_byte *) & ptr,
4, byte_order);
/* String length is at 0x12($fp). */
regcache_raw_read (regcache,
regcache->raw_read (
MOXIE_FP_REGNUM, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
@ -1029,7 +1028,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
int reg = (inst >> 4) & 0xf;
uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
byte_order)) << 16 ) >> 16;
regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
tmpu32 += offset;
@ -1049,7 +1048,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
int reg = (inst >> 4) & 0xf;
uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
byte_order)) << 16 ) >> 16;
regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
tmpu32 += offset;

View File

@ -500,7 +500,7 @@ nds32_pseudo_register_write (struct gdbarch *gdbarch,
offset = (regnum & 1) ? 0 : 4;
fdr_regnum = NDS32_FD0_REGNUM + (regnum >> 1);
regcache_raw_read (regcache, fdr_regnum, reg_buf);
regcache->raw_read (fdr_regnum, reg_buf);
memcpy (reg_buf + offset, buf, 4);
regcache_raw_write (regcache, fdr_regnum, reg_buf);
return;

View File

@ -620,7 +620,7 @@ record_full_arch_list_add_reg (struct regcache *regcache, int regnum)
rec = record_full_reg_alloc (regcache, regnum);
regcache_raw_read (regcache, regnum, record_full_get_loc (rec));
regcache->raw_read (regnum, record_full_get_loc (rec));
record_full_arch_list_add (rec);

View File

@ -510,12 +510,6 @@ regcache::raw_update (int regnum)
}
}
enum register_status
regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
{
return regcache->raw_read (regnum, buf);
}
enum register_status
readable_regcache::raw_read (int regnum, gdb_byte *buf)
{

View File

@ -38,8 +38,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t,
/* Transfer a raw register [0..NUM_REGS) between core-gdb and the
regcache. The read variants return the status of the register. */
enum register_status regcache_raw_read (struct regcache *regcache,
int rawnum, gdb_byte *buf);
void regcache_raw_write (struct regcache *regcache, int rawnum,
const gdb_byte *buf);
extern enum register_status
@ -246,6 +244,9 @@ public:
: reg_buffer (gdbarch, has_pseudo)
{}
/* Transfer a raw register [0..NUM_REGS) from core-gdb to this regcache,
return its value in *BUF and return its availability status. */
enum register_status raw_read (int regnum, gdb_byte *buf);
template<typename T, typename = RequireLongest<T>>
enum register_status raw_read (int regnum, T *val);

View File

@ -2816,7 +2816,7 @@ s390_record_calc_disp_vsce (struct gdbarch *gdbarch, struct regcache *regcache,
if (vx < 16)
regcache_cooked_read (regcache, tdep->v0_full_regnum + vx, buf);
else
regcache_raw_read (regcache, S390_V16_REGNUM + vx - 16, buf);
regcache->raw_read (S390_V16_REGNUM + vx - 16, buf);
x = extract_unsigned_integer (buf + el * es, es, byte_order);
*res = s390_record_calc_disp_common (gdbarch, regcache, x, bd, dh);
return 0;

View File

@ -1324,7 +1324,7 @@ sh_extract_return_value_nofpu (struct type *type, struct regcache *regcache,
{
int i, regnum = R0_REGNUM;
for (i = 0; i < len; i += 4)
regcache_raw_read (regcache, regnum++, valbuf + i);
regcache->raw_read (regnum++, valbuf + i);
}
else
error (_("bad size for return value"));
@ -1341,10 +1341,10 @@ sh_extract_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_read (regcache, regnum++,
regcache->raw_read (regnum++,
valbuf + len - 4 - i);
else
regcache_raw_read (regcache, regnum++, valbuf + i);
regcache->raw_read (regnum++, valbuf + i);
}
else
sh_extract_return_value_nofpu (type, regcache, valbuf);

View File

@ -278,7 +278,7 @@ spu_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
switch (regnum)
{
case SPU_SP_REGNUM:
regcache_raw_read (regcache, SPU_RAW_SP_REGNUM, reg);
regcache->raw_read (SPU_RAW_SP_REGNUM, reg);
memcpy (reg, buf, 4);
regcache_raw_write (regcache, SPU_RAW_SP_REGNUM, reg);
break;

View File

@ -219,7 +219,7 @@ tilegx_extract_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_read (regcache, regnum++, valbuf + i);
regcache->raw_read (regnum++, valbuf + i);
}
/* Copy the function return value from VALBUF into the proper

View File

@ -1128,7 +1128,7 @@ v850_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte buf[v850_reg_size];
for (i = 0; len > 0; i += 4, len -= 4)
{
regcache_raw_read (regcache, regnum++, buf);
regcache->raw_read (regnum++, buf);
memcpy (valbuf + i, buf, len > 4 ? 4 : len);
}
}

View File

@ -163,7 +163,7 @@ xstormy16_extract_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_read (regcache, regnum++, valbuf + i);
regcache->raw_read (regnum++, valbuf + i);
}
/* Function: xstormy16_store_return_value

View File

@ -1598,7 +1598,7 @@ xtensa_extract_return_value (struct type *type,
if (len < 4)
regcache_raw_read_part (regcache, areg, offset, len, valbuf);
else
regcache_raw_read (regcache, areg, valbuf);
regcache->raw_read (areg, valbuf);
}
}
@ -1928,7 +1928,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
to modify WINDOWSTART register to make it look like there
is only one register window corresponding to WINDOWEBASE. */
regcache_raw_read (regcache, gdbarch_tdep (gdbarch)->wb_regnum, buf);
regcache->raw_read (gdbarch_tdep (gdbarch)->wb_regnum, buf);
regcache_cooked_write_unsigned
(regcache, gdbarch_tdep (gdbarch)->ws_regnum,
1 << extract_unsigned_integer (buf, 4, byte_order));