diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-05-04 17:34:51 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-05-04 17:34:51 +0000 |
commit | 46654a5bcc3430a7219b2a8430578b4a5473214c (patch) | |
tree | 499f90a477c3f8c9ffa026a4768d18ca1ccbaa42 /gdb | |
parent | 54ff5908500fc0a8e83fcd8ffa779bf81eebd51b (diff) | |
download | gdb-46654a5bcc3430a7219b2a8430578b4a5473214c.zip gdb-46654a5bcc3430a7219b2a8430578b4a5473214c.tar.gz gdb-46654a5bcc3430a7219b2a8430578b4a5473214c.tar.bz2 |
2003-05-02 Andrew Cagney <cagney@redhat.com>
* sentinel-frame.c (sentinel_frame_prev_register): Replace
REGISTER_BYTE with register_offset_hack.
* regcache.c (init_regcache_descr): When REGISTER_BYTE_P, check
that REGISTER_BYTE is consistent with the regcache.
* gdbarch.sh (REGISTER_BYTE): Add a predicate.
* gdbarch.h, gdbarch.c: Regenerate.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/gdbarch.c | 19 | ||||
-rw-r--r-- | gdb/gdbarch.h | 26 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 7 | ||||
-rw-r--r-- | gdb/regcache.c | 22 | ||||
-rw-r--r-- | gdb/sentinel-frame.c | 2 |
6 files changed, 73 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 14dfacc..9de8f01 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2003-05-04 Andrew Cagney <cagney@redhat.com> + + * sentinel-frame.c (sentinel_frame_prev_register): Replace + REGISTER_BYTE with register_offset_hack. + * regcache.c (init_regcache_descr): When REGISTER_BYTE_P, check + that REGISTER_BYTE is consistent with the regcache. + * gdbarch.sh (REGISTER_BYTE): Add a predicate. + * gdbarch.h, gdbarch.c: Regenerate. + 2003-05-04 Mark Kettenis <kettenis@gnu.org> * i387-tdep.c (fxsave_offset): Add entries for %xmm8-%xmm15. diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index f4058ff..7bfd06a 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -643,7 +643,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */ /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */ /* Skip verify of register_name, invalid_p == 0 */ - /* Skip verify of register_byte, invalid_p == 0 */ + /* Skip verify of register_byte, has predicate */ /* Skip verify of register_raw_size, invalid_p == 0 */ /* Skip verify of deprecated_max_register_raw_size, has predicate */ /* Skip verify of register_virtual_size, invalid_p == 0 */ @@ -1975,6 +1975,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: push_dummy_code = 0x%08lx\n", (long) current_gdbarch->push_dummy_code); +#ifdef REGISTER_BYTE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_BYTE_P()", + XSTRING (REGISTER_BYTE_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: REGISTER_BYTE_P() = %d\n", + REGISTER_BYTE_P ()); +#endif #ifdef REGISTER_BYTE fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -3318,12 +3327,20 @@ set_gdbarch_register_bytes (struct gdbarch *gdbarch, } int +gdbarch_register_byte_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->register_byte != generic_register_byte; +} + +int gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr) { gdb_assert (gdbarch != NULL); if (gdbarch->register_byte == 0) internal_error (__FILE__, __LINE__, "gdbarch: gdbarch_register_byte invalid"); + /* Ignore predicate (gdbarch->register_byte != generic_register_byte). */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_register_byte called\n"); return gdbarch->register_byte (reg_nr); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index f00cc34..7cbb19c 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -739,6 +739,32 @@ extern void set_gdbarch_register_bytes (struct gdbarch *gdbarch, int register_by #define REGISTER_BYTES (gdbarch_register_bytes (current_gdbarch)) #endif +/* NOTE: cagney/2002-05-02: This function with predicate has a valid + (callable) initial value. As a consequence, even when the predicate + is false, the corresponding function works. This simplifies the + migration process - old code, calling REGISTER_BYTE, doesn't need to + be modified. */ + +#if defined (REGISTER_BYTE) +/* Legacy for systems yet to multi-arch REGISTER_BYTE */ +#if !defined (REGISTER_BYTE_P) +#define REGISTER_BYTE_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTE_P) +#define REGISTER_BYTE_P() (0) +#endif + +extern int gdbarch_register_byte_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_BYTE_P) +#error "Non multi-arch definition of REGISTER_BYTE" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTE_P) +#define REGISTER_BYTE_P() (gdbarch_register_byte_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTE) #define REGISTER_BYTE(reg_nr) (generic_register_byte (reg_nr)) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 37e61b0..8fa98df 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -474,7 +474,12 @@ f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr: f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0 v::REGISTER_SIZE:int:register_size v::REGISTER_BYTES:int:register_bytes -f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte::0 +# NOTE: cagney/2002-05-02: This function with predicate has a valid +# (callable) initial value. As a consequence, even when the predicate +# is false, the corresponding function works. This simplifies the +# migration process - old code, calling REGISTER_BYTE, doesn't need to +# be modified. +F::REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte # The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, # MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, # REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced diff --git a/gdb/regcache.c b/gdb/regcache.c index e0a0b89..5bfe958 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -187,6 +187,12 @@ init_regcache_descr (struct gdbarch *gdbarch) && !gdbarch_pseudo_register_write_p (gdbarch) && !gdbarch_register_type_p (gdbarch)) { + /* 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; @@ -233,21 +239,19 @@ init_regcache_descr (struct gdbarch *gdbarch) buffer. Ulgh! */ descr->sizeof_raw_registers = descr->sizeof_cooked_registers; -#if 0 - /* Sanity check. Confirm that the assumptions about gdbarch are - true. The REGCACHE_DESCR_HANDLE is set before doing the checks - so that targets using the generic methods supplied by regcache - don't go into infinite recursion trying to, again, create the - regcache. */ - set_gdbarch_data (gdbarch, regcache_descr_handle, descr); + /* Sanity check. Confirm that there is agreement between the + regcache and the target's redundant REGISTER_BYTE (new targets + should not even be defining it). */ for (i = 0; i < descr->nr_cooked_registers; i++) { + if (REGISTER_BYTE_P ()) + gdb_assert (descr->register_offset[i] == REGISTER_BYTE (i)); +#if 0 gdb_assert (descr->sizeof_register[i] == REGISTER_RAW_SIZE (i)); gdb_assert (descr->sizeof_register[i] == REGISTER_VIRTUAL_SIZE (i)); - gdb_assert (descr->register_offset[i] == REGISTER_BYTE (i)); +#endif } /* gdb_assert (descr->sizeof_raw_registers == REGISTER_BYTES (i)); */ -#endif return descr; } diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c index dab1647..dcc583e 100644 --- a/gdb/sentinel-frame.c +++ b/gdb/sentinel-frame.c @@ -56,7 +56,7 @@ sentinel_frame_prev_register (struct frame_info *next_frame, onto the corresponding hardware register. */ *optimized = 0; *lvalp = lval_register; - *addrp = REGISTER_BYTE (regnum); + *addrp = register_offset_hack (current_gdbarch, regnum); *realnum = regnum; /* If needed, find and return the value of the register. */ |