aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-25 09:25:36 -0700
committerTom Tromey <tom@tromey.com>2023-01-26 18:28:31 -0700
commit6b9276b7e6905547233638c2c01b723ac7bde821 (patch)
treec6433d53188c4f3ddfedfe3b9123d11bf31a91d6
parent3efac389d82e0b2917ebd98c739df413618ad3f1 (diff)
downloadgdb-6b9276b7e6905547233638c2c01b723ac7bde821.zip
gdb-6b9276b7e6905547233638c2c01b723ac7bde821.tar.gz
gdb-6b9276b7e6905547233638c2c01b723ac7bde821.tar.bz2
Use ordinary calling convention for clean_restart
clean_restart accepts a single optional argument. Rather than using {args} and handling the argument by hand, change it to use Tcl's own argument-checking.
-rw-r--r--gdb/testsuite/lib/gdb.exp11
-rw-r--r--gdb/testsuite/lib/mi-support.exp11
2 files changed, 6 insertions, 16 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 0f9fe9a..0201c10 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -7437,20 +7437,16 @@ proc build_executable { testname executable {sources ""} {options {debug}} } {
}
# Starts fresh GDB binary and loads an optional executable into GDB.
-# Usage: clean_restart [executable]
+# Usage: clean_restart [EXECUTABLE]
# EXECUTABLE is the basename of the binary.
# Return -1 if starting gdb or loading the executable failed.
-proc clean_restart { args } {
+proc clean_restart {{executable ""}} {
global srcdir
global subdir
global errcnt
global warncnt
- if { [llength $args] > 1 } {
- error "bad number of args: [llength $args]"
- }
-
gdb_exit
# This is a clean restart, so reset error and warning count.
@@ -7470,8 +7466,7 @@ proc clean_restart { args } {
gdb_reinitialize_dir $srcdir/$subdir
- if { [llength $args] >= 1 } {
- set executable [lindex $args 0]
+ if {$executable != ""} {
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 b6da2c4..767ea72 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1008,20 +1008,16 @@ proc mi_run_with_cli {args} {
}
# Starts fresh GDB binary and loads an optional executable into GDB.
-# Usage: mi_clean_restart [executable]
+# Usage: mi_clean_restart [EXECUTABLE]
# EXECUTABLE is the basename of the binary.
# Return -1 if starting gdb or loading the executable failed.
-proc mi_clean_restart { args } {
+proc mi_clean_restart {{executable ""}} {
global srcdir
global subdir
global errcnt
global warncnt
- if { [llength $args] > 1 } {
- error "bad number of args: [llength $args]"
- }
-
gdb_exit
# This is a clean restart, so reset error and warning count.
@@ -1034,8 +1030,7 @@ proc mi_clean_restart { args } {
mi_gdb_reinitialize_dir $srcdir/$subdir
- if { [llength $args] >= 1 } {
- set executable [lindex $args 0]
+ if {$executable != ""} {
set binfile [standard_output_file ${executable}]
return [mi_gdb_load ${binfile}]
}