diff options
author | Tom de Vries <tdevries@suse.de> | 2025-02-18 08:47:33 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2025-02-18 08:47:33 +0100 |
commit | ec51c7ce9fb0a8c4b891cc67658c225be23e6820 (patch) | |
tree | 1e97729480404551c81e5b0dd43d0968bec662b6 | |
parent | 24a2f1a6b0ceca9ab50c0d5cd16daba5a7ee1a3a (diff) | |
download | binutils-ec51c7ce9fb0a8c4b891cc67658c225be23e6820.zip binutils-ec51c7ce9fb0a8c4b891cc67658c225be23e6820.tar.gz binutils-ec51c7ce9fb0a8c4b891cc67658c225be23e6820.tar.bz2 |
[gdb/testsuite] Don't start gdb in gdb.base/gstack.exp
In test-case gdb.base/gstack.exp we start a gdb implicitly using
prepare_for_testing.
The gdb is not really used, but its spawn_id (available in variable
gdb_spawn_id) is used in a gdb_test_multiple, which is used to interact with
the gstack process.
Usually, a running gdb is cleaned up at test-case exit in gdb_finish, which
calls gdb_exit, which by default calls gdb_default_exit, which does
'send_gdb "quit\n"'.
However, this sends a quit to the host process expect is currently talking to,
defined by board_info(host,fileid), and after spawning gstack that's gstack, not
gdb.
Fix this by:
- using build_executable instead of prepare_for_testing to not spawn an unused
gdb, and
- changing the gdb_test_multiple into a gdb_expect, eliminating the implicit use
of gdb_spawn_id.
Tested on x86_64-linux.
Reviewed-By: Keith Seitz <keiths@redhat.com>
PR testsuite/32709
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32709
-rw-r--r-- | gdb/testsuite/gdb.base/gstack.exp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp index f603f2b..8df36b1 100644 --- a/gdb/testsuite/gdb.base/gstack.exp +++ b/gdb/testsuite/gdb.base/gstack.exp @@ -18,7 +18,7 @@ require can_spawn_for_attach standard_testfile -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] == -1} { +if {[build_executable "failed to prepare" $testfile $srcfile {debug}] == -1} { return -1 } @@ -62,7 +62,7 @@ if { ![gdb_assert { ![expr {$res < 0 || $res == ""}] } $test] } { set test "got backtrace" set saw_backtrace false set no_awk false -gdb_test_multiple "" $test { +gdb_expect { -i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*\r\nGSTACK-END\r\n\$" { set saw_backtrace true pass $test |