From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6728 invoked by alias); 9 Jun 2014 08:37:20 -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 6716 invoked by uid 89); 9 Jun 2014 08:37:19 -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; Mon, 09 Jun 2014 08:37:18 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Wtv4s-0005cT-6I from Yao_Qi@mentor.com ; Mon, 09 Jun 2014 01:37:14 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 9 Jun 2014 01:37:14 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Mon, 9 Jun 2014 01:37:13 -0700 Message-ID: <539571C6.40605@codesourcery.com> Date: Mon, 09 Jun 2014 08:37: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 CC: Tom Tromey , 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> <538FE412.1050806@codesourcery.com> <53903119.6000204@redhat.com> <53903EE5.8090107@codesourcery.com> <539042A2.4050409@redhat.com> In-Reply-To: <539042A2.4050409@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00357.txt.bz2 On 06/05/2014 06:12 PM, Pedro Alves wrote: > On 06/05/2014 10:56 AM, Yao Qi wrote: >> On 06/05/2014 04:58 PM, Pedro Alves wrote: > >>>>>>> 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. >>> But was that with LC_CTYPE set to C? >> >> I don't know how check LC_CTYPE on Windows. :( > > Try "set", and "set /?". > LC_CTYPE isn't set on the Windows machine I am using. set LC_CTYPE=C, but the output is unchanged. I dive into locale stuff, and find something more, in main.c:captured_main, gdb does #if defined (HAVE_SETLOCALE) setlocale (LC_CTYPE, ""); #endif the man page of setlocale says If locale is "", each part of the locale that should be modified is set according to the environment variables. That is why we can pass env var to change gdb's locale. However, looks setlocale on Windows behaves differently when locale is "". The msdn about setlocale says "If locale points to an empty string, the locale is the implementation-defined native environment.", but it doesn't say much on the "implementation-defined native environment". The following example in the same page gives me some hints, setlocale( LC_ALL, "" ); Sets the locale to the default, which is the user-default ANSI code page obtained from the operating system. As far as I can see, windows doesn't consider any env var with setlocale(FOO, ""). If I am correct, we can't set gdb's locale by means of setting env var, instead, we have to match all the possibilities in the testcase. WDYT? -- Yao (齐尧)