From 5c27f28ad0349fdd0183f029766db7097280635c Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 7 Aug 2002 16:01:58 +0000 Subject: [PATCH] 2002-08-07 Andrew Cagney * regcache.c (pseudo_register): Delete function. (fetch_register): Delete function. (store_register): Delete function. (regcache_raw_read, legacy_read_register_gen): Use target_fetch_registers instead of fetch_register. (legacy_write_register_gen, regcache_raw_write): Use target_store_register instead of store_register. (write_register_bytes): Ditto. * gdbarch.sh (FETCH_PSEUDO_REGISTER): Delete. (STORE_PSEUDO_REGISTER): Delete. * gdbarch.h, gdbarch.c: Regenerate. --- gdb/ChangeLog | 15 +++++++++ gdb/gdbarch.c | 86 -------------------------------------------------- gdb/gdbarch.h | 82 ----------------------------------------------- gdb/gdbarch.sh | 8 ----- gdb/regcache.c | 50 +++-------------------------- 5 files changed, 20 insertions(+), 221 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dd9dbcc606a..a9ead697e0a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2002-08-07 Andrew Cagney + + * regcache.c (pseudo_register): Delete function. + (fetch_register): Delete function. + (store_register): Delete function. + (regcache_raw_read, legacy_read_register_gen): Use + target_fetch_registers instead of fetch_register. + (legacy_write_register_gen, regcache_raw_write): Use + target_store_register instead of store_register. + (write_register_bytes): Ditto. + + * gdbarch.sh (FETCH_PSEUDO_REGISTER): Delete. + (STORE_PSEUDO_REGISTER): Delete. + * gdbarch.h, gdbarch.c: Regenerate. + 2002-08-06 Corinna Vinschen * cli/cli-dump.c (add_dump_command): Explicitely use "b" flag to diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index d7987af5e94..93a5c0e5aff 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -204,8 +204,6 @@ struct gdbarch gdbarch_convert_register_p_ftype *convert_register_p; gdbarch_register_to_value_ftype *register_to_value; gdbarch_value_to_register_ftype *value_to_register; - gdbarch_fetch_pseudo_register_ftype *fetch_pseudo_register; - gdbarch_store_pseudo_register_ftype *store_pseudo_register; gdbarch_pointer_to_address_ftype *pointer_to_address; gdbarch_address_to_pointer_ftype *address_to_pointer; gdbarch_integer_to_address_ftype *integer_to_address; @@ -408,8 +406,6 @@ struct gdbarch startup_gdbarch = 0, 0, 0, - 0, - 0, generic_in_function_epilogue_p, construct_inferior_arguments, 0, @@ -696,8 +692,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of convert_register_p, invalid_p == 0 */ /* Skip verify of register_to_value, invalid_p == 0 */ /* Skip verify of value_to_register, invalid_p == 0 */ - /* Skip verify of fetch_pseudo_register, has predicate */ - /* Skip verify of store_pseudo_register, has predicate */ /* Skip verify of pointer_to_address, invalid_p == 0 */ /* Skip verify of address_to_pointer, invalid_p == 0 */ /* Skip verify of integer_to_address, has predicate */ @@ -1179,20 +1173,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED = %d\n", EXTRA_STACK_ALIGNMENT_NEEDED); #endif -#ifdef FETCH_PSEUDO_REGISTER -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FETCH_PSEUDO_REGISTER(regnum)", - XSTRING (FETCH_PSEUDO_REGISTER (regnum))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: FETCH_PSEUDO_REGISTER = 0x%08lx\n", - (long) current_gdbarch->fetch_pseudo_register - /*FETCH_PSEUDO_REGISTER ()*/); -#endif #ifdef FIX_CALL_DUMMY #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -1928,20 +1908,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->stack_align /*STACK_ALIGN ()*/); #endif -#ifdef STORE_PSEUDO_REGISTER -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "STORE_PSEUDO_REGISTER(regnum)", - XSTRING (STORE_PSEUDO_REGISTER (regnum))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: STORE_PSEUDO_REGISTER = 0x%08lx\n", - (long) current_gdbarch->store_pseudo_register - /*STORE_PSEUDO_REGISTER ()*/); -#endif #ifdef STORE_RETURN_VALUE #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -3641,58 +3607,6 @@ set_gdbarch_value_to_register (struct gdbarch *gdbarch, gdbarch->value_to_register = value_to_register; } -int -gdbarch_fetch_pseudo_register_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - return gdbarch->fetch_pseudo_register != 0; -} - -void -gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, int regnum) -{ - gdb_assert (gdbarch != NULL); - if (gdbarch->fetch_pseudo_register == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_fetch_pseudo_register invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_pseudo_register called\n"); - gdbarch->fetch_pseudo_register (regnum); -} - -void -set_gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, - gdbarch_fetch_pseudo_register_ftype fetch_pseudo_register) -{ - gdbarch->fetch_pseudo_register = fetch_pseudo_register; -} - -int -gdbarch_store_pseudo_register_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - return gdbarch->store_pseudo_register != 0; -} - -void -gdbarch_store_pseudo_register (struct gdbarch *gdbarch, int regnum) -{ - gdb_assert (gdbarch != NULL); - if (gdbarch->store_pseudo_register == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_store_pseudo_register invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_store_pseudo_register called\n"); - gdbarch->store_pseudo_register (regnum); -} - -void -set_gdbarch_store_pseudo_register (struct gdbarch *gdbarch, - gdbarch_store_pseudo_register_ftype store_pseudo_register) -{ - gdbarch->store_pseudo_register = store_pseudo_register; -} - CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index da33ef3d424..57fb0cf71f5 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1291,88 +1291,6 @@ extern void set_gdbarch_value_to_register (struct gdbarch *gdbarch, gdbarch_valu #endif #endif -/* This function is called when the value of a pseudo-register needs to - be updated. Typically it will be defined on a per-architecture - basis. */ - -#if defined (FETCH_PSEUDO_REGISTER) -/* Legacy for systems yet to multi-arch FETCH_PSEUDO_REGISTER */ -#if !defined (FETCH_PSEUDO_REGISTER_P) -#define FETCH_PSEUDO_REGISTER_P() (1) -#endif -#endif - -/* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (FETCH_PSEUDO_REGISTER_P) -#define FETCH_PSEUDO_REGISTER_P() (0) -#endif - -extern int gdbarch_fetch_pseudo_register_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FETCH_PSEUDO_REGISTER_P) -#error "Non multi-arch definition of FETCH_PSEUDO_REGISTER" -#endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FETCH_PSEUDO_REGISTER_P) -#define FETCH_PSEUDO_REGISTER_P() (gdbarch_fetch_pseudo_register_p (current_gdbarch)) -#endif - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (FETCH_PSEUDO_REGISTER) -#define FETCH_PSEUDO_REGISTER(regnum) (internal_error (__FILE__, __LINE__, "FETCH_PSEUDO_REGISTER"), 0) -#endif - -typedef void (gdbarch_fetch_pseudo_register_ftype) (int regnum); -extern void gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, int regnum); -extern void set_gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, gdbarch_fetch_pseudo_register_ftype *fetch_pseudo_register); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FETCH_PSEUDO_REGISTER) -#error "Non multi-arch definition of FETCH_PSEUDO_REGISTER" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FETCH_PSEUDO_REGISTER) -#define FETCH_PSEUDO_REGISTER(regnum) (gdbarch_fetch_pseudo_register (current_gdbarch, regnum)) -#endif -#endif - -/* This function is called when the value of a pseudo-register needs to - be set or stored. Typically it will be defined on a - per-architecture basis. */ - -#if defined (STORE_PSEUDO_REGISTER) -/* Legacy for systems yet to multi-arch STORE_PSEUDO_REGISTER */ -#if !defined (STORE_PSEUDO_REGISTER_P) -#define STORE_PSEUDO_REGISTER_P() (1) -#endif -#endif - -/* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (STORE_PSEUDO_REGISTER_P) -#define STORE_PSEUDO_REGISTER_P() (0) -#endif - -extern int gdbarch_store_pseudo_register_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (STORE_PSEUDO_REGISTER_P) -#error "Non multi-arch definition of STORE_PSEUDO_REGISTER" -#endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STORE_PSEUDO_REGISTER_P) -#define STORE_PSEUDO_REGISTER_P() (gdbarch_store_pseudo_register_p (current_gdbarch)) -#endif - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (STORE_PSEUDO_REGISTER) -#define STORE_PSEUDO_REGISTER(regnum) (internal_error (__FILE__, __LINE__, "STORE_PSEUDO_REGISTER"), 0) -#endif - -typedef void (gdbarch_store_pseudo_register_ftype) (int regnum); -extern void gdbarch_store_pseudo_register (struct gdbarch *gdbarch, int regnum); -extern void set_gdbarch_store_pseudo_register (struct gdbarch *gdbarch, gdbarch_store_pseudo_register_ftype *store_pseudo_register); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (STORE_PSEUDO_REGISTER) -#error "Non multi-arch definition of STORE_PSEUDO_REGISTER" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STORE_PSEUDO_REGISTER) -#define STORE_PSEUDO_REGISTER(regnum) (gdbarch_store_pseudo_register (current_gdbarch, regnum)) -#endif -#endif - /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (POINTER_TO_ADDRESS) #define POINTER_TO_ADDRESS(type, buf) (unsigned_pointer_to_address (type, buf)) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 5db9df07ceb..141eba31b91 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -514,14 +514,6 @@ f:2:REGISTER_CONVERT_TO_RAW:void:register_convert_to_raw:struct type *type, int f:1:CONVERT_REGISTER_P:int:convert_register_p:int regnum:regnum::0:legacy_convert_register_p::0 f:1:REGISTER_TO_VALUE:void:register_to_value:int regnum, struct type *type, char *from, char *to:regnum, type, from, to::0:legacy_register_to_value::0 f:1:VALUE_TO_REGISTER:void:value_to_register:struct type *type, int regnum, char *from, char *to:type, regnum, from, to::0:legacy_value_to_register::0 -# This function is called when the value of a pseudo-register needs to -# be updated. Typically it will be defined on a per-architecture -# basis. -F:2:FETCH_PSEUDO_REGISTER:void:fetch_pseudo_register:int regnum:regnum: -# This function is called when the value of a pseudo-register needs to -# be set or stored. Typically it will be defined on a -# per-architecture basis. -F:2:STORE_PSEUDO_REGISTER:void:store_pseudo_register:int regnum:regnum: # f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, void *buf:type, buf:::unsigned_pointer_to_address::0 f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr:::unsigned_address_to_pointer::0 diff --git a/gdb/regcache.c b/gdb/regcache.c index bd1018a9bb2..acda8320ff9 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -470,46 +470,6 @@ real_register (int regnum) return regnum >= 0 && regnum < NUM_REGS; } -/* Return whether register REGNUM is a pseudo register. */ - -static int -pseudo_register (int regnum) -{ - return regnum >= NUM_REGS && regnum < NUM_REGS + NUM_PSEUDO_REGS; -} - -/* Fetch register REGNUM into the cache. */ - -static void -fetch_register (int regnum) -{ - /* NOTE: cagney/2001-12-04: Legacy targets were using fetch/store - pseudo-register as a way of handling registers that needed to be - constructed from one or more raw registers. New targets instead - use gdbarch register read/write. */ - if (FETCH_PSEUDO_REGISTER_P () - && pseudo_register (regnum)) - FETCH_PSEUDO_REGISTER (regnum); - else - target_fetch_registers (regnum); -} - -/* Write register REGNUM cached value to the target. */ - -static void -store_register (int regnum) -{ - /* NOTE: cagney/2001-12-04: Legacy targets were using fetch/store - pseudo-register as a way of handling registers that needed to be - constructed from one or more raw registers. New targets instead - use gdbarch register read/write. */ - if (STORE_PSEUDO_REGISTER_P () - && pseudo_register (regnum)) - STORE_PSEUDO_REGISTER (regnum); - else - target_store_registers (regnum); -} - /* Low level examining and depositing of registers. The caller is responsible for making sure that the inferior is @@ -668,7 +628,7 @@ legacy_read_register_gen (int regnum, char *myaddr) } if (!register_cached (regnum)) - fetch_register (regnum); + target_fetch_registers (regnum); memcpy (myaddr, register_buffer (current_regcache, regnum), REGISTER_RAW_SIZE (regnum)); @@ -702,7 +662,7 @@ regcache_raw_read (struct regcache *regcache, int regnum, void *buf) registers_ptid = inferior_ptid; } if (!register_cached (regnum)) - fetch_register (regnum); + target_fetch_registers (regnum); } /* Copy the value directly into the register cache. */ memcpy (buf, (regcache->raw_registers @@ -772,7 +732,7 @@ legacy_write_register_gen (int regnum, const void *myaddr) memcpy (register_buffer (current_regcache, regnum), myaddr, size); set_register_cached (regnum, 1); - store_register (regnum); + target_store_registers (regnum); } void @@ -827,7 +787,7 @@ regcache_raw_write (struct regcache *regcache, int regnum, const void *buf) memcpy (register_buffer (regcache, regnum), buf, regcache->descr->sizeof_register[regnum]); regcache->raw_register_valid_p[regnum] = 1; - store_register (regnum); + target_store_registers (regnum); } void @@ -903,7 +863,7 @@ write_register_bytes (int myregstart, char *myaddr, int inlen) myaddr + (overlapstart - myregstart), overlapend - overlapstart); - store_register (regnum); + target_store_registers (regnum); } } } -- 2.30.2