Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 1/3] [gdb/testsuite] Factor out have_gnu_debuglink
Date: Tue, 20 Oct 2026 09:01:55 +0200	[thread overview]
Message-ID: <20261020070157.2414518-2-tdevries@suse.de> (raw)
In-Reply-To: <20261020070157.2414518-1-tdevries@suse.de>

Factor out proc have_gnu_debuglink, and use it, mostly via require.
---
 gdb/testsuite/gdb.base/dwz-symtabs.exp                     | 5 +----
 gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp            | 5 +----
 .../gdb.dwarf2/sig-type-unnamed-class-bad-sig.exp          | 2 +-
 gdb/testsuite/gdb.tui/activate-from-secondary-prompt.exp   | 7 ++-----
 gdb/testsuite/gdb.tui/debuginfod-query.exp                 | 5 +----
 gdb/testsuite/lib/gdb.exp                                  | 5 +++++
 6 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/gdb/testsuite/gdb.base/dwz-symtabs.exp b/gdb/testsuite/gdb.base/dwz-symtabs.exp
index d695b272c9a..96fccc70df6 100644
--- a/gdb/testsuite/gdb.base/dwz-symtabs.exp
+++ b/gdb/testsuite/gdb.base/dwz-symtabs.exp
@@ -58,10 +58,7 @@ if {[build_executable "build libbar.so" $libbar_filename \
 # adds a .gnu_debuglink, then this test isn't going to work.  We want to be
 # in control of splitting out the debug information, and we definitely don't
 # want a .gnu_debuglink otherwise debuginfod isn't going to be needed.
-if {[section_get $libbar_filename ".gnu_debuglink"] ne ""} {
-    unsupported "debug information has already been split out"
-    return
-}
+require {!have_gnu_debuglink $libbar_filename}
 
 # Compile libfoo.so.
 if {[build_executable "build libfoo.so" $libfoo_filename \
diff --git a/gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp b/gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp
index 9808f6c3e87..caee4290c00 100644
--- a/gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp
+++ b/gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp
@@ -103,10 +103,7 @@ if {[build_executable "build libbar.so" $libbar_filename \
 # adds a .gnu_debuglink, then this test isn't going to work.  We want to be
 # in control of splitting out the debug information, and we definitely don't
 # want a .gnu_debuglink otherwise debuginfod isn't going to be needed.
-if {[section_get $libbar_filename ".gnu_debuglink"] ne ""} {
-    unsupported "debug information has already been split out"
-    return
-}
+require {!have_gnu_debuglink $libbar_filename}
 
 # Compile libfoo.so.
 if {[build_executable "build libfoo.so" $libfoo_filename \
diff --git a/gdb/testsuite/gdb.dwarf2/sig-type-unnamed-class-bad-sig.exp b/gdb/testsuite/gdb.dwarf2/sig-type-unnamed-class-bad-sig.exp
index 39a221a1b75..301a4325bc6 100644
--- a/gdb/testsuite/gdb.dwarf2/sig-type-unnamed-class-bad-sig.exp
+++ b/gdb/testsuite/gdb.dwarf2/sig-type-unnamed-class-bad-sig.exp
@@ -114,7 +114,7 @@ proc run_test { version } {
 	# The path reported in the complaint message is always
 	# absolute.  Handle this with an optional prefix pattern.
 	set binfile_re "\[^\r\n\]*[string_to_regexp $host_binfile]"
-    } elseif {[section_get $binfile_name ".gnu_debuglink"] ne ""} {
+    } elseif {[have_gnu_debuglink $binfile_name]} {
 	set binfile_re "\[^\r\n\]+[string_to_regexp ${testfile_name}.debug]"
     } else {
 	set binfile_re [string_to_regexp $binfile_name]
diff --git a/gdb/testsuite/gdb.tui/activate-from-secondary-prompt.exp b/gdb/testsuite/gdb.tui/activate-from-secondary-prompt.exp
index 3bfc7b1156d..9fcccec265c 100644
--- a/gdb/testsuite/gdb.tui/activate-from-secondary-prompt.exp
+++ b/gdb/testsuite/gdb.tui/activate-from-secondary-prompt.exp
@@ -129,6 +129,8 @@ proc_with_prefix test_from_debuginfod_prompt {} {
 	return
     }
 
+    require {!have_gnu_debuglink $::binfile}
+
     set stripped_binfile [standard_output_file ${::testfile}-stripped]
     file copy -force $::binfile $stripped_binfile
     if {[gdb_gnu_strip_debug $stripped_binfile no-debuglink]} {
@@ -136,11 +138,6 @@ proc_with_prefix test_from_debuginfod_prompt {} {
 	return
     }
 
-    if {[section_get $stripped_binfile ".gnu_debuglink"] ne ""} {
-	unsupported "debug information has already been split out"
-	return
-    }
-
     save_vars { env(DEBUGINFOD_URLS) } {
 	setenv DEBUGINFOD_URLS "foo"
 	Term::clean_restart 24 80
diff --git a/gdb/testsuite/gdb.tui/debuginfod-query.exp b/gdb/testsuite/gdb.tui/debuginfod-query.exp
index 98d61850842..1f46ca05299 100644
--- a/gdb/testsuite/gdb.tui/debuginfod-query.exp
+++ b/gdb/testsuite/gdb.tui/debuginfod-query.exp
@@ -29,10 +29,7 @@ if { [build_executable "build executable" $testfile $srcfile] == -1 } {
     return
 }
 
-if {[section_get $binfile ".gnu_debuglink"] ne ""} {
-    unsupported "debug information has already been split out"
-    return
-}
+require {!have_gnu_debuglink $binfile}
 
 # Assume that GDB is in TUI mode, in the SRC layout, and that a
 # debuginfod prompt is currently active in the CMD window.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index dba696cc130..1aae8cad1ae 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -12335,6 +12335,11 @@ proc section_get {exec section} {
     }
 }
 
+# Return true if BINFILE has a .gnu_debuglink section.
+proc have_gnu_debuglink {binfile} {
+    return [expr {[section_get $binfile ".gnu_debuglink"] ne ""}]
+}
+
 # Return true if we expect the build-id from FILENAME to be included
 # in a core file.
 #
-- 
2.51.0


  reply	other threads:[~2026-10-20  7:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  7:01 [pushed 0/3] [gdb/testsuite] cc-with-gnu-debuglink fixes Tom de Vries
2026-10-20  7:01 ` Tom de Vries [this message]
2026-10-20  7:01 ` [pushed 2/3] [gdb/testsuite] Use have_gnu_debuglink in two more test-cases Tom de Vries
2026-10-20  7:01 ` [pushed 3/3] [gdb/testsuite] Skip debuginfod tests with cc-with-gnu-debuglink board Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261020070157.2414518-2-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox