[binutils-gdb] [gdb/testsuite] Error out on clean_restart <absolute filename>

Tom de Vries vries@sourceware.org
Sun Sep 7 09:53:35 GMT 2025


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

commit cba778b944af90c362a618af0630877736a54baa
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Sep 7 11:53:30 2025 +0200

    [gdb/testsuite] Error out on clean_restart <absolute filename>
    
    Error out in proc clean_restart if the argument is an absolute filename.
    
    Likewise in proc mi_clean_restart.
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/lib/gdb.exp        | 4 ++++
 gdb/testsuite/lib/mi-support.exp | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 7a3ea8d9644..a8524bc703d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9355,6 +9355,10 @@ proc clean_restart {{executable ""}} {
     gdb_reinitialize_dir $srcdir/$subdir
 
     if {$executable != ""} {
+	if { [file pathtype $executable] == "absolute" } {
+	    error "absolute path used"
+	}
+
 	set binfile [standard_output_file ${executable}]
 	return [gdb_load ${binfile}]
     }
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index aba13a272b4..a3ae648c63b 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1044,6 +1044,9 @@ proc mi_clean_restart {{executable ""} {flags {}}} {
     mi_gdb_reinitialize_dir $srcdir/$subdir
 
     if {$executable != ""} {
+	if { [file pathtype $executable] == "absolute" } {
+	    error "absolute path used"
+	}
 	set binfile [standard_output_file ${executable}]
 	return [mi_gdb_load ${binfile}]
     }


More information about the Gdb-cvs mailing list