[gdb/testsuite] Fix gdb.threads/manythreads.exp with check-read1
authorTom de Vries <tdevries@suse.de>
Sat, 4 Jun 2022 09:16:22 +0000 (11:16 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 4 Jun 2022 09:16:22 +0000 (11:16 +0200)
commitde15377594391aa201fba1ce7d8924274e10abbf
tree42855f192f0cbb815c5921d614d7d31a659eb55a
parent98c17098021554b3394ba052e94d9f1243ae37c2
[gdb/testsuite] Fix gdb.threads/manythreads.exp with check-read1

When running test-case gdb.threads/manythreads.exp with check-read1, I ran
into this hard-to-reproduce FAIL:
...
[New Thread 0x7ffff7318700 (LWP 31125)]^M
[Thread 0x7ffff7321700 (LWP 31124) exited]^M
[New T^C^M
^M
Thread 769 "manythreads" received signal SIGINT, Interrupt.^M
[Switching to Thread 0x7ffff6d66700 (LWP 31287)]^M
0x00007ffff7586a81 in clone () from /lib64/libc.so.6^M
(gdb) FAIL: gdb.threads/manythreads.exp: stop threads 1
...

The matching in the failing gdb_test_multiple is done in an intricate way,
trying to pass on some order and fail on another order.

Fix this by rewriting the regexps to match one line at most, and detecting
invalid order by setting and checking state variables.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29177
gdb/testsuite/gdb.threads/manythreads.exp