[binutils-gdb] gdb/testsuite: make pie-execl.exp work with native-gdbserver

Simon Marchi via Gdb-cvs <[email protected]> Fri, 19 Jun 2026 20:09:23 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3df1bb6a0d22f7b04445c1c815a7181a804bc2b6

commit 3df1bb6a0d22f7b04445c1c815a7181a804bc2b6
Author: Simon Marchi <[email protected]>
Date:   Thu Jun 18 15:29:55 2026 -0400

    gdb/testsuite: make pie-execl.exp work with native-gdbserver
    
    This test passes the path of an executable to execute as argv[1] to the
    inferior.  This test is currently skipped with remote targets (e.g.
    native-gdbserver), because it previously wasn't possible to pass
    arguments to inferiors on such targets in the testsuite.  Remove that
    check, and use the new -inferior-args runto option to pass the args to
    the inferior.
    
    Add
    
      require {!target_info exists noargs}
    
    to reflect that the test relies on inferior args.
    
    Change-Id: If3b884421b453d6ca93c19ca13314bbb7869218c
    Reviewed-By: Tankut Baris Aktemur <[email protected]>

Diff:
---
 gdb/testsuite/gdb.base/pie-execl.exp | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/gdb/testsuite/gdb.base/pie-execl.exp b/gdb/testsuite/gdb.base/pie-execl.exp
index 62f3bc10092..cd4951f1be2 100644
--- a/gdb/testsuite/gdb.base/pie-execl.exp
+++ b/gdb/testsuite/gdb.base/pie-execl.exp
@@ -20,21 +20,13 @@ global inferior_spawn_id
 global gdb_spawn_id
 
 require {istarget *-linux*}
-
-# In remote mode we cannot use the 'set args' command, and this
-# test requires it.
-if {[target_info exists gdb_protocol]} {
-    if {[target_info gdb_protocol] == "remote"} {
-	return
-    }
-}
+require {!target_info exists noargs}
 
 standard_testfile .c
 set executable1 ${testfile}1
 set executable2 ${testfile}2
 set binfile1 ${binfile}1
 set binfile2 ${binfile}2
-set binfile2_test_msg OBJDIR/${subdir}/${executable2}
 
 # Use conditional compilation according to `BIN' as GDB remembers the source
 # file name of the breakpoint.
@@ -47,9 +39,7 @@ if {[build_executable ${testfile}.exp $executable1 $srcfile [concat $opts {addit
 
 clean_restart ${executable1}
 
-gdb_test_no_output "set args ${binfile2}" "set args ${binfile2_test_msg}"
-
-if {![runto_main]} {
+if {![runto_main -inferior-args $binfile2]} {
     return
 }