From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29567 invoked by alias); 24 Nov 2008 16:45:18 -0000 Received: (qmail 29546 invoked by uid 22791); 24 Nov 2008 16:45:17 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Nov 2008 16:44:31 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mAOGiHE7030260; Mon, 24 Nov 2008 11:44:17 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mAOGiGF8006043; Mon, 24 Nov 2008 11:44:16 -0500 Received: from opsy.redhat.com (vpn-12-223.rdu.redhat.com [10.11.12.223]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mAOGiFoR001062; Mon, 24 Nov 2008 11:44:16 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 409BF378788; Mon, 24 Nov 2008 09:44:15 -0700 (MST) To: Thiago Jung Bauermann Cc: gdb-patches ml Subject: Re: [RFA] Add la_getstr member to language_defn References: <1227417278.28256.183.camel@localhost.localdomain> From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom Date: Mon, 24 Nov 2008 20:03:00 -0000 In-Reply-To: <1227417278.28256.183.camel@localhost.localdomain> (Thiago Jung Bauermann's message of "Sun\, 23 Nov 2008 03\:14\:37 -0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2008-11/txt/msg00647.txt.bz2 >>>>> "Thiago" == Thiago Jung Bauermann writes: Thiago> Each language supported by GDB can provide a way to read Thiago> strings from a value by suppling its version of the Thiago> function. I implemented it for C, in c_getstr. Thanks. For those not tracking the Python branch, this functionality is important to many scripts. Thiago> * language.h (language_dfn): Add la_getstr member. Thiago> (LA_GET_STRING): New macro. A nit: the macro is called LA_GET_STRING, but the field is la_getstr. How about la_get_string for the field instead? Thiago> + int (*la_getstr) (struct value *value, gdb_byte **buffer, int *length); I was thinking about writing this function for Java, sort of as a proof of the API. One oddity here is that a String there has a fixed encoding, which may or may not be the same as the target charset (and in any case, is not convertible using the charset.c code). One idea for fixing this is to let this new method optionally return an encoding. That way a language implementation could fill in this info if it is known. The C implementation would simply do nothing here. What do you think? Tom