]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Handle unrecognized escape sequences better in tuiterm
authorTom de Vries <tdevries@suse.de>
Sat, 16 Aug 2025 07:18:45 +0000 (09:18 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 16 Aug 2025 07:18:45 +0000 (09:18 +0200)
commit06a53717f7c5abfd87165f3e5c7f55f9a8f512a7
treee1abb40dba62e9afc8b6675350eaefdc65d851c3
parent96265ee7fa3fcc3532a323cac74e3828df331114
[gdb/testsuite] Handle unrecognized escape sequences better in tuiterm

When encountering an unrecognized escape sequence in Term::accept_gdb_output,
a warning is issued:
...
WARNING: timeout in accept_gdb_output
...
and 0 is returned.

Subsequent calls run into the same problem, so matching doesn't progress.

Consequently, figuring out what the unrecognized escape sequence actually is
depends on analyzing gdb's output as echoed into gdb.log.

In the test added in this commit, gdb (well, a script gdb.tcl emulating gdb)
outputs escape sequence "ESC ( B", which doesn't show up in recognizable form
in gdb.log:
...
foo^M^M
...
and as mentioned the tuiterm screen only show:
...
foo
...
because matching doesn't progress beyond the unrecognized sequence.

Fix this by rewriting accept_gdb_output to match gdb output using a phased
approach that echoes unmatched escape sequences, giving us instead on the
tuiterm screen:
...
foo^[(B
...

[ Since "ESC ( B" is now supported, the test-case has been updated to use
"ESC ( % 5" instead. ]

Tested on x86_64-linux.

PR testsuite/33218
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33218
gdb/testsuite/gdb.tui/gdb.tcl [new file with mode: 0755]
gdb/testsuite/gdb.tui/tuiterm-2.exp
gdb/testsuite/lib/tuiterm.exp