aboutsummaryrefslogtreecommitdiff
path: root/gdb/sh64-tdep.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-06-16 15:38:42 +0100
committerYao Qi <yao.qi@linaro.org>2017-06-16 15:38:42 +0100
commit6f98355cda4ac718855d247fd942553b1706549b (patch)
tree060aa7cfb453b4fb17d91c615fa15a30739013f5 /gdb/sh64-tdep.c
parente197589b72e7b7b2db95c63acd58abb574b4249c (diff)
downloadgdb-6f98355cda4ac718855d247fd942553b1706549b.zip
gdb-6f98355cda4ac718855d247fd942553b1706549b.tar.gz
gdb-6f98355cda4ac718855d247fd942553b1706549b.tar.bz2
extract/store integer function template
This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
Diffstat (limited to 'gdb/sh64-tdep.c')
-rw-r--r--gdb/sh64-tdep.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index dd18e9f..5aeb235 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -1665,11 +1665,11 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
*/
/* *INDENT-ON* */
/* Get FPSCR as an int. */
- status = regcache->raw_read_unsigned (fpscr_base_regnum, &fpscr_value);
+ status = regcache->raw_read (fpscr_base_regnum, &fpscr_value);
if (status != REG_VALID)
return status;
/* Get SR as an int. */
- status = regcache->raw_read_unsigned (sr_base_regnum, &sr_value);
+ status = regcache->raw_read (sr_base_regnum, &sr_value);
if (status != REG_VALID)
return status;
/* Build the new value. */
@@ -1847,15 +1847,15 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
fpscr_value = fpscr_c_value & fpscr_mask;
sr_value = (fpscr_value & sr_mask) >> 6;
- regcache->raw_read_unsigned (fpscr_base_regnum, &old_fpscr_value);
+ regcache->raw_read (fpscr_base_regnum, &old_fpscr_value);
old_fpscr_value &= 0xfffc0002;
fpscr_value |= old_fpscr_value;
- regcache->raw_write_unsigned (fpscr_base_regnum, fpscr_value);
+ regcache->raw_write (fpscr_base_regnum, fpscr_value);
- regcache->raw_read_unsigned (sr_base_regnum, &old_sr_value);
+ regcache->raw_read (sr_base_regnum, &old_sr_value);
old_sr_value &= 0xffff8fff;
sr_value |= old_sr_value;
- regcache->raw_write_unsigned (sr_base_regnum, sr_value);
+ regcache->raw_write (sr_base_regnum, sr_value);
}
else if (reg_nr == FPUL_C_REGNUM)