aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2017-01-18 11:23:02 +0000
committerAlan Hayward <alan.hayward@arm.com>2017-01-18 15:17:55 +0000
commit9890e4338dcabf4512b4856b09511f25c81d10f1 (patch)
treebf6c53ea43b607a808dd4266f5f84f0c50183a05
parent2cedb9ebf8254a23d1fbd4f76a85e5f08dc3aaf5 (diff)
downloadgdb-9890e4338dcabf4512b4856b09511f25c81d10f1.zip
gdb-9890e4338dcabf4512b4856b09511f25c81d10f1.tar.gz
gdb-9890e4338dcabf4512b4856b09511f25c81d10f1.tar.bz2
Use register_size () instead of MAX_REGISTER_SIZE
2017-01-18 Alan Hayward <alan.hayward@arm.com> * amd64-tdep.c (amd64_pseudo_register_read_value): remove MAX_REGISTER_SIZE. (amd64_pseudo_register_read_value): Likewise. * remote.c (fetch_register_using_p): Remove MAX_REGISTER_SIZE. (store_register_using_P): Likewise. * regcache.c (regcache_xfer_part): Likewise.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/amd64-tdep.c4
-rw-r--r--gdb/regcache.c3
-rw-r--r--gdb/remote.c5
4 files changed, 16 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 89696f2..8942e25 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2017-01-18 Alan Hayward <alan.hayward@arm.com>
+
+ * amd64-tdep.c (amd64_pseudo_register_read_value): remove
+ MAX_REGISTER_SIZE.
+ (amd64_pseudo_register_read_value): Likewise.
+ * remote.c (fetch_register_using_p): Remove MAX_REGISTER_SIZE.
+ (store_register_using_P): Likewise.
+ * regcache.c (regcache_xfer_part): Likewise.
+
2017-01-16 Ivo Raisr <ivo.raisr@oracle.com>
Split real and pseudo registers.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index a636742..fc1f134 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -353,7 +353,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
struct regcache *regcache,
int regnum)
{
- gdb_byte raw_buf[MAX_REGISTER_SIZE];
+ gdb_byte *raw_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum register_status status;
struct value *result_value;
@@ -414,7 +414,7 @@ amd64_pseudo_register_write (struct gdbarch *gdbarch,
struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
- gdb_byte raw_buf[MAX_REGISTER_SIZE];
+ gdb_byte *raw_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (i386_byte_regnum_p (gdbarch, regnum))
diff --git a/gdb/regcache.c b/gdb/regcache.c
index b2b9524..9d28aa2 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -988,7 +988,8 @@ regcache_xfer_part (struct regcache *regcache, int regnum,
const gdb_byte *buf))
{
struct regcache_descr *descr = regcache->descr;
- gdb_byte reg[MAX_REGISTER_SIZE];
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ gdb_byte *reg = (gdb_byte *) alloca (register_size (gdbarch, regnum));
gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]);
gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]);
diff --git a/gdb/remote.c b/gdb/remote.c
index 2f7954a..b81bb2f 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7467,9 +7467,10 @@ remote_wait (struct target_ops *ops,
static int
fetch_register_using_p (struct regcache *regcache, struct packet_reg *reg)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct remote_state *rs = get_remote_state ();
char *buf, *p;
- char regp[MAX_REGISTER_SIZE];
+ gdb_byte *regp = (gdb_byte *) alloca (register_size (gdbarch, reg->regnum));
int i;
if (packet_support (PACKET_p) == PACKET_DISABLE)
@@ -7774,7 +7775,7 @@ store_register_using_P (const struct regcache *regcache,
struct remote_state *rs = get_remote_state ();
/* Try storing a single register. */
char *buf = rs->buf;
- gdb_byte regp[MAX_REGISTER_SIZE];
+ gdb_byte *regp = (gdb_byte *) alloca (register_size (gdbarch, reg->regnum));
char *p;
if (packet_support (PACKET_P) == PACKET_DISABLE)