aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.dwarf2
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2')
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwzbuildid.exp159
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl184
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwzbuildid5.exp17
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwznolink.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp71
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp75
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp70
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp70
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp81
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl (renamed from gdb/testsuite/gdb.dwarf2/macro-source-path.exp)250
-rw-r--r--gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp2
11 files changed, 576 insertions, 405 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
index 055e69c..080e999 100644
--- a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
@@ -13,160 +13,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-load_lib dwarf.exp
-
-# This test can only be run on targets which support DWARF-2 and use gas.
-require dwarf2_support
-
-# No remote host testing either.
-require {!is_remote host}
-
-
-# Lots of source files since we test a few cases and make new files
-# for each.
-# The tests are:
-# ok - the main file refers to a dwz and the buildids match
-# mismatch - the buildids do not match
-# fallback - the buildids do not match but a match is found via buildid
-standard_testfile main.c \
- dwzbuildid-ok-base.S dwzbuildid-ok-sep.S \
- dwzbuildid-mismatch-base.S dwzbuildid-mismatch-sep.S \
- dwzbuildid-fallback-base.S dwzbuildid-fallback-sep.S \
- dwzbuildid-fallback-ok.S
-
-# Write some assembly that just has a .gnu_debugaltlink section.
-proc write_just_debugaltlink {filename dwzname buildid} {
- set asm_file [standard_output_file $filename]
-
- Dwarf::assemble $asm_file {
- upvar dwzname dwzname
- upvar buildid buildid
-
- gnu_debugaltlink $dwzname $buildid
-
- # Only the DWARF reader checks .gnu_debugaltlink, so make sure
- # there is a bit of DWARF in here.
- cu { label cu_start } {
- compile_unit {{language @DW_LANG_C}} {
- }
- }
- aranges {} cu_start {
- arange {} 0 0
- }
- }
-}
-
-# Write some DWARF that also sets the buildid.
-proc write_dwarf_file {filename buildid {value 99}} {
- set asm_file [standard_output_file $filename]
-
- Dwarf::assemble $asm_file {
- declare_labels int_label int_label2
-
- upvar buildid buildid
- upvar value value
-
- build_id $buildid
-
- cu { label cu_start } {
- compile_unit {{language @DW_LANG_C}} {
- int_label2: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
- }
-
- constant {
- {name the_int}
- {type :$int_label2}
- {const_value $value data1}
- }
- }
- }
-
- aranges {} cu_start {
- arange {} 0 0
- }
- }
-}
-
-if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
- object {nodebug}] != "" } {
- return -1
-}
-
-# The values don't really matter, just whether they are equal.
-set ok_prefix 01
-set ok_suffix 02030405060708091011121314151617181920
-set ok_suffix2 020304050607080910111213141516171819ff
-set ok_buildid ${ok_prefix}${ok_suffix}
-set ok_buildid2 ${ok_prefix}${ok_suffix2}
-set bad_buildid [string repeat ff 20]
-
-set debugdir [standard_output_file {}]
-set basedir $debugdir/.build-id
-file mkdir $basedir $basedir/$ok_prefix
-
-# Test where the separate debuginfo's buildid matches.
-write_just_debugaltlink $srcfile2 ${binfile}3.o $ok_buildid
-write_dwarf_file $srcfile3 $ok_buildid
-
-# Test where the separate debuginfo's buildid does not match.
-write_just_debugaltlink $srcfile4 ${binfile}5.o $ok_buildid
-write_dwarf_file $srcfile5 $bad_buildid
-
-# Test where the separate debuginfo's buildid does not match, but then
-# we find a match in the .build-id directory.
-write_just_debugaltlink $srcfile6 ${binfile}7.o $ok_buildid2
-# Use 77 as the value so that if we load the bad debuginfo, we will
-# see the wrong result.
-write_dwarf_file $srcfile7 $bad_buildid 77
-write_dwarf_file $srcfile8 $ok_buildid2
-
-# Compile everything.
-for {set i 2} {$i <= 8} {incr i} {
- if {[gdb_compile [standard_output_file [set srcfile$i]] \
- ${binfile}$i.o object nodebug] != ""} {
- return -1
- }
-}
-
-# Copy a file into the .build-id place for the "fallback" test.
-file copy -force -- ${binfile}8.o $basedir/$ok_prefix/$ok_suffix2.debug
-
-proc do_test {} {
- clean_restart
-
- gdb_test_no_output "set debug-file-directory $::debugdir" \
- "set debug-file-directory"
-
- gdb_load ${::binfile}-${::testname}
-
- if {![runto_main]} {
- return
- }
-
- if {$::testname == "mismatch"} {
- gdb_test "print the_int" \
- "(No symbol table is loaded|No symbol \"the_int\" in current context).*"
- } else {
- gdb_test "print the_int" " = 99"
- }
-}
-
-foreach_with_prefix testname { ok mismatch fallback } {
- if { $testname == "ok" } {
- set objs [list ${binfile}1.o ${binfile}2.o]
- } elseif { $testname == "mismatch" } {
- set objs [list ${binfile}1.o ${binfile}4.o]
- } elseif { $testname == "fallback" } {
- set objs [list ${binfile}1.o ${binfile}6.o]
- }
-
- if {[gdb_compile $objs ${binfile}-$testname executable {quiet}] != ""} {
- unsupported "compilation failed"
- continue
- }
-
- do_test
-}
+set scenario gnu
+source $srcdir/$subdir/dwzbuildid.tcl
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl b/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl
new file mode 100644
index 0000000..a9077eb
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl
@@ -0,0 +1,184 @@
+# Copyright 2013-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+# No remote host testing either.
+require {!is_remote host}
+
+
+# Lots of source files since we test a few cases and make new files
+# for each.
+# The tests are:
+# ok - the main file refers to a dwz and the buildids match
+# mismatch - the buildids do not match
+# fallback - the buildids do not match but a match is found via buildid
+standard_testfile main.c \
+ dwzbuildid-ok-base.S dwzbuildid-ok-sep.S \
+ dwzbuildid-mismatch-base.S dwzbuildid-mismatch-sep.S \
+ dwzbuildid-fallback-base.S dwzbuildid-fallback-sep.S \
+ dwzbuildid-fallback-ok.S
+
+# Write some assembly that just has a .gnu_debugaltlink section.
+proc write_just_debugaltlink {filename dwzname buildid} {
+ set asm_file [standard_output_file $filename]
+
+ Dwarf::assemble $asm_file {
+ upvar dwzname dwzname
+ upvar buildid buildid
+
+ if {$::scenario == "gnu"} {
+ gnu_debugaltlink $dwzname $buildid
+ } else {
+ debug_sup 0 $dwzname $buildid
+ }
+
+ # Only the DWARF reader checks .gnu_debugaltlink, so make sure
+ # there is a bit of DWARF in here.
+ cu { label cu_start } {
+ compile_unit {{language @DW_LANG_C}} {
+ }
+ }
+ aranges {} cu_start {
+ arange {} 0 0
+ }
+ }
+}
+
+# Write some DWARF that also sets the buildid.
+proc write_dwarf_file {filename buildid {value 99}} {
+ set asm_file [standard_output_file $filename]
+
+ Dwarf::assemble $asm_file {
+ declare_labels int_label int_label2
+
+ upvar buildid buildid
+ upvar value value
+
+ if {$::scenario == "gnu"} {
+ build_id $buildid
+ } else {
+ debug_sup 1 "" $buildid
+ }
+
+ cu { label cu_start } {
+ compile_unit {{language @DW_LANG_C}} {
+ int_label2: base_type {
+ {name int}
+ {byte_size 4 sdata}
+ {encoding @DW_ATE_signed}
+ }
+
+ constant {
+ {name the_int}
+ {type :$int_label2}
+ {const_value $value data1}
+ }
+ }
+ }
+
+ aranges {} cu_start {
+ arange {} 0 0
+ }
+ }
+}
+
+if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
+ object {nodebug}] != "" } {
+ return -1
+}
+
+# The values don't really matter, just whether they are equal.
+set ok_prefix 01
+set ok_suffix 02030405060708091011121314151617181920
+set ok_suffix2 020304050607080910111213141516171819ff
+set ok_buildid ${ok_prefix}${ok_suffix}
+set ok_buildid2 ${ok_prefix}${ok_suffix2}
+set bad_buildid [string repeat ff 20]
+
+set debugdir [standard_output_file {}]
+set basedir $debugdir/.build-id
+file mkdir $basedir $basedir/$ok_prefix
+
+# Test where the separate debuginfo's buildid matches.
+write_just_debugaltlink $srcfile2 ${binfile}3.o $ok_buildid
+write_dwarf_file $srcfile3 $ok_buildid
+
+# Test where the separate debuginfo's buildid does not match.
+write_just_debugaltlink $srcfile4 ${binfile}5.o $ok_buildid
+write_dwarf_file $srcfile5 $bad_buildid
+
+# Test where the separate debuginfo's buildid does not match, but then
+# we find a match in the .build-id directory.
+write_just_debugaltlink $srcfile6 ${binfile}7.o $ok_buildid2
+# Use 77 as the value so that if we load the bad debuginfo, we will
+# see the wrong result.
+write_dwarf_file $srcfile7 $bad_buildid 77
+write_dwarf_file $srcfile8 $ok_buildid2
+
+# Compile everything.
+for {set i 2} {$i <= 8} {incr i} {
+ if {[gdb_compile [standard_output_file [set srcfile$i]] \
+ ${binfile}$i.o object nodebug] != ""} {
+ return -1
+ }
+}
+
+# Copy a file into the .build-id place for the "fallback" test.
+file copy -force -- ${binfile}8.o $basedir/$ok_prefix/$ok_suffix2.debug
+
+proc do_test {} {
+ clean_restart
+
+ gdb_test_no_output "set debug-file-directory $::debugdir" \
+ "set debug-file-directory"
+
+ gdb_load ${::binfile}-${::testname}
+
+ if {![runto_main]} {
+ return
+ }
+
+ if {$::testname == "mismatch"} {
+ gdb_test "print the_int" \
+ "(No symbol table is loaded|No symbol \"the_int\" in current context).*"
+ } else {
+ gdb_test "print the_int" " = 99"
+ }
+}
+
+set tests {ok mismatch}
+if {$scenario == "gnu"} {
+ lappend tests fallback
+}
+foreach_with_prefix testname $tests {
+ if { $testname == "ok" } {
+ set objs [list ${binfile}1.o ${binfile}2.o]
+ } elseif { $testname == "mismatch" } {
+ set objs [list ${binfile}1.o ${binfile}4.o]
+ } elseif { $testname == "fallback" } {
+ set objs [list ${binfile}1.o ${binfile}6.o]
+ }
+
+ if {[gdb_compile $objs ${binfile}-$testname executable {quiet}] != ""} {
+ unsupported "compilation failed"
+ continue
+ }
+
+ do_test
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid5.exp b/gdb/testsuite/gdb.dwarf2/dwzbuildid5.exp
new file mode 100644
index 0000000..047626c
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid5.exp
@@ -0,0 +1,17 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set scenario dwarf5
+source $srcdir/$subdir/dwzbuildid.tcl
diff --git a/gdb/testsuite/gdb.dwarf2/dwznolink.exp b/gdb/testsuite/gdb.dwarf2/dwznolink.exp
index 91fe369..0c486ea 100644
--- a/gdb/testsuite/gdb.dwarf2/dwznolink.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwznolink.exp
@@ -49,5 +49,5 @@ if {[build_executable $testfile.exp $testfile \
clean_restart
gdb_test "file -readnow $binfile" \
- "could not read '.gnu_debugaltlink' section" \
+ "could not find supplementary DWARF file" \
"file $testfile"
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp
new file mode 100644
index 0000000..c0c2635
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp
@@ -0,0 +1,71 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `clang-14 -gdwarf-4
+# -fdebug-macro -g3 <file>` (using its built-in assembler). With -gdwarf-4,
+# clang produces a .debug_macinfo section, not a .debug_macro section. But
+# this test still creates a .debug_macro section, that's good enough for what
+# we want to test.
+
+## test.c
+do_test filename 4 "test.c" 1 {
+} {
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 4 "test.c" 1 {
+ "."
+} {
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 4 "../cwd/test.c" 1 {
+ "../cwd"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 4 "/tmp/cwd/test.c" 1 {
+} {
+ {"test.c" 0}
+}
+
+## ../other/test.c
+do_test dot-dot-other 4 "../other/test.c" 1 {
+ "../other"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 4 "/tmp/other/test.c" 1 {
+ "/tmp"
+} {
+ {"other/test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp
new file mode 100644
index 0000000..0b3239e
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp
@@ -0,0 +1,75 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `clang-14 -gdwarf-5
+# -fdebug-macro -g3 <file>` (using its built-in assembler)
+
+## test.c
+do_test filename 5 "test.c" 0 {
+ "/tmp/cwd"
+} {
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 5 "test.c" 1 {
+ "/tmp/cwd"
+ "."
+} {
+ {"test.c" 0}
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 5 "../cwd/test.c" 0 {
+ "/tmp/cwd"
+} {
+ {"../cwd/test.c" 0}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 5 "/tmp/cwd/test.c" 1 {
+ "/tmp/cwd"
+} {
+ {"/tmp/cwd/test.c" 0}
+ {"test.c" 0}
+}
+
+## ../other/test.c
+do_test dot-dot-other 5 "../other/test.c" 0 {
+ "/tmp/cwd"
+} {
+ {"../other/test.c" 0}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 5 "/tmp/other/test.c" 1 {
+ "/tmp/cwd"
+ "/tmp"
+} {
+ {"/tmp/other/test.c" 0}
+ {"other/test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp
new file mode 100644
index 0000000..940f997
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp
@@ -0,0 +1,70 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `gcc -gdwarf-5 -g3 <file>`,
+# gcc 11 paired with gas from binutils 2.34 (Ubuntu 20.04). It generates a v5
+# .debug_macro section, but a v3 .debug_line section.
+
+## test.c
+do_test filename 3 "test.c" 1 {
+} {
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 3 "./test.c" 1 {
+ "."
+} {
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 3 "../cwd/test.c" 1 {
+ "../cwd"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 3 "/tmp/cwd/test.c" 1 {
+ "/tmp/cwd"
+} {
+ {"test.c" 1}
+}
+
+## ../other/test.c
+do_test dot-dot-other 3 "../other/test.c" 1 {
+ "../other"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 3 "/tmp/other/test.c" 1 {
+ "/tmp/other"
+} {
+ {"test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp
new file mode 100644
index 0000000..dea0308
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp
@@ -0,0 +1,70 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `gcc -gdwarf-4 -g3 <file>`,
+# gcc 11 paired with gas from binutils 2.38. With -gdwarf-4, gcc generates a
+# v4 (pre-standard) .debug_macro section.
+
+## test.c
+do_test filename 4 "test.c" 1 {
+} {
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 4 "./test.c" 1 {
+ "."
+} {
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 4 "../cwd/test.c" 1 {
+ "../cwd"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 4 "/tmp/cwd/test.c" 1 {
+ "/tmp/cwd"
+} {
+ {"test.c" 1}
+}
+
+## ../other/test.c
+do_test dot-dot-other 4 "../other/test.c" 1 {
+ "../other"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 4 "/tmp/other/test.c" 1 {
+ "/tmp/other"
+} {
+ {"test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp
new file mode 100644
index 0000000..98a278e
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp
@@ -0,0 +1,81 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `gcc -gdwarf-5 -g3 <file>`,
+# gcc 11 paired with gas from binutils 2.38.
+
+## test.c
+do_test filename 5 "test.c" 1 {
+ "/tmp/cwd"
+} {
+ {"test.c" 0}
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 5 "./test.c" 1 {
+ "/tmp/cwd"
+ "."
+} {
+ {"test.c" 1}
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 5 "../cwd/test.c" 1 {
+ "/tmp/cwd"
+ "../cwd"
+} {
+ {"test.c" 1}
+ {"test.c" 1}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 5 "/tmp/cwd/test.c" 1 {
+ "/tmp/cwd"
+ "/tmp/cwd"
+} {
+ {"test.c" 1}
+ {"test.c" 0}
+}
+
+## ../other/test.c
+do_test dot-dot-other 5 "../other/test.c" 1 {
+ "/tmp/cwd"
+ "../other"
+} {
+ {"test.c" 1}
+ {"test.c" 1}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 5 "/tmp/other/test.c" 1 {
+ "/tmp/cwd"
+ "/tmp/other"
+} {
+ {"test.c" 1}
+ {"test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl
index 1318f8e..ecaf685 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl
@@ -17,12 +17,15 @@
# Generate binaries imitating different ways source file paths can be passed to
# compilers. Test printing macros from those binaries.
+#
+# The entry points for this test are in the various
+# gdb.dwarf2/macro-source-path-*.exp files.
load_lib dwarf.exp
require dwarf2_support
-standard_testfile .c
+standard_testfile macro-source-path.c
lassign [function_range main $srcdir/$subdir/$srcfile] \
main_start main_len
@@ -160,248 +163,3 @@ proc do_test { test_name lines_version DW_AT_name main_file_idx directories
}
}
}
-
-# When adding a test here, please consider adding an equivalent case to the test
-# of the same name in gdb.base.
-
-# The following tests are based on the output of `gcc -gdwarf-5 -g3 <file>`,
-# gcc 11 paired with gas from binutils 2.38.
-
-## test.c
-do_test gcc11-ld238-dw5-filename 5 "test.c" 1 {
- "/tmp/cwd"
-} {
- {"test.c" 0}
- {"test.c" 0}
-}
-
-## ./test.c
-do_test gcc11-ld238-dw5-dot-filename 5 "./test.c" 1 {
- "/tmp/cwd"
- "."
-} {
- {"test.c" 1}
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test gcc11-ld238-dw5-dot-dot-cwd 5 "../cwd/test.c" 1 {
- "/tmp/cwd"
- "../cwd"
-} {
- {"test.c" 1}
- {"test.c" 1}
-}
-
-## /tmp/cwd/test.c
-do_test gcc11-ld238-dw5-absolute-cwd 5 "/tmp/cwd/test.c" 1 {
- "/tmp/cwd"
- "/tmp/cwd"
-} {
- {"test.c" 1}
- {"test.c" 0}
-}
-
-## ../other/test.c
-do_test gcc11-ld238-dw5-dot-dot-other 5 "../other/test.c" 1 {
- "/tmp/cwd"
- "../other"
-} {
- {"test.c" 1}
- {"test.c" 1}
-}
-
-## /tmp/other/test.c
-do_test gcc11-ld238-dw5-absolute-other 5 "/tmp/other/test.c" 1 {
- "/tmp/cwd"
- "/tmp/other"
-} {
- {"test.c" 1}
- {"test.c" 1}
-}
-
-# The following tests are based on the output of `gcc -gdwarf-4 -g3 <file>`,
-# gcc 11 paired with gas from binutils 2.38. With -gdwarf-4, gcc generates a
-# v4 (pre-standard) .debug_macro section.
-
-## test.c
-do_test gcc11-ld238-dw4-filename 4 "test.c" 1 {
-} {
- {"test.c" 0}
-}
-
-## ./test.c
-do_test gcc11-ld238-dw4-dot-filename 4 "./test.c" 1 {
- "."
-} {
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test gcc11-ld238-dw4-dot-dot-cwd 4 "../cwd/test.c" 1 {
- "../cwd"
-} {
- {"test.c" 1}
-}
-
-## /tmp/cwd/test.c
-do_test gcc11-ld238-dw4-absolute-cwd 4 "/tmp/cwd/test.c" 1 {
- "/tmp/cwd"
-} {
- {"test.c" 1}
-}
-
-## ../other/test.c
-do_test gcc11-ld238-dw4-dot-dot-other 4 "../other/test.c" 1 {
- "../other"
-} {
- {"test.c" 1}
-}
-
-## /tmp/other/test.c
-do_test gcc11-ld238-dw4-absolute-other 4 "/tmp/other/test.c" 1 {
- "/tmp/other"
-} {
- {"test.c" 1}
-}
-
-# The following tests are based on the output of `clang-14 -gdwarf-5
-# -fdebug-macro -g3 <file>` (using its built-in assembler)
-
-## test.c
-do_test clang14-dw5-filename 5 "test.c" 0 {
- "/tmp/cwd"
-} {
- {"test.c" 0}
-}
-
-## ./test.c
-do_test clang14-dw5-dot-filename 5 "test.c" 1 {
- "/tmp/cwd"
- "."
-} {
- {"test.c" 0}
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test clang14-dw5-dot-dot-cwd 5 "../cwd/test.c" 0 {
- "/tmp/cwd"
-} {
- {"../cwd/test.c" 0}
-}
-
-## /tmp/cwd/test.c
-do_test clang14-dw5-absolute-cwd 5 "/tmp/cwd/test.c" 1 {
- "/tmp/cwd"
-} {
- {"/tmp/cwd/test.c" 0}
- {"test.c" 0}
-}
-
-## ../other/test.c
-do_test clang14-dw5-dot-dot-other 5 "../other/test.c" 0 {
- "/tmp/cwd"
-} {
- {"../other/test.c" 0}
-}
-
-## /tmp/other/test.c
-do_test clang14-dw5-absolute-other 5 "/tmp/other/test.c" 1 {
- "/tmp/cwd"
- "/tmp"
-} {
- {"/tmp/other/test.c" 0}
- {"other/test.c" 1}
-}
-
-# The following tests are based on the output of `clang-14 -gdwarf-4
-# -fdebug-macro -g3 <file>` (using its built-in assembler). With -gdwarf-4,
-# clang produces a .debug_macinfo section, not a .debug_macro section. But
-# this test still creates a .debug_macro section, that's good enough for what
-# we want to test.
-
-## test.c
-do_test clang14-dw4-filename 4 "test.c" 1 {
-} {
- {"test.c" 0}
-}
-
-## ./test.c
-do_test clang14-dw4-dot-filename 4 "test.c" 1 {
- "."
-} {
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test clang14-dw4-dot-dot-cwd 4 "../cwd/test.c" 1 {
- "../cwd"
-} {
- {"test.c" 1}
-}
-
-## /tmp/cwd/test.c
-do_test clang14-dw4-absolute-cwd 4 "/tmp/cwd/test.c" 1 {
-} {
- {"test.c" 0}
-}
-
-## ../other/test.c
-do_test clang14-dw4-dot-dot-other 4 "../other/test.c" 1 {
- "../other"
-} {
- {"test.c" 1}
-}
-
-## /tmp/other/test.c
-do_test clang14-dw4-absolute-other 4 "/tmp/other/test.c" 1 {
- "/tmp"
-} {
- {"other/test.c" 1}
-}
-
-# The following tests are based on the output of `gcc -gdwarf-5 -g3 <file>`,
-# gcc 11 paired with gas from binutils 2.34 (Ubuntu 20.04). It generates a v5
-# .debug_macro section, but a v3 .debug_line section.
-
-## test.c
-do_test gcc11-ld234-dw5-filename 3 "test.c" 1 {
-} {
- {"test.c" 0}
-}
-
-## ./test.c
-do_test gcc11-ld234-dw5-dot-filename 3 "./test.c" 1 {
- "."
-} {
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test gcc11-ld234-dw5-dot-dot-cwd 3 "../cwd/test.c" 1 {
- "../cwd"
-} {
- {"test.c" 1}
-}
-
-## /tmp/cwd/test.c
-do_test gcc11-ld234-dw5-absolute-cwd 3 "/tmp/cwd/test.c" 1 {
- "/tmp/cwd"
-} {
- {"test.c" 1}
-}
-
-## ../other/test.c
-do_test gcc11-ld234-dw5-dot-dot-other 3 "../other/test.c" 1 {
- "../other"
-} {
- {"test.c" 1}
-}
-
-## /tmp/other/test.c
-do_test gcc11-ld234-dw5-absolute-other 3 "/tmp/other/test.c" 1 {
- "/tmp/other"
-} {
- {"test.c" 1}
-}
diff --git a/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp b/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
index 7475d7a..05e625f 100644
--- a/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
+++ b/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
@@ -38,7 +38,7 @@ if { [build_executable $testfile.exp $testfile [list $srcfile $asm_file]] } {
clean_restart
gdb_test_no_output "maint set dwarf synchronous on"
-set msg "\r\nwarning: could not find '\.gnu_debugaltlink' file for \[^\r\n\]*"
+set msg "\r\nwarning: could not find supplementary DWARF file \[^\r\n\]*"
gdb_test "file $binfile" "$msg" "file command"
set question "Load new symbol table from .*\? .y or n. "