X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 433FE394440B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1584453105;
	bh=wk1koZmuLzlccVqs1eKPG1jJfAegAAjSC14DJI4Prr0=;
	h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
	 List-Help:List-Subscribe:From:Reply-To:From;
	b=YxrD5obdi2KUv542P4aBfiiLFphDZBquQo3hNmzhHg9Obxs7BDR5xiuP2fx0CIq4/
	 U+cPCQY0XTWYNutNUSGcPGK5ocL37T7bmfU6j4u3ZDR5c/0bLMfc7s9NZ4EvJNcePG
	 Oh0n+JF2JwXfOPQHB9A4VTyesX1ZoUJ1wd4Ualh8=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com EC3DF2748A1
X-Virus-Scanned: amavisd-new at efficios.com
To: cygwin@cygwin.com
Subject: Control sequences output when testing GDB
Message-ID: <606a1134-7bfa-17da-3540-b32ba4592a7a@efficios.com>
Date: Tue, 17 Mar 2020 09:51:41 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.6.0
MIME-Version: 1.0
Content-Language: en-US-large
X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED, DKIM_VALID,
 DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE,
 SPF_PASS autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
List-Id: Cygwin mailing list <cygwin.cygwin.com>
List-Archive: <http://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <http://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Simon Marchi via Cygwin <cygwin@cygwin.com>
Reply-To: Simon Marchi <simon.marchi@efficios.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces@cygwin.com>

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
--
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
