This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Testsuite: Don't use global command in gdb_expect
- From: Jie Zhang <jie dot zhang at analog dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 15 Dec 2008 14:06:39 +0800
- Subject: Testsuite: Don't use global command in gdb_expect
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
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"