extract/store integer function template
authorYao Qi <yao.qi@linaro.org>
Fri, 16 Jun 2017 14:38:42 +0000 (15:38 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 16 Jun 2017 14:38:42 +0000 (15:38 +0100)
commit6f98355cda4ac718855d247fd942553b1706549b
tree060aa7cfb453b4fb17d91c615fa15a30739013f5
parente197589b72e7b7b2db95c63acd58abb574b4249c
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.
gdb/ChangeLog
gdb/defs.h
gdb/findvar.c
gdb/regcache.c
gdb/regcache.h
gdb/sh64-tdep.c
This page took 0.026864 seconds and 4 git commands to generate.