Control sequences output when testing GDB
Simon Marchi
simon.marchi@efficios.com
Tue Mar 17 13:51:41 GMT 2020
Hi,
I had to make a GDB fix related to Cygwin recently, so I tried to run some tests
from the GDB testsuite on Cygwin. This is my first foray into Cygwin.
The test I ran failed, because the GDB under test outputs what appears to be control
sequences to clear the remaining characters of the line and go to the new line. What's
surprising is that these control characters only start to appear when we use the "run"
command of GDB, which makes GDB spawn the process to debug.
The full test log is here:
https://pastebin.com/raw/m6JYGRvs
But here are a few lines around where it starts getting interesting:
(gdb) break main
Breakpoint 1 at 0x1004012e3: file /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/sizeof.c, line 101.
(gdb) run
Starting program: /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/sizeof/sizeof
[?25l[HType "apropos word" to search for commands related to "word".[19X[19C
(gdb) set height 0[62X[62C
(gdb) set width 0[63X[63C
(gdb) dir[71X[71C
The numbers match the number of characters left to the line, after what has already been
output (for a total of 80). According to [1], the 'X' is "Erase Character" and the 'C' is
"Cursor Forward".
When the program starts, we also see one for "Text Cursor Enable Mode Hide".
These control sequences are a bit problematic, because all the text that the testsuite
is supposed to match is not matched, and the tests fail.
It was suggested to me (by jturney on IRC) to use:
export CYGWIN=disable_pcon
To disable to use the new new Windows Pseudo Console thing. And indeed, it makes the output
free of these escape sequences, and the test passes fine.
Anybody can explain what is happening, and what we should do about it?
Thanks,
Simon
[1] https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
More information about the Cygwin
mailing list