public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Use ordinary calling convention for clean_restart Date: Fri, 27 Jan 2023 01:28:50 +0000 (GMT) [thread overview] Message-ID: <20230127012850.5171C3858D20@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6b9276b7e6905547233638c2c01b723ac7bde821 commit 6b9276b7e6905547233638c2c01b723ac7bde821 Author: Tom Tromey <tom@tromey.com> Date: Wed Jan 25 09:25:36 2023 -0700 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. 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 {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 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} { } # 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}] }
reply other threads:[~2023-01-27 1:28 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230127012850.5171C3858D20@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).