Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] [gdb] Two fixes for gdb.base/gstack.exp on msys2-ucrt64
@ 2026-09-17 13:06 Tom de Vries
  2026-09-17 13:06 ` [PATCH 1/2] [gdb/testsuite] Fix timeout in gdb.base/gstack.exp Tom de Vries
  2026-09-17 13:06 ` [PATCH 2/2] [gdb] Handle AWK=gawk in gstack Tom de Vries
  0 siblings, 2 replies; 3+ messages in thread
From: Tom de Vries @ 2026-09-17 13:06 UTC (permalink / raw)
  To: gdb-patches

The first patch fixes a timeout in the test-case.

The second patch allows "AWK=gawk gstack".

Tom de Vries (2):
  [gdb/testsuite] Fix timeout in gdb.base/gstack.exp
  [gdb] Handle AWK=gawk in gstack

 gdb/gstack-1.in                   |  2 ++
 gdb/testsuite/gdb.base/gstack.exp |  6 +++++-
 gdb/testsuite/lib/gdb.exp         | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)


base-commit: 262d0a898d69671af67680f2b1c9734dfd50cc99
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] [gdb/testsuite] Fix timeout in gdb.base/gstack.exp
  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
  2026-09-17 13:06 ` [PATCH 2/2] [gdb] Handle AWK=gawk in gstack Tom de Vries
  1 sibling, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2026-09-17 13:06 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] [gdb] Handle AWK=gawk in gstack
  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 ` [PATCH 1/2] [gdb/testsuite] Fix timeout in gdb.base/gstack.exp Tom de Vries
@ 2026-09-17 13:06 ` Tom de Vries
  1 sibling, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2026-09-17 13:06 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.base/gstack.exp on msys2-ucrt64, I run into:
...
PASS: $exp: spawn gstack
gstack: could not find usable awk interpreter
GSTACK-END
PASS: $exp: gstack exits with no error
PASS: $exp: gstack's exit status is 0
UNSUPPORTED: gdb.base/gstack.exp: no awk interpreter found
...

The failure can be reproducing on the command line:
...
$ AWK=gawk gstack
gstack: could not find usable awk interpreter
...

Fix this in gstack using:
...
AWK=$(command -v "$AWK")
...
---
 gdb/gstack-1.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/gstack-1.in b/gdb/gstack-1.in
index 9079e70a746..46fa9429d86 100755
--- a/gdb/gstack-1.in
+++ b/gdb/gstack-1.in
@@ -34,6 +34,8 @@ if [ -z "$AWK" ]; then
 	test -n "$awk_prog" && break
     done
     AWK="$awk_prog"
+else
+    AWK=$(command -v "$AWK")
 fi
 if [ ! -x "$AWK" ]; then
     echo "$0: could not find usable awk interpreter" 1>&2
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-17 13:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/2] [gdb/testsuite] Fix timeout in gdb.base/gstack.exp Tom de Vries
2026-09-17 13:06 ` [PATCH 2/2] [gdb] Handle AWK=gawk in gstack Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox