diff options
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/gdbarch.c | 38 | ||||
-rw-r--r-- | gdb/gdbarch.h | 40 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 4 | ||||
-rw-r--r-- | gdb/regcache.c | 19 |
5 files changed, 96 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7a39436..a4b9537 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2003-07-03 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (REGISTER_RAW_SIZE, REGISTER_VIRTUAL_SIZE): Add + predicate. + * gdbarch.h, gdbarch.c: Re-generate. + * regcache.c (init_regcache_descr): Use legacy code when either + REGISTER_BYTE or REGISTER_RAW_SIZE is set. + 2003-07-02 Daniel Jacobowitz <drow@mvista.com> * NEWS: Move "set logging" entry into GDB 6.0 section. diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 87585dd..966e373 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -641,8 +641,8 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of register_type, has predicate */ /* Skip verify of deprecated_register_virtual_type, has predicate */ /* Skip verify of deprecated_register_byte, has predicate */ - /* Skip verify of deprecated_register_raw_size, invalid_p == 0 */ - /* Skip verify of deprecated_register_virtual_size, invalid_p == 0 */ + /* Skip verify of deprecated_register_raw_size, has predicate */ + /* Skip verify of deprecated_register_virtual_size, has predicate */ /* Skip verify of deprecated_max_register_raw_size, has predicate */ /* Skip verify of deprecated_max_register_virtual_size, has predicate */ /* Skip verify of unwind_dummy_id, has predicate */ @@ -2147,6 +2147,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->register_name /*REGISTER_NAME ()*/); #endif +#ifdef REGISTER_RAW_SIZE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_RAW_SIZE_P()", + XSTRING (REGISTER_RAW_SIZE_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: REGISTER_RAW_SIZE_P() = %d\n", + REGISTER_RAW_SIZE_P ()); +#endif #ifdef REGISTER_RAW_SIZE fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2191,6 +2200,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: register_type = 0x%08lx\n", (long) current_gdbarch->register_type); +#ifdef REGISTER_VIRTUAL_SIZE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_VIRTUAL_SIZE_P()", + XSTRING (REGISTER_VIRTUAL_SIZE_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: REGISTER_VIRTUAL_SIZE_P() = %d\n", + REGISTER_VIRTUAL_SIZE_P ()); +#endif #ifdef REGISTER_VIRTUAL_SIZE fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -3386,12 +3404,20 @@ set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, } int +gdbarch_deprecated_register_raw_size_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_register_raw_size != generic_register_size; +} + +int gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, int reg_nr) { gdb_assert (gdbarch != NULL); if (gdbarch->deprecated_register_raw_size == 0) internal_error (__FILE__, __LINE__, "gdbarch: gdbarch_deprecated_register_raw_size invalid"); + /* Ignore predicate (gdbarch->deprecated_register_raw_size != generic_register_size). */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_raw_size called\n"); return gdbarch->deprecated_register_raw_size (reg_nr); @@ -3405,12 +3431,20 @@ set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, } int +gdbarch_deprecated_register_virtual_size_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_register_virtual_size != generic_register_size; +} + +int gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, int reg_nr) { gdb_assert (gdbarch != NULL); if (gdbarch->deprecated_register_virtual_size == 0) internal_error (__FILE__, __LINE__, "gdbarch: gdbarch_deprecated_register_virtual_size invalid"); + /* Ignore predicate (gdbarch->deprecated_register_virtual_size != generic_register_size). */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_virtual_size called\n"); return gdbarch->deprecated_register_virtual_size (reg_nr); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 4dd7cfa9..0242d5b 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -709,6 +709,26 @@ extern void set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, gdbar DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print registers. */ +#if defined (REGISTER_RAW_SIZE) +/* Legacy for systems yet to multi-arch REGISTER_RAW_SIZE */ +#if !defined (REGISTER_RAW_SIZE_P) +#define REGISTER_RAW_SIZE_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE_P) +#define REGISTER_RAW_SIZE_P() (0) +#endif + +extern int gdbarch_deprecated_register_raw_size_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_RAW_SIZE_P) +#error "Non multi-arch definition of REGISTER_RAW_SIZE" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_RAW_SIZE_P) +#define REGISTER_RAW_SIZE_P() (gdbarch_deprecated_register_raw_size_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE) #define REGISTER_RAW_SIZE(reg_nr) (generic_register_size (reg_nr)) @@ -729,6 +749,26 @@ extern void set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, g DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print registers. */ +#if defined (REGISTER_VIRTUAL_SIZE) +/* Legacy for systems yet to multi-arch REGISTER_VIRTUAL_SIZE */ +#if !defined (REGISTER_VIRTUAL_SIZE_P) +#define REGISTER_VIRTUAL_SIZE_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE_P) +#define REGISTER_VIRTUAL_SIZE_P() (0) +#endif + +extern int gdbarch_deprecated_register_virtual_size_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_SIZE_P) +#error "Non multi-arch definition of REGISTER_VIRTUAL_SIZE" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_SIZE_P) +#define REGISTER_VIRTUAL_SIZE_P() (gdbarch_deprecated_register_virtual_size_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE) #define REGISTER_VIRTUAL_SIZE(reg_nr) (generic_register_size (reg_nr)) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 494b916..982b8a5 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -486,12 +486,12 @@ F::REGISTER_BYTE:int:deprecated_register_byte:int reg_nr:reg_nr::generic_registe # sizes agree with the value computed from REGISTER_TYPE, # DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print # registers. -f:2:REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 +F:2:REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size # If all registers have identical raw and virtual sizes and those # sizes agree with the value computed from REGISTER_TYPE, # DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print # registers. -f:2:REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 +F:2:REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size # DEPRECATED_MAX_REGISTER_RAW_SIZE can be deleted. It has been # replaced by the constant MAX_REGISTER_SIZE. V:2:DEPRECATED_MAX_REGISTER_RAW_SIZE:int:deprecated_max_register_raw_size diff --git a/gdb/regcache.c b/gdb/regcache.c index 509390f..ce1d811 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -178,16 +178,17 @@ init_regcache_descr (struct gdbarch *gdbarch) /* If an old style architecture, fill in the remainder of the register cache descriptor using the register macros. */ - if (!gdbarch_pseudo_register_read_p (gdbarch) - && !gdbarch_pseudo_register_write_p (gdbarch) - && !gdbarch_register_type_p (gdbarch)) + /* NOTE: cagney/2003-06-29: If either of REGISTER_BYTE or + REGISTER_RAW_SIZE are still present, things are most likely + totally screwed. Ex: an architecture with raw register sizes + smaller than what REGISTER_BYTE indicates; non monotonic + REGISTER_BYTE values. For GDB 6 check for these nasty methods + and fall back to legacy code when present. Sigh! */ + if ((!gdbarch_pseudo_register_read_p (gdbarch) + && !gdbarch_pseudo_register_write_p (gdbarch) + && !gdbarch_register_type_p (gdbarch)) + || REGISTER_BYTE_P () || REGISTER_RAW_SIZE_P ()) { - /* NOTE: cagney/2003-05-02: Don't add a test for REGISTER_BYTE_P - to the above. Doing that would cause all the existing - architectures to revert back to the legacy regcache - mechanisms, and that is not a good thing. Instead just, - later, check that the register cache's layout is consistent - with REGISTER_BYTE. */ descr->legacy_p = 1; init_legacy_regcache_descr (gdbarch, descr); return descr; |