[binutils-gdb/gdb-18-branch] [gdb/testsuite] Fix gdb.python/py-section-script.exp with older objdump

Tom de Vries via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3e9dd7a94e12bee1ee61c769504a07a55fa6d616

commit 3e9dd7a94e12bee1ee61c769504a07a55fa6d616
Author: Tom de Vries <[email protected]>
Date:   Sat Aug 15 09:16:54 2026 +0200

    [gdb/testsuite] Fix gdb.python/py-section-script.exp with older objdump
    
    On AlmaLinux 9.8 ppc64le with objdump 2.35.2 I run into:
    ...
    ERROR: tcl error sourcing gdb/testsuite/gdb.python/py-section-script.exp.
    ERROR: tcl error code CHILDSTATUS 3614626 1
    ERROR: objdump: unrecognized option '--decompress'
    ...
    
    Fix this by using remote_exec instead of exec, and checking the result.
    
    Tested on x86_64-linux and ppc64le-linux.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33931
    (cherry picked from commit b331a230e3e53cfda799371c4f6f9bbf6a88a84c)

Diff:
---
 gdb/testsuite/gdb.python/py-section-script.exp | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
index 91c280da2b1..00dca67eaba 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -61,9 +61,24 @@ foreach_with_prefix variant {plain compressed} {
 
     if {$variant == "compressed"} {
 	set objdump_program [gdb_find_objdump]
-	set debug_sect [exec $objdump_program -j .debug_gdb_scripts -s "$the_binfile"]
-	set debug_sect_decompressed [exec $objdump_program -j .debug_gdb_scripts \
-			    -s "$the_binfile" --decompress]
+
+	set res \
+	    [remote_exec host \
+		 "$objdump_program -j .debug_gdb_scripts -s \"$the_binfile\""]
+	if {[lindex $res 0] != 0} {
+	    unsupported "Couldn't run objdump"
+	    return
+	}
+	set debug_sect [lindex $res 1]
+
+	set res \
+	    [remote_exec host \
+		 "$objdump_program -j .debug_gdb_scripts -s \"$the_binfile\" --decompress"]
+	if {[lindex $res 0] != 0} {
+	    unsupported "Couldn't run objdump --decompress"
+	    return
+	}
+	set debug_sect_decompressed [lindex $res 1]
 
 	if {$debug_sect == $debug_sect_decompressed} {
 	    fail ".debug_gdb_scripts in $the_binfile is not compressed"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.