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: [PATCH 1/2] [gdb/testsuite] Fix gdb.python/py-section-script.exp with make-check-all.sh
Date: Tue, 28 Jul 2026 18:00:15 +0200	[thread overview]
Message-ID: <20260728160016.3087552-2-tdevries@suse.de> (raw)
In-Reply-To: <20260728160016.3087552-1-tdevries@suse.de>

When running test-case gdb.python/py-section-script.exp with
make-check-all.sh, I get:
...
LOCAL:
 # of expected passes		38
TARGET BOARD: read1
 # of expected passes		38
TARGET BOARD: readmore
 # of expected passes		38
TARGET BOARD: cc-with-gdb-index
 # of expected passes		38
TARGET BOARD: cc-with-index-cache
 # of untested testcases		1
TARGET BOARD: cc-with-debug-names
FAIL: $exp: variant=compressed: gdb_breakpoint: set breakpoint at main
 # of expected passes		25
 # of unexpected failures	1
TARGET BOARD: cc-with-dwz
 # of expected passes		19
 # of untested testcases		1
TARGET BOARD: cc-with-dwz-m
 # of expected passes		19
 # of untested testcases		1
TARGET BOARD: cc-with-gnu-debuglink
ERROR: Undefined command "test-cmd 1 2 3".
FAIL: $exp: variant=plain: sepdebug from eu-strip: verify scripts loaded
FAIL: $exp: variant=plain: sepdebug from objcopy: strip py-section-script-plain-objcopy debuginfo
FAIL: $exp: variant=plain: verify scripts loaded
 # of expected passes		12
 # of unexpected failures	3
 # of unresolved testcases	1
TARGET BOARD: debug-types
 # of expected passes		38
TARGET BOARD: dwarf4-gdb-index
 # of expected passes		38
TARGET BOARD: dwarf5-fission-debug-types
 # of expected passes		38
TARGET BOARD: dwarf64
 # of expected passes		38
TARGET BOARD: fission
 # of untested testcases		1
TARGET BOARD: fission-dwp
 # of untested testcases		1
TARGET BOARD: gold
 # of untested testcases		1
TARGET BOARD: gold-gdb-index
 # of untested testcases		1
TARGET BOARD: readnow
 # of expected passes		38
TARGET BOARD: native-extended-gdbserver
 # of expected passes		38
TARGET BOARD: native-gdbserver
 # of expected passes		38
TARGET BOARD: native-stdio-gdbserver
 # of expected passes		38
TARGET BOARD: remote-gdbserver-on-localhost
 # of expected passes		38
TARGET BOARD: remote-stdio-gdbserver
 # of expected passes		38
HOST BOARD: local-remote-host, TARGET BOARD: remote-gdbserver-on-localhost
 # of untested testcases		1
HOST BOARD: local-remote-host, TARGET BOARD: remote-stdio-gdbserver
 # of untested testcases		1
HOST BOARD: local-remote-host-notty, TARGET BOARD: remote-gdbserver-on-localhost
 # of untested testcases		1
HOST BOARD: local-remote-host-notty, TARGET BOARD: remote-stdio-gdbserver
 # of untested testcases		1
HOST/TARGET BOARD: local-remote-host-native
 # of untested testcases		1
...

I've filed a PR about the cc-with-debug-names failure [1].

The untested for remote host configurations is because of compilation failure.

There's some evidence of remote host support in the test-case, but making it
work in general requires a lot of changes, because the test-case is
file-manipulation heavy.  Instead, just require local host and remove any
suggestion that remote host is supported.

Finally, cc-with-gnu-debuglink config fails because it moves the
.debug_gdb_scripts section out of the executable.  Detect this and bail out.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=34440
---
 .../gdb.python/py-section-script.exp          | 38 +++++++++----------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
index 91c280da2b1..04ff14a8d0a 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -18,26 +18,23 @@
 
 require is_elf_target
 require allow_python_tests
+require {!is_remote host}
 
 standard_testfile
 
-# Make this available to gdb before the program starts, it is
-# automagically loaded by gdb.
-set remote_python_file [gdb_remote_download host \
-			    ${srcdir}/${subdir}/${testfile}.py]
-
-set quoted_name "\"$remote_python_file\""
+set python_file $srcdir/$subdir/$testfile.py
+set quoted_name "\"$python_file\""
 
 # Helper proc to 'set auto-load safe-path ...'.  Build the new path value by
 # joining ARGS together with an appropriate path separator character.
 proc set_auto_load_safe_path { args } {
     if {[ishost *-*-mingw*]} {
-	set remote_pathsep ";"
+	set pathsep ";"
     } else {
-	set remote_pathsep ":"
+	set pathsep ":"
     }
 
-    set safe_path [join $args $remote_pathsep]
+    set safe_path [join $args $pathsep]
 
     gdb_test_no_output "set auto-load safe-path $safe_path" \
 	"set auto-load safe-path"
@@ -59,6 +56,13 @@ foreach_with_prefix variant {plain compressed} {
 	return
     }
 
+    if {[section_get $the_binfile ".debug_gdb_scripts"] eq ""} {
+	# Target board cc-with-gnu-debug-link moves .debug_gdb_scripts into
+	# a separate debug file.
+	unsupported "Section .debug_gdb_scripts not in binfile"
+	return
+    }
+
     if {$variant == "compressed"} {
 	set objdump_program [gdb_find_objdump]
 	set debug_sect [exec $objdump_program -j .debug_gdb_scripts -s "$the_binfile"]
@@ -92,16 +96,8 @@ foreach_with_prefix variant {plain compressed} {
 
     clean_restart
 
-    # Get the name of the binfile on the host; on a remote host this means
-    # stripping off any directory prefix.
-    if {[is_remote host]} {
-	set remote_binfile [file tail ${the_binfile}]
-    } else {
-	set remote_binfile ${the_binfile}
-    }
-
-    set_auto_load_safe_path $remote_python_file $remote_binfile
-    gdb_load ${the_binfile}
+    set_auto_load_safe_path $python_file $the_binfile
+    gdb_load $the_binfile
     # Verify gdb loaded each script and they appear once in the list.
     gdb_test_multiple "info auto-load python-scripts" "verify scripts loaded" {
 	-re -wrap "Yes.*${testfile}.py.*Yes.*inlined-script.*" {
@@ -153,7 +149,7 @@ foreach_with_prefix variant {plain compressed} {
 	    return
 	}
 
-	set_auto_load_safe_path $remote_python_file $eu_strip_binfile
+	set_auto_load_safe_path $python_file $eu_strip_binfile
 	gdb_test_multiple "file $eu_strip_binfile" "load sepdebug" {
 	    -re -wrap "\r\nwarning: Invalid entry in \\.debug_gdb_scripts section.*" {
 		fail $gdb_test_name
@@ -203,7 +199,7 @@ foreach_with_prefix variant {plain compressed} {
 	# Add the directory containing OBJCOPY_BINFILE because the scripts
 	# section will be auto-loaded from the separate .debug file (not the
 	# main executable), which resides alongside it.
-	set_auto_load_safe_path $remote_python_file \
+	set_auto_load_safe_path $python_file \
 	    [file dirname ${objcopy_binfile}]
 	gdb_load $objcopy_binfile
 
-- 
2.51.0


  reply	other threads:[~2026-07-28 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 16:00 [PATCH 0/2] [gdb/testsuite] Two fixes in gdb.python/py-section-script.exp Tom de Vries
2026-07-28 16:00 ` Tom de Vries [this message]
2026-07-28 16:00 ` [PATCH 2/2] [gdb/testsuite] Fix gdb.python/py-section-script.exp with older objdump 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=20260728160016.3087552-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