From 9197cd8b52aa41a04b883d83df863ecb5afc5d35 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 29 Jul 2019 11:24:04 +0200 Subject: [PATCH] [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 * gdb.base/maint.exp: Use "\r\n" instead of "\[\r\n\]+" in "maint print registers" regexps. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/maint.exp | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ff6159e1109..f18f0ab1082 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-29 Tom de Vries + + * gdb.base/maint.exp: Use "\r\n" instead of "\[\r\n\]+" in "maint + print registers" regexps. + 2019-07-29 Tom de Vries * gdb.base/define.exp: Add "\r\n" to "reset gdb_prompt" regexp. diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index a7675ea215b..36738f6eaa7 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -69,15 +69,15 @@ set saw_registers 0 set saw_headers 0 set test "maint print registers" gdb_test_multiple $test $test { - -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\[\r\n\]+" { + -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\r\n" { set saw_headers 1 exp_continue } - -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[\r\n\]+" { + -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\r\n" { set saw_registers 1 exp_continue } - -re "^\\*\[0-9\]+\[^\r\n\]+\[\r\n\]+" { + -re "^\\*\[0-9\]+\[^\r\n\]+\r\n" { exp_continue } -re "$gdb_prompt $" { -- 2.30.2