From c185f580b2b3baf7cee762c8ab31ab6925b9534a Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Wed, 26 Apr 2017 10:32:35 +0100 Subject: [PATCH] xtensa_pseudo_register_read/write - Use regcache_raw_read_unsigned gdb/ * xtensa-tdep.c (xtensa_pseudo_register_read): Use regcache_raw_read_unsigned. (xtensa_pseudo_register_write): Likewise. --- gdb/ChangeLog | 6 ++++++ gdb/xtensa-tdep.c | 21 +++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 52ef8d9..03bec1f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2017-04-26 Alan Hayward + * xtensa-tdep.c (xtensa_pseudo_register_read): Use + regcache_raw_read_unsigned. + (xtensa_pseudo_register_write): Likewise. + +2017-04-26 Alan Hayward + * nds32-tdep.c (nds32_pseudo_register_read): Abort on errors. (nds32_pseudo_register_write): Likewise. diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 0fcd483..0a4ed37 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -559,16 +559,15 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch, && (regnum >= gdbarch_tdep (gdbarch)->a0_base) && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15)) { - gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE); + ULONGEST value; enum register_status status; - status = regcache_raw_read (regcache, - gdbarch_tdep (gdbarch)->wb_regnum, - buf); + status = regcache_raw_read_unsigned (regcache, + gdbarch_tdep (gdbarch)->wb_regnum, + &value); if (status != REG_VALID) return status; - regnum = arreg_number (gdbarch, regnum, - extract_unsigned_integer (buf, 4, byte_order)); + regnum = arreg_number (gdbarch, regnum, value); } /* We can always read non-pseudo registers. */ @@ -656,12 +655,10 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch, && (regnum >= gdbarch_tdep (gdbarch)->a0_base) && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15)) { - gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE); - - regcache_raw_read (regcache, - gdbarch_tdep (gdbarch)->wb_regnum, buf); - regnum = arreg_number (gdbarch, regnum, - extract_unsigned_integer (buf, 4, byte_order)); + ULONGEST value; + regcache_raw_read_unsigned (regcache, + gdbarch_tdep (gdbarch)->wb_regnum, &value); + regnum = arreg_number (gdbarch, regnum, value); } /* We can always write 'core' registers. -- 2.7.4