[gdb/symtab] Fix duplicate CUs in create_cus_from_debug_names_list
authorTom de Vries <tdevries@suse.de>
Fri, 5 Feb 2021 08:14:25 +0000 (09:14 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 5 Feb 2021 08:14:25 +0000 (09:14 +0100)
When running test-case gdb.dwarf2/clang-debug-names.exp, I run into the
following warning:
...
(gdb) file clang-debug-names^M
Reading symbols from clang-debug-names...^M
warning: Section .debug_aranges in clang-debug-names has duplicate \
  debug_info_offset 0xc7, ignoring .debug_aranges.^M
...

This is caused by a missing return in commit 3ee6bb113af "[gdb/symtab] Fix
incomplete CU list assert in .debug_names".

Fix this by adding the missing return, such that we have instead this warning:
...
(gdb) file clang-debug-names^M
Reading symbols from clang-debug-names...^M
warning: Section .debug_aranges in clang-debug-names \
  entry at offset 0 debug_info_offset 0 does not exists, \
  ignoring .debug_aranges.^M
...
which is a known problem filed as PR25969 - "Ignoring .debug_aranges with
clang .debug_names".

Tested on x86_64-linux.

gdb/ChangeLog:

2021-02-05  Tom de Vries  <tdevries@suse.de>

PR symtab/27307
* dwarf2/read.c (create_cus_from_debug_names_list): Add missing
return.

gdb/testsuite/ChangeLog:

2021-02-05  Tom de Vries  <tdevries@suse.de>

PR symtab/27307
* gdb.dwarf2/clang-debug-names.exp: Check file command warnings.

gdb/ChangeLog
gdb/dwarf2/read.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/clang-debug-names.exp

index 75584a794b165876a6c201e48815e441eb912541..94b5c7ae12b9c87375f50edb881174467a31a968 100644 (file)
@@ -1,3 +1,9 @@
+2021-02-05  Tom de Vries  <tdevries@suse.de>
+
+       PR symtab/27307
+       * dwarf2/read.c (create_cus_from_debug_names_list): Add missing
+       return.
+
 2021-02-05  Tom de Vries  <tdevries@suse.de>
 
        * dwarf2/read.c (create_cus_from_debug_names_list): Fix indentation.
index eb058510867322e4d6035a5a1f218aa182892c59..f60e418172cb8400149d4508fd3727879ab013d5 100644 (file)
@@ -5350,6 +5350,7 @@ create_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd,
                                         sect_off, 0);
          per_bfd->all_comp_units.push_back (per_cu);
        }
+      return;
     }
 
   sect_offset sect_off_prev;
index a449de04587fba564cf5e91834899aaa11c1274d..01539a6224811706b61e1130c8e02ea86ac4ebca 100644 (file)
@@ -1,3 +1,8 @@
+2021-02-05  Tom de Vries  <tdevries@suse.de>
+
+       PR symtab/27307
+       * gdb.dwarf2/clang-debug-names.exp: Check file command warnings.
+
 2021-02-04  Shahab Vahedi  <shahab@synopsys.com>
 
        * gdb.xml/tdesc-regs.exp: Use correct core-regs for ARC.
index 12134cf7f3e8598d1986ff01278cc22e21b587e5..5548b30e7717e36e74c3991329361b5b08cc08b3 100644 (file)
@@ -33,6 +33,22 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
     return -1
 }
 
+set test "no file command warnings"
+if { [regexp "warning: " $gdb_file_cmd_msg] } {
+    set kfail_re \
+       [concat \
+            "warning: Section .debug_aranges in \[^\r\n\]* entry" \
+            "at offset 0 debug_info_offset 0 does not exists," \
+            "ignoring \\.debug_aranges\\."]
+    if { [regexp $kfail_re $gdb_file_cmd_msg] } {
+       kfail symtab/25969 $test
+    } else {
+       fail $test
+    }
+} else {
+    pass $test
+}
+
 set cmd "ptype main"
 set pass_re \
     [multi_line \