[binutils-gdb] [gdb/testsuite] Fix require dwarf2_support check in some test-cases

Tom de Vries vries@sourceware.org
Tue Aug 26 10:24:28 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=81e5a23c7b8008d3460f8d0c8050d886fe754523

commit 81e5a23c7b8008d3460f8d0c8050d886fe754523
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Aug 26 12:24:19 2025 +0200

    [gdb/testsuite] Fix require dwarf2_support check in some test-cases
    
    On x86_64-freebsd, I ran into trouble with test-case
    gdb.dwarf2/macro-source-path-clang14-dw4.exp (and similar), and I managed to
    reproduce the problem on x86_64-linux by making dwarf2_support return 0.
    
    The failure looks like:
    ...
    UNSUPPORTED: $exp: require failed: dwarf2_support
    UNRESOLVED: $exp: testcase aborted due to invalid command name: do_test
    ERROR: tcl error sourcing $exp.
    ...
    
    I fixed a similar problem in commit 3e488d8ccd0 ("[gdb/testsuite] Fix
    gdb.dwarf2/dw-form-strx-out-of-bounds.exp with make-check-all.sh").
    
    Fix this by moving "require dwarf2_support" from
    gdb.dwarf2/macro-source-path.exp.tcl to the files including it.
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp     | 2 ++
 gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp     | 2 ++
 gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp | 2 ++
 gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp | 2 ++
 gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp | 2 ++
 gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl             | 2 --
 6 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp
index c0c2635a63e..dc3826e0492 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp
@@ -18,6 +18,8 @@
 # Generate binaries imitating different ways source file paths can be passed to
 # compilers.  Test printing macros from those binaries.
 
+require dwarf2_support
+
 # The do_test proc comes from macro-source-path.exp.tcl.
 source $srcdir/$subdir/macro-source-path.exp.tcl
 
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp
index 0b3239edecd..a3ae2ea2caf 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp
@@ -18,6 +18,8 @@
 # Generate binaries imitating different ways source file paths can be passed to
 # compilers.  Test printing macros from those binaries.
 
+require dwarf2_support
+
 # The do_test proc comes from macro-source-path.exp.tcl.
 source $srcdir/$subdir/macro-source-path.exp.tcl
 
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
index 940f9976555..79609813b52 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp
@@ -18,6 +18,8 @@
 # Generate binaries imitating different ways source file paths can be passed to
 # compilers.  Test printing macros from those binaries.
 
+require dwarf2_support
+
 # The do_test proc comes from macro-source-path.exp.tcl.
 source $srcdir/$subdir/macro-source-path.exp.tcl
 
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
index dea03080c4d..62242453987 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp
@@ -18,6 +18,8 @@
 # Generate binaries imitating different ways source file paths can be passed to
 # compilers.  Test printing macros from those binaries.
 
+require dwarf2_support
+
 # The do_test proc comes from macro-source-path.exp.tcl.
 source $srcdir/$subdir/macro-source-path.exp.tcl
 
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
index 98a278e5e1e..37b03b9f55a 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp
@@ -18,6 +18,8 @@
 # Generate binaries imitating different ways source file paths can be passed to
 # compilers.  Test printing macros from those binaries.
 
+require dwarf2_support
+
 # The do_test proc comes from macro-source-path.exp.tcl.
 source $srcdir/$subdir/macro-source-path.exp.tcl
 
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl
index ecaf6855af6..f45d1b05ab1 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl
@@ -23,8 +23,6 @@
 
 load_lib dwarf.exp
 
-require dwarf2_support
-
 standard_testfile macro-source-path.c
 
 lassign [function_range main $srcdir/$subdir/$srcfile] \


More information about the Gdb-cvs mailing list