From ec51c7ce9fb0a8c4b891cc67658c225be23e6820 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 18 Feb 2025 08:47:33 +0100 Subject: [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 PR testsuite/32709 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32709 --- gdb/testsuite/gdb.base/gstack.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb') 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 -- cgit v1.1