From 8da614df6415a7aa01ba8ebf74acef32183266c4 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 6 Aug 2010 19:02:15 +0000 Subject: * dwarf2-frame.c (struct dwarf2_cie): Add ptr_size member. Throughout, call read_encoded_value with ptr_size rather than addr_size. (decode_frame_entry_1): Remove redundant setting of addr_size. Call gdbarch_dwarf2_addr_size rather than gdbarch_ptr_bit to determine addr_size in Dwarf versions < 4. Set ptr_size dependent on examined frame section. Add comment to explain why. * gdbarch.sh (dwarf2_addr_size): Define as variable. Add lengthy comment to explain usage. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * xstormy16-tdep.c (xstormy16_gdbarch_init): Set dwarf2_addr_size to 4. --- gdb/gdbarch.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'gdb/gdbarch.c') diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 103abcb..4ff9f54 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -155,6 +155,7 @@ struct gdbarch const struct floatformat ** long_double_format; int ptr_bit; int addr_bit; + int dwarf2_addr_size; int char_signed; gdbarch_read_pc_ftype *read_pc; gdbarch_write_pc_ftype *write_pc; @@ -305,6 +306,7 @@ struct gdbarch startup_gdbarch = 0, /* long_double_format */ 8 * sizeof (void*), /* ptr_bit */ 8 * sizeof (void*), /* addr_bit */ + sizeof (void*), /* dwarf2_addr_size */ 1, /* char_signed */ 0, /* read_pc */ 0, /* write_pc */ @@ -582,6 +584,8 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of ptr_bit, invalid_p == 0 */ if (gdbarch->addr_bit == 0) gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch); + if (gdbarch->dwarf2_addr_size == 0) + gdbarch->dwarf2_addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; if (gdbarch->char_signed == -1) gdbarch->char_signed = 1; /* Skip verify of read_pc, has predicate */ @@ -868,6 +872,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: dummy_id = <%s>\n", host_address_to_string (gdbarch->dummy_id)); fprintf_unfiltered (file, + "gdbarch_dump: dwarf2_addr_size = %s\n", + plongest (gdbarch->dwarf2_addr_size)); + fprintf_unfiltered (file, "gdbarch_dump: dwarf2_reg_to_regnum = <%s>\n", host_address_to_string (gdbarch->dwarf2_reg_to_regnum)); fprintf_unfiltered (file, @@ -1556,6 +1563,24 @@ set_gdbarch_addr_bit (struct gdbarch *gdbarch, } int +gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Check variable changed from pre-default. */ + gdb_assert (gdbarch->dwarf2_addr_size != 0); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_addr_size called\n"); + return gdbarch->dwarf2_addr_size; +} + +void +set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch, + int dwarf2_addr_size) +{ + gdbarch->dwarf2_addr_size = dwarf2_addr_size; +} + +int gdbarch_char_signed (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); -- cgit v1.1