[gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp with readnow
authorTom de Vries <tdevries@suse.de>
Wed, 5 May 2021 07:07:27 +0000 (09:07 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 5 May 2021 07:07:27 +0000 (09:07 +0200)
When running test-case gdb.threads/fork-plus-threads.exp with target board
readnow, I run into:
...
[LWP 9362 exited]^M
[New LWP 9365]^M
[New LWP 9363]^M
[New LWP 9364]^M
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
  inferior 1 exited (timeout)
...

There is code in the test-case to prevent timeouts with readnow:
...
       -re "Thread \[^\r\n\]+ exited" {
           # Avoid timeout with check-read1
           exp_continue
       }
       -re "New Thread \[^\r\n\]+" {
           # Avoid timeout with check-read1
           exp_continue
       }
...
but this doesn't trigger because we get LWP rather than Thread.

Fix this by making these regexps accept LWP as well.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-05-05  Tom de Vries  <tdevries@suse.de>

* gdb.threads/fork-plus-threads.exp: Handle "New LWP <n>" and
"LWP <n> exited" messages.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/fork-plus-threads.exp

index 326ba47961f8d65acda18b14fbbe85d59a395ce9..2be97a2f3946dbc099a735b4fe5ca82f37b8f39f 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-05  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.threads/fork-plus-threads.exp: Handle "New LWP <n>" and
+       "LWP <n> exited" messages.
+
 2021-05-04  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * gdb.python/py-type.exp (test_fields): Test calling fields on
index f5cfb279ce7e97c1378531d77a4f53a15584950c..7fe3c603bcde2e8057b1a554ed4567674d425038 100644 (file)
@@ -87,11 +87,11 @@ proc do_test { detach-on-fork } {
            set saw_thread_stopped 1
            exp_continue
        }
-       -re "Thread \[^\r\n\]+ exited" {
+       -re "(Thread|LWP) \[^\r\n\]+ exited" {
            # Avoid timeout with check-read1
            exp_continue
        }
-       -re "New Thread \[^\r\n\]+" {
+       -re "New (Thread|LWP) \[^\r\n\]+" {
            # Avoid timeout with check-read1
            exp_continue
        }