From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] [gdb/testsuite] Don't start gdb in gdb.base/gstack.exp
Date: Mon, 17 Feb 2025 17:36:17 +0100 [thread overview]
Message-ID: <20250217163619.8662-2-tdevries@suse.de> (raw)
In-Reply-To: <20250217163619.8662-1-tdevries@suse.de>
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.
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(-)
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
index f603f2b4ea3..8df36b1b3bc 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
--
2.43.0
next prev parent reply other threads:[~2025-02-17 16:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 16:36 [PATCH 0/3] [gdb/testsuite] Clean up left-over processes Tom de Vries
2025-02-17 16:36 ` Tom de Vries [this message]
2025-02-17 17:20 ` [PATCH 1/3] [gdb/testsuite] Don't start gdb in gdb.base/gstack.exp Keith Seitz
2025-02-18 7:59 ` Tom de Vries
2025-02-17 16:36 ` [PATCH 2/3] [gdb/testsuite] Kill left-over process in gdb.base/add-symbol-file-attach.exp Tom de Vries
2025-02-24 17:26 ` Tom Tromey
2025-02-24 17:57 ` Tom de Vries
2025-02-24 18:05 ` Tom Tromey
2025-02-24 18:43 ` Tom de Vries
2025-02-17 16:36 ` [PATCH 3/3] [gdb/testsuite] Exit left-over gdb in gdb.mi/mi-break.exp Tom de Vries
2025-02-24 17:28 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250217163619.8662-2-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox