Control sequences output when testing GDB

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Control sequences output when testing GDB

Cygwin list mailing list
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
  [?25lType "apropos word" to search for commands related to "word".
  (gdb) set height 0
  (gdb) set width 0
  (gdb) dir

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
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Control sequences output when testing GDB

Cygwin list mailing list
On 2020-03-17 9:51 a.m., Simon Marchi wrote:

> 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
>   [?25lType "apropos word" to search for commands related to "word".
>   (gdb) set height 0
>   (gdb) set width 0
>   (gdb) dir
>
> 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
>

Oh well, I just saw this response from Ken earlier today (sorry about
that, I'm not subscribed to the list):

  https://sourceware.org/pipermail/cygwin/2020-March/244091.html

So I guess there's no explanation yet, just the workaround.

Simon
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple