]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Ignore .debug_types when reading .debug_aranges
authorTom Tromey <tom@tromey.com>
Sun, 8 Aug 2021 15:36:12 +0000 (09:36 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 10 Aug 2021 21:33:34 +0000 (15:33 -0600)
I noticed that the fission-reread.exp test case can cause a complaint
when run with --target_board=cc-with-debug-names:

warning: Section .debug_aranges in [...]/fission-reread has duplicate debug_info_offset 0x0, ignoring .debug_aranges.

The bug here is that this executable has both .debug_info and
.debug_types, and both have a CU at offset 0x0.  This triggers the
duplicate warning.

Because .debug_types doesn't provide any address ranges, these CUs can
be ignored.  That is, this bug turns out to be another regression from
the info/types merger patch.

This patch fixes the problem by having this loop igore type units.
fission-reread.exp is updated to test for the bug.

gdb/dwarf2/read.c
gdb/testsuite/gdb.dwarf2/fission-reread.exp

index 8dc2be6f176b05a3ed7784cc373d44ef472d0b52..2e85deeaa39d4377e0cd8a6fd8033c1f8e069b73 100644 (file)
@@ -2536,6 +2536,12 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
     debug_info_offset_to_per_cu;
   for (const auto &per_cu : per_bfd->all_comp_units)
     {
+      /* A TU will not need aranges, and skipping them here is an easy
+        way of ignoring .debug_types -- and possibly seeing a
+        duplicate section offset -- entirely.  */
+      if (per_cu->is_debug_types)
+       continue;
+
       const auto insertpair
        = debug_info_offset_to_per_cu.emplace (per_cu->sect_off,
                                               per_cu.get ());
index 16a139eb0cd7414c7188c908fada8bba3b5bda98..661e90b2f2122be2925bee75d5c50d57419d9657 100644 (file)
@@ -47,7 +47,8 @@ if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" $options \
     return -1
 }
 
-clean_restart $binfile
+clean_restart
+gdb_load_no_complaints $binfile
 
 gdb_test "break -q main" "Breakpoint.*at.*"