From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25089 invoked by alias); 5 Feb 2009 16:01:48 -0000 Received: (qmail 24965 invoked by uid 22791); 5 Feb 2009 16:01:47 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Feb 2009 16:01:39 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id n15G1VaE050658 ; Thu, 5 Feb 2009 17:01:31 +0100 (CET) Received: from mailserver.u-strasbg.fr (ms4.u-strasbg.fr [IPv6:2001:660:2402:d::13]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n15G1UgB092498 ; Thu, 5 Feb 2009 17:01:30 +0100 (CET) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (www-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n15G1UTm096875 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Thu, 5 Feb 2009 17:01:30 +0100 (CET) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: "'Thiago Jung Bauermann'" Cc: "'gdb-patches ml'" References: <1227417278.28256.183.camel@localhost.localdomain> <20081123161013.GA15069@caradoc.them.org> <1227490821.8533.25.camel@hotblack.bauerhaus> <20081124022858.GA19331@caradoc.them.org> <1227551659.28256.225.camel@localhost.localdomain> <20081124202146.GA1991@caradoc.them.org> <1227564549.28256.248.camel@localhost.localdomain> <1230949603.8380.143.camel@localhost.localdomain> <1233665501.14735.7.camel@localhost.localdomain> <1233751023.14735.40.camel@localhost.localdomain> <1233785351.14735.56.camel@localhost.localdomain> <1233836456.14735.69.camel@localhost.localdomain> In-Reply-To: <1233836456.14735.69.camel@localhost.localdomain> Subject: RE: [RFA] Add la_getstr member to language_defn Date: Thu, 05 Feb 2009 16:01:00 -0000 Message-ID: <000001c987ab$048df7a0$0da9e6e0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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-02/txt/msg00123.txt.bz2 Hi Thiago, I just wrote a pascal version of your c_get_string, which basically calls c_get_string but also handles Pascal string types specifically. The problem is that I found no reference to this la_get_string in the code yet, so that I am unable to really check if my patch is correct. Is this in some submitted patch for python or isn't it ready for submission yet? Could you please send me a pointer to that patch? Pierre Muller Pascal language support maintainer for GDB This is the function I wrote: static void pascal_get_string (struct value *value, gdb_byte **buffer, int *length, const char **charset) { int err, width; unsigned int fetchlimit; struct type *type = check_typedef (value_type (value)); struct type *element_type; int length_pos, length_size, string_pos; if (is_pascal_string_type (type, &length_pos, &length_size, &string_pos, &width, NULL)) { CORE_ADDR addr = value_as_address (value); ULONGEST string_length; *buffer = xmalloc (length_size); if (target_read_memory (addr + length_pos, *buffer, length_size) == length_size) { string_length = extract_unsigned_integer (*buffer, length_size); xfree (*buffer); *buffer = xmalloc (length_size * width); fetchlimit = string_length; err = read_string (addr + string_pos, string_length, width, fetchlimit, buffer, length); *charset = target_charset (); } else err = 1; if (err) { xfree (*buffer); error (_("Error reading pascal string from inferior: %s"), safe_strerror (err)); } return; } else c_get_string (value, buffer, length, charset); }