* Re: how to call gdb_test "" ... ?
@ 2002-02-18 15:46 Michael Elizabeth Chastain
0 siblings, 0 replies; 7+ messages in thread
From: Michael Elizabeth Chastain @ 2002-02-18 15:46 UTC (permalink / raw)
To: keiths; +Cc: gdb
Keith Seitz writes:
> Actually, I don't see from reading the code for gdb_test why "" would be
> disallowed. Is it giving you some sort of error?
gdb_test "" hangs and does not return until some 60-second timer
kicks it out. That's probably related to the special check for "":
set result -1
set string "${command}\n";
if { $command != "" } {
...
}
Hmmm, this is actually documented behavior:
# COMMAND is the command to execute, send to GDB with send_gdb. If
this is the null string no command is sent.
I suppose I could do this:
send_gdb "\n"
gdb_test "" "..."
How does that sound, Keith? Or would you prefer me to stick with
send_gdb/gdb_expect? Gross choice, eh?
I can't modify gdb_test; that would take me too far afield from fixing
the real problems in list.exp.
Michael C
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: how to call gdb_test "" ... ?
@ 2002-02-18 16:28 Michael Elizabeth Chastain
0 siblings, 0 replies; 7+ messages in thread
From: Michael Elizabeth Chastain @ 2002-02-18 16:28 UTC (permalink / raw)
To: keiths; +Cc: gdb
Okay, it is patch submission time, I am submitting this:
send_gdb "\n"
gdb_test "" "..."
Michael C
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to call gdb_test "" ... ?
@ 2002-02-18 15:33 Michael Elizabeth Chastain
2002-02-18 16:19 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Michael Elizabeth Chastain @ 2002-02-18 15:33 UTC (permalink / raw)
To: drow; +Cc: gdb
Daniel Jacobowitz writes:
> Does gdb_test work with "\n"? I think it will. In fact, it appears to
> in casual testing.
Alas, gdb_test "\n" sends two carriage returns.
Michael C
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to call gdb_test "" ... ?
2002-02-18 15:33 Michael Elizabeth Chastain
@ 2002-02-18 16:19 ` Daniel Jacobowitz
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2002-02-18 16:19 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb
On Mon, Feb 18, 2002 at 05:33:12PM -0600, Michael Elizabeth Chastain wrote:
> Daniel Jacobowitz writes:
> > Does gdb_test work with "\n"? I think it will. In fact, it appears to
> > in casual testing.
>
> Alas, gdb_test "\n" sends two carriage returns.
Even worse, it appears to do so "most of the time" :(
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 7+ messages in thread
* how to call gdb_test "" ... ?
@ 2002-02-18 14:37 Michael Elizabeth Chastain
2002-02-18 15:16 ` Daniel Jacobowitz
2002-02-18 15:32 ` Keith Seitz
0 siblings, 2 replies; 7+ messages in thread
From: Michael Elizabeth Chastain @ 2002-02-18 14:37 UTC (permalink / raw)
To: gdb
I am reworking gdb.base/list.exp and in the process I'm converting a lot
of send_gdb calls to gdb_test. (If you want to know why I'm reworking it,
I'm getting rid of the "testcnt" mechanism, which list.exp uses instead
of just issuing a PASS when a test succeeds).
In one place I want to do this:
gdb_test "list list0.c:10" "..."
gdb_test "" "..."
gdb_test "" "..."
gdb_test "" "..."
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 "".
Is there an easy way to do this, or should I just stick with send_gdb "\n"?
The test script already calls send_gdb "\n" and I don't mind keeping it
that way. I'm just wondering if someone knows a better idiom.
Michael C
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to call gdb_test "" ... ?
2002-02-18 14:37 Michael Elizabeth Chastain
@ 2002-02-18 15:16 ` Daniel Jacobowitz
2002-02-18 15:32 ` Keith Seitz
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2002-02-18 15:16 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb
On Mon, Feb 18, 2002 at 04:37:17PM -0600, Michael Elizabeth Chastain wrote:
> I am reworking gdb.base/list.exp and in the process I'm converting a lot
> of send_gdb calls to gdb_test. (If you want to know why I'm reworking it,
> I'm getting rid of the "testcnt" mechanism, which list.exp uses instead
> of just issuing a PASS when a test succeeds).
>
> In one place I want to do this:
>
> gdb_test "list list0.c:10" "..."
> gdb_test "" "..."
> gdb_test "" "..."
> gdb_test "" "..."
>
> 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 "".
>
> Is there an easy way to do this, or should I just stick with send_gdb "\n"?
> The test script already calls send_gdb "\n" and I don't mind keeping it
> that way. I'm just wondering if someone knows a better idiom.
Does gdb_test work with "\n"? I think it will. In fact, it appears to
in casual testing.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to call gdb_test "" ... ?
2002-02-18 14:37 Michael Elizabeth Chastain
2002-02-18 15:16 ` Daniel Jacobowitz
@ 2002-02-18 15:32 ` Keith Seitz
1 sibling, 0 replies; 7+ messages in thread
From: Keith Seitz @ 2002-02-18 15:32 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-02-19 0:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-18 15:46 how to call gdb_test "" ... ? Michael Elizabeth Chastain
-- strict thread matches above, loose matches on Subject: below --
2002-02-18 16:28 Michael Elizabeth Chastain
2002-02-18 15:33 Michael Elizabeth Chastain
2002-02-18 16:19 ` Daniel Jacobowitz
2002-02-18 14:37 Michael Elizabeth Chastain
2002-02-18 15:16 ` Daniel Jacobowitz
2002-02-18 15:32 ` Keith Seitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox