This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: how to call gdb_test "" ... ?
- From: Keith Seitz <keiths at redhat dot com>
- To: Michael Elizabeth Chastain <mec at shout dot net>
- Cc: <gdb at sources dot redhat dot com>
- Date: Mon, 18 Feb 2002 15:32:11 -0800 (PST)
- Subject: Re: how to call gdb_test "" ... ?
On Mon, 18 Feb 2002, Michael Elizabeth Chastain wrote:
> That is to say, I want to send a "list" command, and then send some
> empty commands and look at the results as usual.
>
> gdb_test does not work with an argument of "".
I'll go out on a limb here and say offer that gdb_test be modified:
<gripe>
1) To make it legible:
proc gdb_test { args } {
# snip
set command [lindex $args 0]
set pattern [lindex $args 1]
# snip
set result -1
set string "${command}\n"
if { $command != "" } {
while { "$string" != "" } {
set foo [string first "\n" "$string"]
set len [string length "$string"]
if { $foo < [expr $len - 1] } {
if [send_gdb "$str"] != "" } {
#snip
}
# snip
}
set string [string range "$string" [expr $foo + 1] end
}
# snip
Why is this done???? Why not just:
proc gdb_test {command pattern args} {
# snip
set cmd "$command\n"
foreach cmd [split $command \n] {
if {$cmd != ""} {
if {[send_gdb $cmd] != ""} {
#snip
}
}
# snip
I don't know. Whomever wrote it did not understand tcl at all.
</gripe>
2) To allow empty commands, i.e., skip the send, do the expect
Actually, I don't see from reading the code for gdb_test why "" would be
disallowed. Is it giving you some sort of error?
Ok, off my soapbox now.
Keith