From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: drow@false.org (Daniel Jacobowitz)
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Increase match_max size for GDB testsuite?
Date: Thu, 08 Mar 2007 20:01:00 -0000 [thread overview]
Message-ID: <200703082000.l28K0w2E018600@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20070308184617.GA22903@caradoc.them.org> from "Daniel Jacobowitz" at Mar 08, 2007 01:46:17 PM
Daniel Jacobowitz:
> The checkpoint tests have a similar problem, but nowhere else should.
> Basically, there are two ways you can approach large tests: you can
> make the buffer bigger, and perform regex matching on an increasingly
> huge output, or you can match one line at a time and use exp_continue.
> One example of this is in auxv.exp.
Thanks for pointing this out, I was not aware of that expect feature.
> I'd mildly prefer that approach - the big buffer can be very slow, and
> it just means we'll be back to the problem again later if another
> target has even more registers.
I agree. The following patch implements a fetch_all_registers function
modeled after the fetch_auvx routine. This also fixes the problem on
spu-elf. Does it look OK to you?
Bye,
Ulrich
ChangeLog:
* gdb.base/callfuncs.exp (do_get_all_registers): Remove.
(fetch_all_registers): New function, uses gdb_test_multiple and
exp_continue to fetch inferior output line-by-line.
Replace all uses of do_get_all_registers by fetch_all_registers.
Index: gdb/testsuite/gdb.base/callfuncs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.exp,v
retrieving revision 1.19
diff -u -p -r1.19 callfuncs.exp
--- gdb/testsuite/gdb.base/callfuncs.exp 31 Jan 2007 15:37:49 -0000 1.19
+++ gdb/testsuite/gdb.base/callfuncs.exp 8 Mar 2007 19:55:14 -0000
@@ -236,28 +236,56 @@ proc do_function_calls {} {
}
# Procedure to get current content of all registers.
-global all_registers_content
-set all_registers_content ""
-proc do_get_all_registers { } {
+proc fetch_all_registers {test} {
global gdb_prompt
- global expect_out
- global all_registers_content
- set all_registers_content ""
- send_gdb "info all-registers\n"
- gdb_expect {
- -re "info all-registers\r\n(.*)$gdb_prompt $" {
- set all_registers_content $expect_out(1,string)
+ set all_registers_lines {}
+ set bad -1
+ if {[gdb_test_multiple "info all-registers" $test {
+ -re "info all-registers\[\r\n\]+" {
+ exp_continue
+ }
+ -ex "The program has no registers now" {
+ set bad 1
+ exp_continue
+ }
+ -re "^bspstore\[ \t\]+\[^\r\n\]+\[\r\n\]+" {
if [istarget "ia64-*-*"] {
# Filter out bspstore which is specially tied to bsp,
# giving spurious differences.
- regsub {\nbspstore[^\n]*\n} $all_registers_content "\n" all_registers_content
+ } else {
+ lappend all_registers_lines $expect_out(0,string)
+ }
+ exp_continue
+ }
+ -re "^\[^ \t\]+\[ \t\]+\[^\r\n\]+\[\r\n\]+" {
+ lappend all_registers_lines $expect_out(0,string)
+ exp_continue
+ }
+ -re ".*$gdb_prompt $" {
+ incr bad
+ }
+ -re "^\[^\r\n\]+\[\r\n\]+" {
+ if {!$bad} {
+ warning "Unrecognized output: $expect_out(0,string)"
+ set bad 1
}
+ exp_continue
}
- default {}
+ }] != 0} {
+ return {}
+ }
+
+ if {$bad} {
+ fail $test
+ return {}
}
+
+ pass $test
+ return $all_registers_lines
}
+
# Start with a fresh gdb.
gdb_exit
@@ -302,19 +330,18 @@ gdb_test "next" "t_structs_c\\(struct_va
"next to t_structs_c"
# Save all register contents.
-do_get_all_registers
-set old_reg_content $all_registers_content
+set old_reg_content [fetch_all_registers "retrieve original register contents"]
# Perform function calls.
do_function_calls
# Check if all registers still have the same value.
-do_get_all_registers
-set new_reg_content $all_registers_content
-if ![string compare $old_reg_content $new_reg_content] then {
+set new_reg_content [fetch_all_registers \
+ "register contents after gdb function calls"]
+if {$old_reg_content == $new_reg_content} then {
pass "gdb function calls preserve register contents"
} else {
- set old_reg_content $all_registers_content
+ set old_reg_content $new_reg_content
fail "gdb function calls preserve register contents"
}
@@ -330,9 +357,9 @@ gdb_test "continue" "Continuing.*" "cont
if ![gdb_test "bt 2" \
"#0 main.*" \
"bt after continuing from call dummy breakpoint"] then {
- do_get_all_registers
- set new_reg_content $all_registers_content
- if ![string compare $old_reg_content $new_reg_content] then {
+ set new_reg_content [fetch_all_registers \
+ "register contents after stop in call dummy"]
+ if {$old_reg_content == $new_reg_content} then {
pass "continue after stop in call dummy preserves register contents"
} else {
fail "continue after stop in call dummy preserves register contents"
@@ -349,9 +376,9 @@ gdb_test "finish" \
if ![gdb_test "bt 2" \
"#0 main.*" \
"bt after finishing from call dummy breakpoint"] then {
- do_get_all_registers
- set new_reg_content $all_registers_content
- if ![string compare $old_reg_content $new_reg_content] then {
+ set new_reg_content [fetch_all_registers \
+ "register contents after finish in call dummy"]
+ if {$old_reg_content == $new_reg_content} then {
pass "finish after stop in call dummy preserves register contents"
} else {
fail "finish after stop in call dummy preserves register contents"
@@ -367,9 +394,9 @@ if ![gdb_test "return 7" \
"back at main after return from call dummy breakpoint" \
"Make add return now. .y or n.*" \
"y"] then {
- do_get_all_registers
- set new_reg_content $all_registers_content
- if ![string compare $old_reg_content $new_reg_content] then {
+ set new_reg_content [fetch_all_registers \
+ "register contents after return in call dummy"]
+ if {$old_reg_content == $new_reg_content} then {
pass "return after stop in call dummy preserves register contents"
} else {
fail "return after stop in call dummy preserves register contents"
@@ -424,9 +451,9 @@ gdb_test "finish" "Value returned is .*
gdb_test "backtrace" "\#0 main .*" \
"backtrace after finish from nested call level 1"
-do_get_all_registers
-set new_reg_content $all_registers_content
-if ![string compare $old_reg_content $new_reg_content] then {
+set new_reg_content [fetch_all_registers \
+ "register contents after nested call dummies"]
+if {$old_reg_content == $new_reg_content} then {
pass "nested call dummies preserve register contents"
} else {
fail "nested call dummies preserve register contents"
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2007-03-08 20:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 18:39 Ulrich Weigand
2007-03-08 18:46 ` Daniel Jacobowitz
2007-03-08 20:01 ` Ulrich Weigand [this message]
2007-03-08 20:05 ` Daniel Jacobowitz
2007-03-08 20:10 ` Ulrich Weigand
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=200703082000.l28K0w2E018600@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@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: link
Be 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