[PATCH v2 12/13] gdb/testsuite: fix few tests after change in readnow_functions

Jan Vrany
2025-11-24T20:05:20Z

When loading a file with -readnow, GDB prints message like:

Reading symbols from some_program...
Expanding full symbols from some_program...

Commit "gdb: implement readnow_functions::expand_all_symtabs" caused
slight in output when there are any "complaints" - since after this
change, CUs are instantiated before call to expand_all_symtabs and
therefore "complaits" are printed before "Expanding full symbols...",
breaking dw2-zero-range.exp, build-id-no-debug-warning.exp and
crc_mismatch.exp

This commit fixes the issue by allowing "complaint" occur either in
between "Reading ..." and "Expanding ..." messages (currently the case
of DWARF and -readnow) or after "Expanding ..." message (the case without
-readnow).
---
.../gdb.debuginfod/build-id-no-debug-warning.exp | 10 ++++++----
gdb/testsuite/gdb.debuginfod/crc_mismatch.exp | 10 ++++++----
gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 10 ++++++++++
3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
index 7a0cfda627c..e56538f721d 100644
--- a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
+++ b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
@@ -79,10 +79,11 @@ gdb_test_no_output "set debug-file-directory ${debug_file_directory}" \

# Now load the file into GDB, and look for the warning.
set debug_file_re [string_to_regexp $build_id_debug_file]
+set expanding_re "\r\nExpanding full symbols from $debug_file_re\\.\\.\\."
gdb_test "file ${build_id_debug_file}" \
[multi_line \
- "Reading symbols from $debug_file_re\\.\\.\\." \
- "warning: \"$debug_file_re\": separate debug info file has no debug info" \
+ "Reading symbols from $debug_file_re\\.\\.\\.($expanding_re)?" \
+ "warning: \"$debug_file_re\": separate debug info file has no debug info($expanding_re)?" \
"\\(No debugging symbols found in \[^\r\n\]+\\)"] \
"load test file, expect a warning"

@@ -97,11 +98,12 @@ with_test_prefix "check styling" {

# Now load the file into GDB, and look for the warning.
set debug_file_re [style [string_to_regexp $build_id_debug_file] file]
+ set expanding_re "\r\nExpanding full symbols from $debug_file_re\\.\\.\\."

gdb_test "file ${build_id_debug_file}" \
[multi_line \
- "Reading symbols from $debug_file_re\\.\\.\\." \
- "warning: \"$debug_file_re\": separate debug info file has no debug info" \
+ "Reading symbols from $debug_file_re\\.\\.\\.($expanding_re)?" \
+ "warning: \"$debug_file_re\": separate debug info file has no debug info($expanding_re)?" \
"\\(No debugging symbols found in \[^\r\n\]+\\)"] \
"load test file, expect a warning"
}
diff --git a/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp b/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
index e44748f8205..2771d333d46 100644
--- a/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
+++ b/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
@@ -47,6 +47,8 @@ remote_exec build "mkdir $debugdir"
remote_exec build "mkdir -p [file dirname $debugfile]"
remote_exec build "mv -f [standard_output_file ${testfile}.debug] $debugfile"

+set expanding_re "\r\nExpanding full symbols from .+\\.\\.\\."
+
# Test CRC mismatch is reported.
if {[build_executable crc_mismatch.exp crc_mismatch-2 crc_mismatch-2.c debug] != -1
&& ![gdb_gnu_strip_debug [standard_output_file crc_mismatch-2]]} {
@@ -63,8 +65,8 @@ if {[build_executable crc_mismatch.exp crc_mismatch-2 crc_mismatch-2.c debug] !=
set escapedobjdirsubdir [string_to_regexp [standard_output_file {}]]
gdb_test "file [standard_output_file crc_mismatch-2]" \
[multi_line \
- "Reading symbols from ${escapedobjdirsubdir}/crc_mismatch-2\\.\\.\\." \
- "warning: the debug information found in \"${escapedobjdirsubdir}/crc_mismatch-2\\.debug\" does not match \"${escapedobjdirsubdir}/crc_mismatch-2\" \\(CRC mismatch\\)\\." \
+ "Reading symbols from ${escapedobjdirsubdir}/crc_mismatch-2\\.\\.\\.($expanding_re)?" \
+ "warning: the debug information found in \"${escapedobjdirsubdir}/crc_mismatch-2\\.debug\" does not match \"${escapedobjdirsubdir}/crc_mismatch-2\" \\(CRC mismatch\\)\\.($expanding_re)?" \
"\\(No debugging symbols found in .*\\)"] \
"CRC mismatch is reported"

@@ -79,8 +81,8 @@ if {[build_executable crc_mismatch.exp crc_mismatch-2 crc_mismatch-2.c debug] !=

gdb_test "file [standard_output_file crc_mismatch-2]" \
[multi_line \
- "Reading symbols from ${exe_file_re}\\.\\.\\." \
- "warning: the debug information found in \"${debug_file_re}\" does not match \"${exe_file_re}\" \\(CRC mismatch\\)\\." \
+ "Reading symbols from ${exe_file_re}\\.\\.\\.($expanding_re)?" \
+ "warning: the debug information found in \"${debug_file_re}\" does not match \"${exe_file_re}\" \\(CRC mismatch\\)\\.($expanding_re)?" \
"\\(No debugging symbols found in \[^\r\n\]+\\)"] \
"CRC mismatch is reported"
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
index d5faf6f74d0..79e48b24af1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
@@ -164,6 +164,16 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
set complaint_re ".debug_${ranges_sect} entry has start address of zero"
set complaint_re \
"During symbol reading: $complaint_re \\\[in module \[^\r\n\]*\\\]"
+ # Complaints may be printed before or after message
+ #
+ # Expanding full symbols from ...
+ #
+ # or
+ #
+ # Expanded full symbols from ...
+ #
+ set complaint_re \
+ "${complaint_re}(\r\nExpanding full .*)?"

set readnow_p [readnow]

--
2.51.0