From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2889 invoked by alias); 5 Feb 2009 00:55:25 -0000 Received: (qmail 2880 invoked by uid 22791); 5 Feb 2009 00:55:23 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_15,SPF_HELO_PASS,SPF_PASS 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; Thu, 05 Feb 2009 00:55:19 +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 n150rD3W023937; Wed, 4 Feb 2009 19:53:13 -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 n150rCBr031458; Wed, 4 Feb 2009 19:53:12 -0500 Received: from opsy.redhat.com (vpn-14-42.rdu.redhat.com [10.11.14.42]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n150rBd1003865; Wed, 4 Feb 2009 19:53:11 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 865945080FB; Wed, 4 Feb 2009 17:53:09 -0700 (MST) To: Thiago Jung Bauermann Cc: Daniel Jacobowitz , gdb-patches ml Subject: Re: [RFA] Add la_getstr member to language_defn 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> From: Tom Tromey Reply-To: tromey@redhat.com Date: Thu, 05 Feb 2009 00:55:00 -0000 In-Reply-To: <1233785351.14735.56.camel@localhost.localdomain> (Thiago Jung Bauermann's message of "Wed\, 04 Feb 2009 20\:09\:11 -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: 2009-02/txt/msg00114.txt.bz2 >>>>> "Thiago" == Thiago Jung Bauermann writes: Thiago> Right. Here's the new version. It also uses c_get_string for Ada and Thiago> minimal... I read it a little more closely and I'm afraid I have a couple more comments. Mostly they are little formatting nits, nothing important. If you agree with the more substantive comments, then I think this patch is ok with the suggested changes -- no need for another review. If you don't agree, let's discuss it. Thiago> +void Thiago> +c_get_string (struct value *value, gdb_byte **buffer, int *length, Thiago> + const char **charset) Thiago> +{ Thiago> + int err, width; Thiago> + unsigned int fetchlimit; Thiago> + struct type *type = value_type (value); I think this should probably use check_typedef. Otherwise it seems like we would not extract some strings properly. E.g., consider a case like "typedef char *string;" ... what will happen? Thiago> + else if (TYPE_CODE (value_type (value)) == TYPE_CODE_PTR) This should use 'type' instead of calling value_type again. Thiago> + if (extract_unsigned_integer (contents + i*width, width) == 0) Need spaces around the "*". Thiago> + /* i is now either the number of non-null characters, or fetchlimit. */ Use "I", not "i" .. a tiny nit for the GNU style, where the value of a variable is referred to by uppercasing the name. Thiago> + *length = i*width; Spaces. Thiago> + /* If the last character is null, subtract it from length. */ Thiago> + if (extract_unsigned_integer (*buffer + *length - width, width) == 0) Thiago> + *length -= width; This second line looks like it has too much indentation. Also, I suspect this should start "if (*length > 0 &&". Otherwise, it seems like it will read memory before *BUFFER when *LENGTH==0. Thiago> +error: Emacs claims that labels are indented one space in the GNU style. I didn't see this in the standards manual though. Thiago> +++ b/gdb/value.h [...] Thiago> +extern char * type_to_string (struct type *type); Extra space after the "*". thanks for persevering, Tom