Fix latent bug in DWARF test case
authorTom Tromey <tom@tromey.com>
Fri, 29 Oct 2021 23:04:09 +0000 (17:04 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 31 Oct 2021 17:35:28 +0000 (11:35 -0600)
On my branch that replaces the DWARF psymtab reader,
dw2-stack-boundary.exp started failing.  However, when I look at the
output in gdb.log, it is correct:

    file /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary
    Reading symbols from /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary...
    During symbol reading: location description stack overflow
    During symbol reading: location description stack underflow

What happens to cause the failure is that the two branches in
gdb_test_multiple appear in this order:

    -re "\r\nDuring symbol reading: location description stack underflow" {
    [...]
    -re "\r\nDuring symbol reading: location description stack overflow" {

The first one will match the above, without causing the second one to
ever match -- leading to a spurious failure.

Anchoring the regexps seems to fix the problem, and works for the
current gdb as well.

gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp

index 8b81b5b2119481a472858bf3bbd2054a1c9f31d6..054d0c66e71e9612bf303d597f17456e37cabb80 100644 (file)
@@ -44,11 +44,11 @@ gdb_test_multiple "file $binfile" "file command" {
     -re "\r\nReading symbols from \[^\r\n\]*\\.\\.\\." {
        exp_continue
     }
-    -re "\r\nDuring symbol reading: location description stack underflow" {
+    -re "^\r\nDuring symbol reading: location description stack underflow" {
        set w1 1
        exp_continue
     }
-    -re "\r\nDuring symbol reading: location description stack overflow" {
+    -re "^\r\nDuring symbol reading: location description stack overflow" {
        set w2 1
        exp_continue
     }