From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22972 invoked by alias); 4 Jun 2014 05:32:21 -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 22958 invoked by uid 89); 4 Jun 2014 05:32:20 -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; Wed, 04 Jun 2014 05:32:19 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Ws3o6-0004ie-Vx from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 03 Jun 2014 22:32:15 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 3 Jun 2014 22:32:14 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Tue, 3 Jun 2014 22:32:13 -0700 Message-ID: <538EAEE5.2080708@codesourcery.com> Date: Wed, 04 Jun 2014 05:32: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: Subject: [ping] [PATCH] Different outputs affected by locale References: <1401192650-29688-1-git-send-email-yao@codesourcery.com> In-Reply-To: <1401192650-29688-1-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00107.txt.bz2 On 05/27/2014 08:10 PM, Yao Qi wrote: > 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] msdn.microsoft.com/en-us/library/ewx8s4kw.aspx > > This patch is to add code to 'p repeat[1]' to extract the cent first, > and then use it to match in the following tests. > > gdb/testsuite: > > 2014-05-27 Yao Qi > > * gdb.base/wchar.exp: Execute command 'p repeat[1]' and extract > cent from the output. Ping. -- Yao (齐尧)