From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] [gdb/testsuite] Fix timeout in gdb.base/gstack.exp
Date: Thu, 17 Sep 2026 15:06:36 +0200 [thread overview]
Message-ID: <20260917130637.3224975-2-tdevries@suse.de> (raw)
In-Reply-To: <20260917130637.3224975-1-tdevries@suse.de>
When running test-case gdb.base/gstack.exp on msys2-ucrt64, I run into a timeout:
...
PASS: $exp: spawn inferior
looping^M^M
FAIL: $exp: wait for inferior to loop (timeout)
...
The extra ^M is due to the translation mode of the output stream, which is set
to text by default.
Fix this by accepting the extra ^M, using a new proc multi_line_ttm, where
ttm stands for text translation mode.
---
gdb/testsuite/gdb.base/gstack.exp | 6 +++++-
gdb/testsuite/lib/gdb.exp | 18 ++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
index bc524215d50..8c360198e93 100644
--- a/gdb/testsuite/gdb.base/gstack.exp
+++ b/gdb/testsuite/gdb.base/gstack.exp
@@ -33,8 +33,12 @@ set test_spawn_id $res
# Wait for the spawned program to loop.
set test "wait for inferior to loop"
+set re \
+ [multi_line_ttm \
+ "looping" \
+ ""]
gdb_expect {
- -re "looping\r\n" {
+ -re $re {
pass $test
}
eof {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1ebdaf6ba10..c8dd4414b26 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -10772,6 +10772,24 @@ proc multi_line { args } {
return [join $args "\r\n"]
}
+# As multi_line, but deals with text translation mode. On windows, if the
+# translation mode of an output stream of an executable is set to text, every
+# '\n' is translated to '\r\n'. For GDB, we work around this using
+# -binary-output, so we can just use multi_line. But for other executables,
+# we need to handle this.
+
+proc multi_line_ttm { args } {
+ if { ![ishost "*-*-mingw*"] } {
+ return [multi_line {*}$args]
+ }
+
+ if { [llength $args] == 1 } {
+ set hint "forgot {*} before list argument?"
+ error "multi_line_ttm called with one argument ($hint)"
+ }
+ return [join $args "\r\r\n"]
+}
+
# Similar to the above, but while multi_line is meant to be used to
# match GDB output, this one is meant to be used to build strings to
# send as GDB input.
--
2.51.0
next prev parent reply other threads:[~2026-09-17 13:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 13:06 [PATCH 0/2] [gdb] Two fixes for gdb.base/gstack.exp on msys2-ucrt64 Tom de Vries
2026-09-17 13:06 ` Tom de Vries [this message]
2026-09-17 13:06 ` [PATCH 2/2] [gdb] Handle AWK=gawk in gstack Tom de Vries
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=20260917130637.3224975-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