mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
Add regcache raw_supply_integer and raw_collect_integer.
Use these to replace instances of MAX_REGISTER_SIZE. * defs.h (copy_integer_to_size): New declaration. * findvar.c (copy_integer_to_size): New function. (do_cint_test): New selftest function. (copy_integer_to_size_test): Likewise. (_initialize_findvar): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_reg): Use raw_supply_integer. (mips_fbsd_collect_reg): Use raw_collect_integer. * mips-linux-tdep.c (supply_32bit_reg): Use raw_supply_integer. (mips64_fill_gregset): Use raw_collect_integer (mips64_fill_fpregset): Use raw_supply_integer. * regcache.c (regcache::raw_supply_integer): New function. (regcache::raw_collect_integer): Likewise. * regcache.h: (regcache::raw_supply_integer): New declaration. (regcache::raw_collect_integer): Likewise.
This commit is contained in:
@@ -116,13 +116,7 @@ mips_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
|
||||
static void
|
||||
supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
||||
gdb_byte buf[MAX_REGISTER_SIZE];
|
||||
store_signed_integer (buf, register_size (gdbarch, regnum), byte_order,
|
||||
extract_signed_integer ((const gdb_byte *) addr, 4,
|
||||
byte_order));
|
||||
regcache_raw_supply (regcache, regnum, buf);
|
||||
regcache->raw_supply_integer (regnum, (const gdb_byte *) addr, 4, true);
|
||||
}
|
||||
|
||||
/* Unpack an elf_gregset_t into GDB's register cache. */
|
||||
@@ -417,7 +411,6 @@ mips64_fill_gregset (const struct regcache *regcache,
|
||||
mips64_elf_gregset_t *gregsetp, int regno)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
||||
int regaddr, regi;
|
||||
mips64_elf_greg_t *regp = *gregsetp;
|
||||
void *dst;
|
||||
@@ -460,14 +453,8 @@ mips64_fill_gregset (const struct regcache *regcache,
|
||||
|
||||
if (regaddr != -1)
|
||||
{
|
||||
gdb_byte buf[MAX_REGISTER_SIZE];
|
||||
LONGEST val;
|
||||
|
||||
regcache_raw_collect (regcache, regno, buf);
|
||||
val = extract_signed_integer (buf, register_size (gdbarch, regno),
|
||||
byte_order);
|
||||
dst = regp + regaddr;
|
||||
store_signed_integer ((gdb_byte *) dst, 8, byte_order, val);
|
||||
regcache->raw_collect_integer (regno, (gdb_byte *) dst, 8, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,25 +551,13 @@ mips64_fill_fpregset (const struct regcache *regcache,
|
||||
}
|
||||
else if (regno == mips_regnum (gdbarch)->fp_control_status)
|
||||
{
|
||||
gdb_byte buf[MAX_REGISTER_SIZE];
|
||||
LONGEST val;
|
||||
|
||||
regcache_raw_collect (regcache, regno, buf);
|
||||
val = extract_signed_integer (buf, register_size (gdbarch, regno),
|
||||
byte_order);
|
||||
to = (gdb_byte *) (*fpregsetp + 32);
|
||||
store_signed_integer (to, 4, byte_order, val);
|
||||
regcache->raw_collect_integer (regno, to, 4, true);
|
||||
}
|
||||
else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
|
||||
{
|
||||
gdb_byte buf[MAX_REGISTER_SIZE];
|
||||
LONGEST val;
|
||||
|
||||
regcache_raw_collect (regcache, regno, buf);
|
||||
val = extract_signed_integer (buf, register_size (gdbarch, regno),
|
||||
byte_order);
|
||||
to = (gdb_byte *) (*fpregsetp + 32) + 4;
|
||||
store_signed_integer (to, 4, byte_order, val);
|
||||
regcache->raw_collect_integer (regno, to, 4, true);
|
||||
}
|
||||
else if (regno == -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user