From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2566 invoked by alias); 16 Jul 2013 01:07:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 2536 invoked by uid 89); 16 Jul 2013 01:07:08 -0000 X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_50,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,TW_SF autolearn=no version=3.3.1 Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 16 Jul 2013 01:07:07 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UytjH-00018J-B2 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Mon, 15 Jul 2013 18:06:59 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 15 Jul 2013 18:06:58 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Mon, 15 Jul 2013 18:06:57 -0700 From: Yao Qi To: Subject: [PATCH] native mingw32 gdb, eol format Date: Tue, 16 Jul 2013 01:07:00 -0000 Message-ID: <1373936767-14858-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-07/txt/msg00358.txt.bz2 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 Yao Qi * 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