From b17ef9dcd8d16eedf4e60565cd7701698b5a0b6b Mon Sep 17 00:00:00 2001 From: Tom de Vries via Gdb-patches Date: Wed, 6 Dec 2023 10:29:17 +0100 Subject: [gdb/symtab] Redo "Fix assert in set_length" This reverts commit 1c04f72368c ("[gdb/symtab] Fix assert in set_length"), due to a regression reported in PR29572, and implements a different fix for PR29453. The fix is to not use the CU table in a .debug_names section to construct all_units, but instead use create_all_units, and then verify the CU table from .debug_names. This also fixes PR25969, so remove the KFAIL. Approved-By: Tom Tromey Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29572 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25969 --- gdb/testsuite/gdb.dwarf2/clang-debug-names.exp | 15 +-------------- gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp | 2 +- gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp | 2 +- gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) (limited to 'gdb/testsuite/gdb.dwarf2') diff --git a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp index d6ee18b..138bd86 100644 --- a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp +++ b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp @@ -32,20 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ } 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 -} +gdb_assert { [regexp "warning: " $gdb_file_cmd_msg] == 0 } $test set cmd "ptype main" set pass_re \ diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp index ca57ecb..c6a0d01 100644 --- a/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp @@ -66,7 +66,7 @@ if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ set re \ [list \ "warning:" \ - "Section .debug_names has duplicate entry in CU table," \ + "Section .debug_names has incorrect number of CUs in CU table," \ "ignoring .debug_names."] set re [join $re] gdb_assert {[regexp $re $gdb_file_cmd_msg]} "warning" diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp index 5af32c8..d4e234c 100644 --- a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp @@ -67,7 +67,7 @@ if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ # Verify that .debug_names section is not ignored. set index [have_index $binfile] -gdb_assert { [string equal $index "debug_names"] } ".debug_names used" +gdb_assert { [string equal $index ""] } ".debug_names not used" # Verify that initially no symtab is expanded. gdb_test_no_output "maint info symtabs" diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp index d866a3c..6352e8d 100644 --- a/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp @@ -71,7 +71,7 @@ if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ set re \ [list \ "warning:" \ - "Section .debug_names has non-ascending CU table," \ + "Section .debug_names has incorrect entry in CU table," \ "ignoring .debug_names."] set re [join $re] gdb_assert {[regexp $re $gdb_file_cmd_msg]} "warning" -- cgit v1.1