From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10312 invoked by alias); 16 Oct 2012 22:43:57 -0000 Received: (qmail 10229 invoked by uid 22791); 16 Oct 2012 22:43:54 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Oct 2012 22:43:49 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 40B0A1C7CF4; Tue, 16 Oct 2012 18:43:49 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id klqs9FCO3jiG; Tue, 16 Oct 2012 18:43:49 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 0E6921C7CE3; Tue, 16 Oct 2012 18:43:48 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 87B3DC4B79; Tue, 16 Oct 2012 15:43:42 -0700 (PDT) Date: Tue, 16 Oct 2012 22:43:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: printing 0xbeef wchar_t on x86-windows... Message-ID: <20121016224342.GH3050@adacore.com> References: <20121015190052.GH3034@adacore.com> <87wqyq6tcl.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wqyq6tcl.fsf@fleche.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00263.txt.bz2 Thanks for the review, Tom. > generic_emit_char should be assuming that the character is in the target > wide charset, not in the target charset. That is, "show > target-wide-charset". > If the 'encoding' argument to generic_emit_char is "CP1252" then I think > something went wrong earlier. I will double-check what is exactly going on. I only very recently discovered the target-wide-charset setting (and will post a patch for AIX soon), so I probably still only have a partial picture. > Joel> * Before actually printing the buffer, generic_emit_char converts > Joel> the string from the intermediate encoding into the host encoding, > Joel> which is "CP1252". The converstion routine now finds that, > Joel> although the multi-bypte sequence is printable, it isn't valid > Joel> in the target encoding (iconv returns EILSEQ), and thus > > Must be the host encoding here, not the target encoding? Yes - poor (overloaded) choice of terms in this case. I shoud probably have used "destination"... > And, this call to convert_between_encodings is converting from the > intermediate charset to the host charset. So, I think this should be > sizeof (gdb_wchar_t). I keep getting confused over these... > Before putting something like that in, though, I would like to look at > Keith's pending patch that reworks this code. Maybe he already fixed > the bug. OK. I couldn't find the patch in question, so I couldn't test it. > Also, I think this should have a regression test. We actually already have one (see wchar.exp). -- Joel