From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH] native mingw32 gdb, eol format
Date: Tue, 16 Jul 2013 01:07:00 -0000 [thread overview]
Message-ID: <1373936767-14858-1-git-send-email-yao@codesourcery.com> (raw)
Hello,
I see the following fail on a remote windows host for mingw32 native
gdb,
info tracepoints^M
Num Type Disp Enb Address What^M^M
1 tracepoint keep y 0x0040143f in gdb_c_test at actions.c:74^M^M
not installed on target^M^M
2 tracepoint keep y 0x00401687 in gdb_asm_test at actions.c:121^M^M
not installed on target^M^M
3 tracepoint keep y 0x004013d2 in gdb_recursion_test at actions.c:61^M^M
not installed on target^M^M
(gdb) FAIL: gdb.trace/deltrace.exp: 3.1a: set three tracepoints
this fail is caused by an extra '\r' at end of each line.
on Windows, when a file is opened in text mode, a "\n" is always
expanded to "\r\n", so gdb on Windows is outputting "\r\n", and when
that goes through the PTY, the '\n' is being expanded to "\r\n",
hence "\r\r\n".
This patch, which was written by Pedro, is to force stdout/stderr to
binary mode prevents that expansion. This patch gets much
improvement on the test result of mingw native gdb. Is it OK?
=== gdb Summary ===
-# of expected passes 11845
-# of unexpected failures 2931
-# of expected failures 22
-# of unknown successes 1
-# of known failures 20
-# of unresolved testcases 911
-# of untested testcases 131
-# of unsupported tests 84
+# of expected passes 14613
+# of unexpected failures 780
+# of unexpected successes 1
+# of expected failures 37
+# of known failures 35
+# of unresolved testcases 23
+# of untested testcases 130
+# of unsupported tests 94
gdb:
2013-07-16 Pedro Alves <pedro@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* mingw-hdep.c (_initialize_mingw_hdep): If stdout and stderr
are pipes, set them to binary mode.
---
gdb/mingw-hdep.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index efc9848..3b29495 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -271,5 +271,24 @@ extern initialize_file_ftype _initialize_mingw_hdep;
void
_initialize_mingw_hdep (void)
{
+ int out = fileno (stdout);
+ int err = fileno (stderr);
+ HANDLE hout = (HANDLE) _get_osfhandle (out);
+ HANDLE herr = (HANDLE) _get_osfhandle (err);
+
+ /* In textmode, a '\n' is automatically expanded into "\r\n". When
+ driving the testsuite from a linux host, the '\n' is also
+ expanded into "\r\n". This results in expect seeing "\r\r\n".
+ The tests aren't prepared currently for other forms of eol. As a
+ workaround, we force the output to binary mode. Do this only if
+ the files are pipes (cygwin ttys are Windows pipes behind the
+ scenes). */
+ if (GetFileType (hout) == FILE_TYPE_PIPE
+ && GetFileType (herr) == FILE_TYPE_PIPE)
+ {
+ setmode (out, O_BINARY);
+ setmode (err, O_BINARY);
+ }
+
sigint_event = CreateEvent (0, FALSE, FALSE, 0);
}
--
1.7.7.6
next reply other threads:[~2013-07-16 1:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 1:07 Yao Qi [this message]
2013-07-16 2:50 ` Eli Zaretskii
2013-07-20 0:38 ` Yao Qi
2013-07-20 6:55 ` Eli Zaretskii
2013-07-23 19:03 ` Tom Tromey
2013-07-23 19:08 ` Eli Zaretskii
2013-07-23 20:58 ` Tom Tromey
2013-07-24 3:46 ` Eli Zaretskii
2013-07-24 9:09 ` Yao Qi
2013-09-17 13:07 ` [PATCH 0/4] Match \r\r\n in testsuite Yao Qi
2013-09-17 13:07 ` [PATCH 3/4] Transform \r\n in MI variables Yao Qi
2013-09-17 13:07 ` [PATCH 2/4] Transform "\r\n" in pattern to "\r+\n" Yao Qi
2013-09-17 23:11 ` Pierre Muller
2013-09-17 13:07 ` [PATCH 4/4] Replace "." with "\r+" Yao Qi
2013-09-17 13:07 ` [PATCH 1/4] Use gdb_test_sequence to test "info tracepoints" Yao Qi
2013-09-17 13:35 ` [PATCH 0/4] Match \r\r\n in testsuite Joel Brobecker
2013-09-17 13:59 ` Yao Qi
2013-09-17 14:06 ` Joel Brobecker
2013-09-18 8:21 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1373936767-14858-1-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox