From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30533 invoked by alias); 16 Apr 2004 14:20:29 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30494 invoked from network); 16 Apr 2004 14:20:27 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 16 Apr 2004 14:20:27 -0000 Received: from drow by nevyn.them.org with local (Exim 4.31 #1 (Debian)) id 1BEUCc-0002wC-Lb; Fri, 16 Apr 2004 10:20:22 -0400 Date: Fri, 16 Apr 2004 14:20:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] New dwarf2_attribute_true_p function in dwarf2read.c Message-ID: <20040416142022.GC9718@nevyn.them.org> Mail-Followup-To: Joel Brobecker , gdb-patches@sources.redhat.com References: <20040415202318.GD1564@gnat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040415202318.GD1564@gnat.com> User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-04/txt/msg00352.txt.bz2 On Thu, Apr 15, 2004 at 01:23:18PM -0700, Joel Brobecker wrote: > Hello, > > Following a suggestion made by JimB in: > > http://sources.redhat.com/ml/gdb-patches/2004-04/msg00297.html > > I made the following change: > > 2004-04-15 Joel Brobecker > > * dwarf2read.c (dwarf2_attribute_true_p): New function. > (die_is_declaration): Use the function above. > > Tested on x86-linux, no regression. > > OK to apply? Sorry, this patch is incorrect. > - return (dwarf2_attr (die, DW_AT_declaration, cu) > - && ! dwarf2_attr (die, DW_AT_specification, cu)); > + /* A DIE is a declaration if it has a DW_AT_declaration attribute > + which value is non-zero. However, we have to be careful of DIEs > + with a DW_AT_specification attribute, because dwarf2_attribute_p() > + follows this attribute, and therefore might cause us to find a > + DW_AT_declaration attribute, but that belongs to a different DIE. */ > + return (dwarf2_attribute_true_p (die, DW_AT_declaration, cu) > + && ! dwarf2_attribute_true_p (die, DW_AT_specification, cu)); > } > > /* Return the die giving the specification for DIE, if there is First of all, there's no dwarf2_attribute_p, you mean dwarf2_attr and dwarf2_attr_true_p. Secondly, the predicate function should be used for flag attributes like DW_AT_declaration, but checking DW_UNSND for DW_AT_specification is incorrect - it's a DIE reference. dwarf2_attr != NULL is the right check. Some day I hope to add checking macros to verify we're using the right member of each union... -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer