diff options
-rw-r--r-- | gdb/dwarf2/read.c | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/fission-macro.exp | 8 |
2 files changed, 17 insertions, 3 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4503977..9e3d13c 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -20832,7 +20832,17 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, str_offsets_section = &cu->dwo_unit->dwo_file ->sections.str_offsets; str_section = &cu->dwo_unit->dwo_file->sections.str; - str_offsets_base = cu->header.addr_size; + if (cu->header.version <= 4) + str_offsets_base = 0; + else + { + bfd *abfd = str_offsets_section->get_bfd_owner (); + unsigned int bytes_read = 0; + read_initial_length (abfd, str_offsets_section->buffer, &bytes_read, + false); + const bool is_dwarf64 = bytes_read != 4; + str_offsets_base = is_dwarf64 ? 16 : 8; + } } else { diff --git a/gdb/testsuite/gdb.base/fission-macro.exp b/gdb/testsuite/gdb.base/fission-macro.exp index 705e3dd..9e5d5c0 100644 --- a/gdb/testsuite/gdb.base/fission-macro.exp +++ b/gdb/testsuite/gdb.base/fission-macro.exp @@ -66,8 +66,12 @@ proc do_tests { dwarf_version dwarf_bits strict_dwarf } { gdb_test "info macro FOURTH" "#define FOURTH 4" } -foreach_with_prefix dwarf_version {5} { - foreach_with_prefix dwarf_bits {32} { +foreach_with_prefix dwarf_version {4 5} { + if { $dwarf_version == 4 && [gcc_major_version] < 15 } { + # Gcc does not contain fix for PR debug/115066. + continue + } + foreach_with_prefix dwarf_bits {32 64} { foreach_with_prefix strict_dwarf {0 1} { do_tests $dwarf_version $dwarf_bits $strict_dwarf } |