aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-fbsd-tdep.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2017-05-26 17:04:13 +0100
committerAlan Hayward <alan.hayward@arm.com>2017-05-26 17:07:52 +0100
commitb057297ab63a9124aae1773566815cd8c4bde8e9 (patch)
tree73fedbfc92512c26f04333e433adefa2f2c0a907 /gdb/mips-fbsd-tdep.c
parent22e7d2933103f1384c1d54dff6188cd57cbe171a (diff)
downloadfsf-binutils-gdb-b057297ab63a9124aae1773566815cd8c4bde8e9.zip
fsf-binutils-gdb-b057297ab63a9124aae1773566815cd8c4bde8e9.tar.gz
fsf-binutils-gdb-b057297ab63a9124aae1773566815cd8c4bde8e9.tar.bz2
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.
Diffstat (limited to 'gdb/mips-fbsd-tdep.c')
-rw-r--r--gdb/mips-fbsd-tdep.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index d5bec3c..44b960d 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -42,57 +42,24 @@
34th is a dummy for padding. */
#define MIPS_FBSD_NUM_FPREGS 34
-/* Supply a single register. If the source register size matches the
- size the regcache expects, this can use regcache_raw_supply(). If
- they are different, this copies the source register into a buffer
- that can be passed to regcache_raw_supply(). */
+/* Supply a single register. The register size might not match, so use
+ regcache->raw_supply_integer (). */
static void
mips_fbsd_supply_reg (struct regcache *regcache, int regnum, const void *addr,
size_t len)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
-
- if (register_size (gdbarch, regnum) == len)
- regcache_raw_supply (regcache, regnum, addr);
- else
- {
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- gdb_byte buf[MAX_REGISTER_SIZE];
- LONGEST val;
-
- val = extract_signed_integer ((const gdb_byte *) addr, len, byte_order);
- store_signed_integer (buf, register_size (gdbarch, regnum), byte_order,
- val);
- regcache_raw_supply (regcache, regnum, buf);
- }
+ regcache->raw_supply_integer (regnum, (const gdb_byte *) addr, len, true);
}
-/* Collect a single register. If the destination register size
- matches the size the regcache expects, this can use
- regcache_raw_supply(). If they are different, this fetches the
- register via regcache_raw_supply() into a buffer and then copies it
- into the final destination. */
+/* Collect a single register. The register size might not match, so use
+ regcache->raw_collect_integer (). */
static void
mips_fbsd_collect_reg (const struct regcache *regcache, int regnum, void *addr,
size_t len)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
-
- if (register_size (gdbarch, regnum) == len)
- regcache_raw_collect (regcache, regnum, addr);
- else
- {
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- gdb_byte buf[MAX_REGISTER_SIZE];
- LONGEST val;
-
- regcache_raw_collect (regcache, regnum, buf);
- val = extract_signed_integer (buf, register_size (gdbarch, regnum),
- byte_order);
- store_signed_integer ((gdb_byte *) addr, len, byte_order, val);
- }
+ regcache->raw_collect_integer (regnum, (gdb_byte *) addr, len, true);
}
/* Supply the floating-point registers stored in FPREGS to REGCACHE.