[gdb/testsuite] Fix gdb.base/maint.exp with check-read1
With gdb.base/maint.exp and check-read1, we get:
...
FAIL: gdb.base/maint.exp: maint print registers
...
Using this patch:
...
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index
a7675ea215..
b81d7ec660 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -81,7 +81,9 @@ gdb_test_multiple $test $test {
exp_continue
}
-re "$gdb_prompt $" {
- gdb_assert { $saw_registers && $saw_headers } $test
+ gdb_assert { $saw_headers } "$test: saw headers"
+ gdb_assert { $saw_registers } "$test: saw registers"
+ pass "$test: got prompt"
}
}
...
We get more information:
...
PASS: gdb.base/maint.exp: maint print registers: saw headers
FAIL: gdb.base/maint.exp: maint print registers: saw registers
PASS: gdb.base/maint.exp: maint print registers: got prompt
...
The problem is that when matching:
...
(gdb) maint print registers^M
Name Nr Rel Offset Size Type ^M
rax 0 0 0 8 int64_t ^M
...
the regexp for $saw_headers ends in "\[\r\n\]+", which
allows it to match only the "\r". The remaining "\n" then start the next line
to be matched, which doesn't match for the $saw_registers regexp since it
starts with "^\[^\r\n\]+".
Fix this by ending the regexps with "\r\n".
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-29 Tom de Vries <tdevries@suse.de>
* gdb.base/maint.exp: Use "\r\n" instead of "\[\r\n\]+" in "maint
print registers" regexps.