From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11953 invoked by alias); 15 Oct 2012 19:46:25 -0000 Received: (qmail 11944 invoked by uid 22791); 15 Oct 2012 19:46:25 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RCVD_IN_NIX_SPAM,SPF_SOFTFAIL,TW_SW X-Spam-Check-By: sourceware.org Received: from mtaout20.012.net.il (HELO mtaout20.012.net.il) (80.179.55.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Oct 2012 19:46:19 +0000 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MBY004009K61H00@a-mtaout20.012.net.il> for gdb-patches@sourceware.org; Mon, 15 Oct 2012 21:46:17 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MBY002269L56CX0@a-mtaout20.012.net.il>; Mon, 15 Oct 2012 21:46:17 +0200 (IST) Date: Mon, 15 Oct 2012 19:46:00 -0000 From: Eli Zaretskii Subject: Re: printing 0xbeef wchar_t on x86-windows... In-reply-to: <20121015190052.GH3034@adacore.com> To: Joel Brobecker Cc: gdb-patches@sourceware.org, tromey@redhat.com Reply-to: Eli Zaretskii Message-id: <83hapv4iy4.fsf@gnu.org> References: <20121015190052.GH3034@adacore.com> X-IsSubscribed: yes 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 X-SW-Source: 2012-10/txt/msg00239.txt.bz2 > Date: Mon, 15 Oct 2012 12:00:52 -0700 > From: Joel Brobecker > Cc: Tom Tromey > > wchar_t single = 0xbeef; > > But with the current HEAD, I get: > > (gdb) print single > $5 = 48879 L'\357' > > In chronological order: > > * valprint.c:generic_emit_char calls wchar_iterate, and finds > one valid character according to the intermediate encoding > ("wchar_t"), even though the character isn't valid in the > original/target charset ("CP1252"). How would cp1252 enter the picture, when you are talking about a wchar_t data type? > But unfortunately for us, Window's iswprint likes 0xbeef as > printable This happens to be a Unicode codepoint of a Hangul word-constituent character. That's what you get for putting random values into wchar_t data type ;-) > But the problem is that convert_between_encodings was called > with the width set to 1, instead of using the character type's > size. > > With the attached patch, we now get the following output... > > (gdb) print single > $2 = 48879 L'\357\276' > > ... which is no longer missing half of the wide character value. I guess that's the right output, so long as your output charset does not support that Hangul character.