From 68ce205943e0821eacd8028881ced3607cc83c0d Mon Sep 17 00:00:00 2001 From: Antoine Tremblay Date: Fri, 18 Dec 2015 11:33:59 -0500 Subject: Share regcache function regcache_raw_read_unsigned This patch is in preparation for software single step support on ARM in GDBServer. It adds a new shared function regcache_raw_read_unsigned and regcache_raw_get_unsigned so that GDB and GDBServer can use the same call to fetch a raw register into an integer. No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (SFILES): Append common/common-regcache.c. (COMMON_OBS): Append common/common-regcache.o. (common-regcache.o): New rule. * common/common-regcache.h (register_status) New enum. (regcache_raw_read_unsigned): New declaration. * common/common-regcache.c: New file. * regcache.h (enum register_status): Move to common-regcache.h. (regcache_raw_read_unsigned): Likewise. (regcache_raw_get_unsigned): Likewise. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append common/common-regcache.c. (OBS): Append common-regcache.o. (common-regcache.o): New rule. * regcache.c (init_register_cache): Initialize cache to REG_UNAVAILABLE. (regcache_raw_read_unsigned): New function. * regcache.h (REG_UNAVAILABLE, REG_VALID): Replaced by shared register_status enum. --- gdb/regcache.h | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'gdb/regcache.h') diff --git a/gdb/regcache.h b/gdb/regcache.h index c9d9a7df0f4..36bfef88ea3 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -47,24 +47,6 @@ extern struct gdbarch *get_regcache_arch (const struct regcache *regcache); extern struct address_space *get_regcache_aspace (const struct regcache *); -enum register_status - { - /* The register value is not in the cache, and we don't know yet - whether it's available in the target (or traceframe). */ - REG_UNKNOWN = 0, - - /* The register value is valid and cached. */ - REG_VALID = 1, - - /* The register value is unavailable. E.g., we're inspecting a - traceframe, and this register wasn't collected. Note that this - is different a different "unavailable" from saying the register - does not exist in the target's architecture --- in that case, - the target should have given us a target description that does - not include the register in the first place. */ - REG_UNAVAILABLE = -1 - }; - enum register_status regcache_register_status (const struct regcache *regcache, int regnum); @@ -78,12 +60,6 @@ void regcache_raw_write (struct regcache *regcache, int rawnum, extern enum register_status regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val); -extern enum register_status - regcache_raw_read_unsigned (struct regcache *regcache, - int regnum, ULONGEST *val); - -ULONGEST regcache_raw_get_unsigned (struct regcache *regcache, - int regnum); extern void regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val); -- cgit v1.2.1