For test-case gdb.base/async-shell.exp, I usually get:
...
(gdb) run &^M
Starting program: async-shell ^M
(gdb) PASS: $exp: run &
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
shell echo foo^M
foo^M
(gdb) PASS: $exp: shell echo foo
...
And with taskset -c 11, I get instead:
...
(gdb) run &^M
Starting program: async-shell ^M
(gdb) PASS: $exp: run &
shell echo foo^M
foo^M
(gdb) PASS: $exp: shell echo foo
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
...
With a gdb 16.3 based package I ran into:
...
(gdb) run &
Starting program: async-shell
(gdb) PASS: $exp: run &
shell echo foo
foo
(gdb) [Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
FAIL: $exp: shell echo foo (timeout)
...
I have tried to reproduce this using various timing tricks, but haven't
managed. Nevertheless, I believe this can reproduced with trunk, so fix this
using -no-prompt-anchor.
PR testsuite/33667
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33667
# `sleep 5' here would workaround the bug, do not sleep here.
# "shell" could eat waitpid event from the asynchronous inferior process.
-gdb_test "shell echo foo" "foo"
+gdb_test -no-prompt-anchor "shell echo foo" "foo"
set test "interrupt"
gdb_test_multiple $test $test {