diff options
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/gdbarch.c | 68 | ||||
-rw-r--r-- | gdb/gdbarch.h | 28 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 8 | ||||
-rw-r--r-- | gdb/inferior.h | 14 |
5 files changed, 117 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d03e54a..1ff13d8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,18 @@ 2000-07-24 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + * gdbarch.sh: Add FETCH_PSEUDO_REGISTER and STORE_PSEUDO_REGISTER + to the gdbarch structure. + * gdbarch.c: Regenerate. + * gdbarch.h: Regenerate. + * inferior.h (FETCH_PSEUDO_REGISTER, STORE_PSEUDO_REGISTER): + Delete macros. + * regcache.c (write_register, read_register, write_register_bytes, + write_register_gen, read_register_bytes, read_register_gen): + Rename ARCH_FECTH_PSEUDO_REGISTERS to FETCH_PSEUDO_REGISTERS and + ARCH_STORE_PSEUDO_REGISTER to STORE_PSEUDO_REGISTER. + +2000-07-24 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + * gdbarch.sh: Add NUM_PSEUDO_REGS to the gdbarch structure. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index e0953ff..31fb37f 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -182,6 +182,8 @@ struct gdbarch gdbarch_register_convertible_ftype *register_convertible; gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual; gdbarch_register_convert_to_raw_ftype *register_convert_to_raw; + 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_return_value_on_stack_ftype *return_value_on_stack; @@ -342,6 +344,8 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, + 0, /* startup_gdbarch() */ }; @@ -564,6 +568,8 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of register_convertible, invalid_p == 0 */ /* Skip verify of register_convert_to_virtual, invalid_p == 0 */ /* Skip verify of register_convert_to_raw, invalid_p == 0 */ + /* Skip verify of fetch_pseudo_register, invalid_p == 0 */ + /* Skip verify of store_pseudo_register, invalid_p == 0 */ /* Skip verify of pointer_to_address, invalid_p == 0 */ /* Skip verify of address_to_pointer, invalid_p == 0 */ /* Skip verify of return_value_on_stack, invalid_p == 0 */ @@ -980,6 +986,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "REGISTER_CONVERT_TO_RAW(type, regnum, from, to)", XSTRING (REGISTER_CONVERT_TO_RAW (type, regnum, from, to))); #endif +#if defined (FETCH_PSEUDO_REGISTER) && 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 defined (STORE_PSEUDO_REGISTER) && 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 #ifdef POINTER_TO_ADDRESS fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1569,6 +1589,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->register_convert_to_raw /*REGISTER_CONVERT_TO_RAW ()*/); #endif +#ifdef FETCH_PSEUDO_REGISTER + 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 STORE_PSEUDO_REGISTER + 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 POINTER_TO_ADDRESS if (GDB_MULTI_ARCH) fprintf_unfiltered (file, @@ -2800,6 +2834,40 @@ set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, gdbarch->register_convert_to_raw = register_convert_to_raw; } +void +gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, int regnum) +{ + if (gdbarch->fetch_pseudo_register == 0) + internal_error ("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; +} + +void +gdbarch_store_pseudo_register (struct gdbarch *gdbarch, int regnum) +{ + if (gdbarch->store_pseudo_register == 0) + internal_error ("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 5561417..51c83aa 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -604,6 +604,34 @@ extern void set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, gdbarc #endif /* Default (function) for non- multi-arch platforms. */ +#if (GDB_MULTI_ARCH == 0) && !defined (FETCH_PSEUDO_REGISTER) +#define FETCH_PSEUDO_REGISTER(regnum) (internal_error ("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 +#if (GDB_MULTI_ARCH > 1) || !defined (FETCH_PSEUDO_REGISTER) +#define FETCH_PSEUDO_REGISTER(regnum) (gdbarch_fetch_pseudo_register (current_gdbarch, regnum)) +#endif +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (GDB_MULTI_ARCH == 0) && !defined (STORE_PSEUDO_REGISTER) +#define STORE_PSEUDO_REGISTER(regnum) (internal_error ("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 +#if (GDB_MULTI_ARCH > 1) || !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 == 0) && !defined (POINTER_TO_ADDRESS) #define POINTER_TO_ADDRESS(type, buf) (unsigned_pointer_to_address (type, buf)) #endif diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index b7c592c..5925ecd 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -338,6 +338,14 @@ f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, f:1:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0 f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0 f:2:REGISTER_CONVERT_TO_RAW:void:register_convert_to_raw:struct type *type, int regnum, char *from, char *to:type, regnum, from, to:::0::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:::0::0 +#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:::0::0 # 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/inferior.h b/gdb/inferior.h index eb947d1..0281d24 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -59,20 +59,6 @@ extern void write_inferior_status_register (struct inferior_status #define ARCH_NUM_REGS NUM_REGS #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. FIXME: move into gdbarch.[ch]. */ -#ifndef ARCH_FETCH_PSEUDO_REGISTERS -#define ARCH_FETCH_PSEUDO_REGISTERS(REGNUM) /* no-op */ -#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. FIXME: move into gdbarch.[ch]. */ -#ifndef ARCH_STORE_PSEUDO_REGISTERS -#define ARCH_STORE_PSEUDO_REGISTERS(REGNUM) /* no-op */ -#endif - extern void set_sigint_trap (void); extern void clear_sigint_trap (void); |