From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26422 invoked by alias); 5 Jun 2014 03:31:31 -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 26409 invoked by uid 89); 5 Jun 2014 03:31:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jun 2014 03:31:28 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WsOOh-00013S-Vl from Yao_Qi@mentor.com ; Wed, 04 Jun 2014 20:31:24 -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); Wed, 4 Jun 2014 20:31:21 -0700 Received: from qiyao.dyndns.org (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; Wed, 4 Jun 2014 20:31:21 -0700 Message-ID: <538FE412.1050806@codesourcery.com> Date: Thu, 05 Jun 2014 03:31:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Pedro Alves , Tom Tromey CC: Joel Brobecker , Subject: Re: [ping] [PATCH] Different outputs affected by locale References: <1401192650-29688-1-git-send-email-yao@codesourcery.com> <538EAEE5.2080708@codesourcery.com> <20140604124708.GR4289@adacore.com> <538F1CC3.9090605@codesourcery.com> <87oay8a0t6.fsf@fleche.redhat.com> <538F803A.9020007@redhat.com> In-Reply-To: <538F803A.9020007@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00231.txt.bz2 On 06/05/2014 04:23 AM, Pedro Alves wrote: >> > I am not really a great standards lawyer but my first reaction is that >> > mingw's C locale is not conforming. At least from: >> > >> > http://pubs.opengroup.org/onlinepubs/009604499/basedefs/xbd_chap07.html >> > >> > .. it seems to me that \242 is not defined as a 'print' character in the >> > LC_CTYPE section. Though I'd like to reiterate that I don't actually >> > trust my own reading of that text. > I wonder whether this is really a mingw issue, or whether this is a > remote host testing issue. That is, aren't we setting LC_CTYPE > on the _build_ (where expect runs), not on the host (mingw, through This is a not a mingw issue nor a remote host testing issue. If the LC_CTYPE isn't set properly on host, these tests will fail, even in the native testing. > ssh)? Is LC_CTYPE really being propagated to the host? No, setting env variables on host or target in dejagnu isn't trivial to me. > Does testing GDB manually directly on a Windows console show the same > issue? Yes, here is the output I got on Windows 7 (running gdb.exe in Windows console). However, I didn't investigate why 'ó' is printed. gdb) p repeat $1 = L"A", 'ó' , "B\000\xffff\200\000\x1370\500\xfe0c\"\x300\x 7ffe\xfe98\"\xe115\x771b\x67c9\x42c8\xfffe\xffff\x6d91\x7726\x1ae0@\xeb0:\x300\x 7ffe\xea8:\200\000Ω\000\xf480\x7594\000:\000\000\xf489\x7594\017\000\004\000Ω\00 0\xfe9c\"\x6094\x771e\xa2ac\x771f\xffff\xffff$\000\xfe98\"\004\000\000\000\x559\ xc000\xfea8\"\xf600\x7594\000\000\000\000\000\000\xfebc\"\xa442\x7594\x2a8\x759e \xfefc\"\xf4d2\x7594\b\000\x118e\x7595\x1162\x7595\x8ccb\x3e13\000\000\000\000\0 00\000\x1ae0@\xfed0\"\x8fe3\x759b\xffc4" here is the update patch to match either \242 or cent sign. -- Yao (齐尧) Subject: [PATCH] Different outputs affected by locale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We find the following fails in gdb test on mingw host. FAIL: gdb.base/wchar.exp: print repeat FAIL: gdb.base/wchar.exp: print repeat_p FAIL: gdb.base/wchar.exp: print repeat (print null on) FAIL: gdb.base/wchar.exp: print repeat (print elements 3) FAIL: gdb.base/wchar.exp: print repeat_p (print elements 3) print repeat^M $7 = L"A", '¢' , "B", '\000' ^M (gdb) FAIL: gdb.base/wchar.exp: print repeat the \242 is expected in the test but cent sign is displayed. In valprint.c:print_wchar, wchar_printable is called to determine whether a wchar is printable. wchar_printable calls iswprint but the iswprint's return value depends on LC_CTYPE setting of locale [1, 2]. The output may vary with different locale settings. I noticed that gdb.exp:gdb_init set LC_CTYPE to C. If I remove that line, tests fail on native testing too. IMO, either \242 or '¢' (cent sign) is a correct output, which is affect by locale, and it is not related to gdb at all. [1] http://pubs.opengroup.org/onlinepubs/009604499/functions/iswprint.html [2] http://msdn.microsoft.com/en-us/library/ewx8s4kw.aspx This patch is extend $cent for cent sign to match in the tests. gdb/testsuite: 2014-06-05 Yao Qi * gdb.base/wchar.exp: Extend $cent to match cent sign. --- gdb/testsuite/gdb.base/wchar.exp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/wchar.exp b/gdb/testsuite/gdb.base/wchar.exp index 4290478..aa19d92 100644 --- a/gdb/testsuite/gdb.base/wchar.exp +++ b/gdb/testsuite/gdb.base/wchar.exp @@ -36,7 +36,10 @@ gdb_test "print simple\[2\]" "= 99 L'c'" gdb_test "print difficile\[2\]" "= 65261 L'\\\\xfeed'" -set cent "\\\\242" +# The contents in 'repeat' are shown differently under different +# locale. We match all the possible outputs here, '\242' or cent sign. +set cent "(\\\\242|\u00A2)" + gdb_test "print repeat" "= L\"A\", '$cent' , \"B.*" global hex -- 1.9.0