* Testsuite: Don't use global command in gdb_expect
@ 2008-12-15 6:07 Jie Zhang
2008-12-15 7:53 ` Joel Brobecker
0 siblings, 1 reply; 5+ messages in thread
From: Jie Zhang @ 2008-12-15 6:07 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 807 bytes --]
The Tcl global command has no effect unless executed in the context of a
proc body. So the global commands in the following code are useless.
Even worse, they would cause unexpected result. When gdb_expect gets
something containing "global", it will try to execute hex as a command,
which will cause an error.
gdb_expect {
global hex
global nl
global bp_addr
global gdb_prompt
-re "$hex.*${nl}($hex).*$gdb_prompt $" {
set bp_addr $expect_out(1,string)
pass "get breakpoint address for foo"
}
-re ".*$gdb_prompt $" {
fail "get breakpoint address for foo"
return 0;
}
timeout {
fail "get breakpoint address for foo (timeout)"
return 0;
}
}
This patch should fix this issue. Is it OK?
Thanks,
Jie
[-- Attachment #2: gdb-testsuite-consecutive.diff --]
[-- Type: text/x-patch, Size: 719 bytes --]
2008-12-15 Jie Zhang <jie.zhang@analog.com>
* gdb.base/consecutive.exp: Don't use global in gdb_expect.
Index: gdb.base/consecutive.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/consecutive.exp,v
retrieving revision 1.7
diff -u -p -r1.7 consecutive.exp
--- gdb.base/consecutive.exp 6 Aug 2008 12:52:07 -0000 1.7
+++ gdb.base/consecutive.exp 15 Dec 2008 05:51:49 -0000
@@ -64,11 +64,6 @@ set stop_addr 0
send_gdb "x /2i \$pc\n"
gdb_expect {
- global hex
- global nl
- global bp_addr
- global gdb_prompt
-
-re "$hex.*${nl}($hex).*$gdb_prompt $" {
set bp_addr $expect_out(1,string)
pass "get breakpoint address for foo"
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Testsuite: Don't use global command in gdb_expect
2008-12-15 6:07 Testsuite: Don't use global command in gdb_expect Jie Zhang
@ 2008-12-15 7:53 ` Joel Brobecker
2008-12-15 8:50 ` Andreas Schwab
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Joel Brobecker @ 2008-12-15 7:53 UTC (permalink / raw)
To: Jie Zhang; +Cc: gdb-patches
> The Tcl global command has no effect unless executed in the context of
> a proc body. So the global commands in the following code are
> useless.
Verified in the Tcl 8.4 documentation.
> Even worse, they would cause unexpected result. When gdb_expect gets
> something containing "global", it will try to execute hex as a command,
> which will cause an error.
I'm wondering how this is happening, though. I presume that the test
was working when the testcase was added by the original author...
It's working for me too, actually.
That being said, these are only side questions. The patch looks correct
to me.
> 2008-12-15 Jie Zhang <jie.zhang@analog.com>
>
> * gdb.base/consecutive.exp: Don't use global in gdb_expect.
OK.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Testsuite: Don't use global command in gdb_expect
2008-12-15 7:53 ` Joel Brobecker
@ 2008-12-15 8:50 ` Andreas Schwab
2008-12-15 13:16 ` Jie Zhang
2008-12-18 19:57 ` Michael Snyder
2 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2008-12-15 8:50 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Jie Zhang, gdb-patches
Joel Brobecker <brobecker@adacore.com> writes:
> I'm wondering how this is happening, though. I presume that the test
> was working when the testcase was added by the original author...
> It's working for me too, actually.
Probably because you were lucky enough to test it against output that
does not contain a match for "global".
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Testsuite: Don't use global command in gdb_expect
2008-12-15 7:53 ` Joel Brobecker
2008-12-15 8:50 ` Andreas Schwab
@ 2008-12-15 13:16 ` Jie Zhang
2008-12-18 19:57 ` Michael Snyder
2 siblings, 0 replies; 5+ messages in thread
From: Jie Zhang @ 2008-12-15 13:16 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Hi Joel,
Joel Brobecker wrote:
>> The Tcl global command has no effect unless executed in the context of
>> a proc body. So the global commands in the following code are
>> useless.
>
> Verified in the Tcl 8.4 documentation.
>
Yeah. The first sentence was just copied from Tcl documentation. ;-)
>> Even worse, they would cause unexpected result. When gdb_expect gets
>> something containing "global", it will try to execute hex as a command,
>> which will cause an error.
>
> I'm wondering how this is happening, though. I presume that the test
> was working when the testcase was added by the original author...
> It's working for me too, actually.
>
I'm working on the Blackfin port of GDB. Blackfin disassembler has a
feature to guess the register value and output it in a comment beside
the disassembling output of instruction. It also outputs a symbol if one
can be found which matches the value. Unfortunately, the symbol found in
this test case contains "global" as a substring, which caused the issue.
> That being said, these are only side questions. The patch looks correct
> to me.
>
>> 2008-12-15 Jie Zhang <jie.zhang@analog.com>
>>
>> * gdb.base/consecutive.exp: Don't use global in gdb_expect.
>
> OK.
>
Committed. Thanks.
Jie
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Testsuite: Don't use global command in gdb_expect
2008-12-15 7:53 ` Joel Brobecker
2008-12-15 8:50 ` Andreas Schwab
2008-12-15 13:16 ` Jie Zhang
@ 2008-12-18 19:57 ` Michael Snyder
2 siblings, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2008-12-18 19:57 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Jie Zhang, gdb-patches
Joel Brobecker wrote:
>> The Tcl global command has no effect unless executed in the context of
>> a proc body. So the global commands in the following code are
>> useless.
>
> Verified in the Tcl 8.4 documentation.
>
>> Even worse, they would cause unexpected result. When gdb_expect gets
>> something containing "global", it will try to execute hex as a command,
>> which will cause an error.
>
> I'm wondering how this is happening, though. I presume that the test
> was working when the testcase was added by the original author...
That would be me, I think.
I probably did not understand the issue, and I support
whatever solution you two arrive at. ;-)
> It's working for me too, actually.
>
> That being said, these are only side questions. The patch looks correct
> to me.
>
>> 2008-12-15 Jie Zhang <jie.zhang@analog.com>
>>
>> * gdb.base/consecutive.exp: Don't use global in gdb_expect.
>
> OK.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-12-18 19:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-15 6:07 Testsuite: Don't use global command in gdb_expect Jie Zhang
2008-12-15 7:53 ` Joel Brobecker
2008-12-15 8:50 ` Andreas Schwab
2008-12-15 13:16 ` Jie Zhang
2008-12-18 19:57 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox