From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 5171C3858D20; Fri, 27 Jan 2023 01:28:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5171C3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674782930; bh=qXFZgf54Qk/+cLwGcu/4WYaC3VXdFG04715TWh7aLWI=; h=From:To:Subject:Date:From; b=Z+RtIRjAUn0CpNuQiuKRYAx5yKFh+jVhUwUB1cmpsJZMBpKM40PXDmzUUZ49HN54Z 6ztCKy/2GXYYtiNuvZqDdLm/1XT87yKJ8orOXZiGoZuE3dP45tLcTeFTGV1osnUCdV XVS4kB3Oh+tWFOUdokRYjef3LnsLmeedix3Lj6/g= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Use ordinary calling convention for clean_restart X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 3efac389d82e0b2917ebd98c739df413618ad3f1 X-Git-Newrev: 6b9276b7e6905547233638c2c01b723ac7bde821 Message-Id: <20230127012850.5171C3858D20@sourceware.org> Date: Fri, 27 Jan 2023 01:28:50 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6b9276b7e690= 5547233638c2c01b723ac7bde821 commit 6b9276b7e6905547233638c2c01b723ac7bde821 Author: Tom Tromey Date: Wed Jan 25 09:25:36 2023 -0700 Use ordinary calling convention for clean_restart =20 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. Diff: --- gdb/testsuite/lib/gdb.exp | 11 +++-------- gdb/testsuite/lib/mi-support.exp | 11 +++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0f9fe9a1e48..0201c102fa7 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -7437,20 +7437,16 @@ proc build_executable { testname executable {source= s ""} {options {debug}} } { } =20 # 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. =20 -proc clean_restart { args } { +proc clean_restart {{executable ""}} { global srcdir global subdir global errcnt global warncnt =20 - if { [llength $args] > 1 } { - error "bad number of args: [llength $args]" - } - gdb_exit =20 # This is a clean restart, so reset error and warning count. @@ -7470,8 +7466,7 @@ proc clean_restart { args } { =20 gdb_reinitialize_dir $srcdir/$subdir =20 - if { [llength $args] >=3D 1 } { - set executable [lindex $args 0] + if {$executable !=3D ""} { set binfile [standard_output_file ${executable}] return [gdb_load ${binfile}] } diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-suppor= t.exp index b6da2c4baf0..767ea72ff70 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} { } =20 # 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. =20 -proc mi_clean_restart { args } { +proc mi_clean_restart {{executable ""}} { global srcdir global subdir global errcnt global warncnt =20 - if { [llength $args] > 1 } { - error "bad number of args: [llength $args]" - } - gdb_exit =20 # This is a clean restart, so reset error and warning count. @@ -1034,8 +1030,7 @@ proc mi_clean_restart { args } { =20 mi_gdb_reinitialize_dir $srcdir/$subdir =20 - if { [llength $args] >=3D 1 } { - set executable [lindex $args 0] + if {$executable !=3D ""} { set binfile [standard_output_file ${executable}] return [mi_gdb_load ${binfile}] }