From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30230 invoked by alias); 25 Apr 2009 00:37:10 -0000 Received: (qmail 30154 invoked by uid 22791); 25 Apr 2009 00:37:10 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 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; Sat, 25 Apr 2009 00:37:05 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 5D7202BAC6A for ; Fri, 24 Apr 2009 20:37:03 -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 XPTJ5ouTFQm2 for ; Fri, 24 Apr 2009 20:37:03 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 2512D2BAC5D for ; Fri, 24 Apr 2009 20:37:03 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id BBCC5F5924; Fri, 24 Apr 2009 17:36:58 -0700 (PDT) Date: Sat, 25 Apr 2009 00:37:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA] Fix typo in type of parameter "w" in print_wchar... Message-ID: <20090425003658.GA32745@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="YiEDa0DAkWCtVeE4" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-04/txt/msg00701.txt.bz2 --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1039 I think this is the last issue I've found so far with character set conversions and printing... This one occurs on AIX while trying to print a simple ascii string. The output looks like this: (gdb) p __gnat_version $3 = " The problem turned out to be pretty straightforward, once I got to understand how things are supposed to work. Basically, for every character in our string, we call print_wchar to push the equivalent wchar on our itermediate wchar buffer. The issue is that we had the wrong type for the wchar (gdb_wint_t instead of gdb_wchar_t). gdb_wint_t is 4bytes long whereas gdb_wchar_t is 2 bytes long. So when we do the pushing: obstack_grow (output, &w, sizeof (gdb_wchar_t)); We only push 2 bytes of the 4 bytes that w got accidently promoted to. On ppc-aix, it's big endian, so we end up always pushing zeros... 2009-04-24 Joel Brobecker * c-lang.c (print_wchar): Use the correct type for parameter "w". I'm currently testing the patch on x86_64-linux... -- Joel --YiEDa0DAkWCtVeE4 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="c-lang.diff" Content-length: 453 diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 027e9b2..5fe04de 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -156,7 +156,7 @@ append_string_as_wide (const char *string, struct obstack *output) escapes across calls. */ static void -print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len, +print_wchar (gdb_wchar_t w, const gdb_byte *orig, int orig_len, int width, struct obstack *output, int quoter, int *need_escapep) { --YiEDa0DAkWCtVeE4--