From ba2f91bb5d69127da41b368c7226f596ee449eca Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Fri, 7 Apr 2017 09:31:37 +0100 Subject: [PATCH] Add BFIN_MAX_REGISTER_SIZE gdb/ * bfin-tdep.c (BFIN_MAX_REGISTER_SIZE): Add. (bfin_pseudo_register_read): Use BFIN_MAX_REGISTER_SIZE. (bfin_pseudo_register_write): Likewise --- gdb/ChangeLog | 6 ++++++ gdb/bfin-tdep.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0f36e84e541..f136ec9dbc2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-04-07 Alan Hayward + + * bfin-tdep.c (BFIN_MAX_REGISTER_SIZE): Add. + (bfin_pseudo_register_read): Use BFIN_MAX_REGISTER_SIZE. + (bfin_pseudo_register_write): Likewise + 2017-04-06 Simon Marchi * common/ptid.h (struct ptid): Change to... diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c index 3df1ba387a3..c590a9132c0 100644 --- a/gdb/bfin-tdep.c +++ b/gdb/bfin-tdep.c @@ -241,6 +241,8 @@ static const int map_gcc_gdb[] = BFIN_LB1_REGNUM }; +/* Big enough to hold the size of the largest register in bytes. */ +#define BFIN_MAX_REGISTER_SIZE 4 struct bfin_frame_cache { @@ -689,7 +691,7 @@ static enum register_status bfin_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, gdb_byte *buffer) { - gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE); + gdb_byte buf[BFIN_MAX_REGISTER_SIZE]; enum register_status status; if (regnum != BFIN_CC_REGNUM) @@ -710,7 +712,7 @@ static void bfin_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const gdb_byte *buffer) { - gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE); + gdb_byte buf[BFIN_MAX_REGISTER_SIZE]; if (regnum != BFIN_CC_REGNUM) internal_error (__FILE__, __LINE__, -- 2.30.2