From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19204 invoked by alias); 8 Mar 2010 19:41:13 -0000 Received: (qmail 19188 invoked by uid 22791); 8 Mar 2010 19:41:12 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Mar 2010 19:41:05 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o28Jf2LT031090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 8 Mar 2010 14:41:02 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o28Jf1AH014858; Mon, 8 Mar 2010 14:41:02 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o28Jf058003214; Mon, 8 Mar 2010 14:41:01 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 47DB13782A7; Mon, 8 Mar 2010 12:41:00 -0700 (MST) From: Tom Tromey To: Anton Kunze Cc: gdb@sourceware.org Subject: Re: Printing of strings with special characters References: <4B8F9FE9.2040401@technosis.de> <4B90C17B.8020001@technosis.de> <4B94BC31.3020109@technosis.de> Reply-To: Tom Tromey Date: Mon, 08 Mar 2010 19:41:00 -0000 In-Reply-To: <4B94BC31.3020109@technosis.de> (Anton Kunze's message of "Mon, 08 Mar 2010 09:58:25 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00049.txt.bz2 >>>>> "Anton" == Anton Kunze writes: Anton> http://websvn.kde.org/trunk/extragear/sdk/kdevelop/debuggers/gdb/printers/ Also, the QStringPrinter code seems suspect to me: class QStringPrinter: def __init__(self, val): self.val = val def to_string(self): ret = "" i = 0 while i < self.val['d']['size']: if self.val['d']['data'][i] > 256: #TODO: fix this properly ret += '?' else: ret += chr(self.val['d']['data'][i]) i = i + 1 return ret This is constructing a string by hand, and using '?' to replace some characters. It is better to use Value.string or Value.lazy_string. From the qstring.h in code search, I gather that this is UTF-16-encoded, so this should probably read: return self.val['d']['data'].string(encoding = 'UTF-16', length = self.val['d']['size']) ... though I have never really used Qt, so take with a grain of salt. Use lazy_string if you have a newer gdb. Tom