From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26464 invoked by alias); 18 Feb 2014 16:03:33 -0000 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 Received: (qmail 26455 invoked by uid 89); 18 Feb 2014 16:03:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Feb 2014 16:03:02 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1IG2q6P021463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Feb 2014 11:02:56 -0500 Received: from [10.36.116.65] (ovpn-116-65.ams2.redhat.com [10.36.116.65]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1IG2oti028232; Tue, 18 Feb 2014 11:02:51 -0500 Subject: Re: [RFA/DWARF] constant class of DW_AT_high_pc is offset for version >=4 only. From: Mark Wielaard To: Joel Brobecker Cc: gdb-patches@sourceware.org In-Reply-To: <20140218133000.GA15835@adacore.com> References: <1392478818-30320-1-git-send-email-brobecker@adacore.com> <20140218133000.GA15835@adacore.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 18 Feb 2014 16:03:00 -0000 Message-ID: <1392739369.21975.145.camel@bordewijk.wildebeest.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-02/txt/msg00568.txt.bz2 On Tue, 2014-02-18 at 14:30 +0100, Joel Brobecker wrote: > 1. The introduction of attr_value_as_address, to be used > in place of DW_ADDR when dealing with address attributes. > I left a few uses of this macro in the situations where > we actually know that the form is an address form. This accepts any form as address/unsigned. I would at least check that it is either DW_FORM_data4 or DW_FORM_data8 (even better would be to check the CU address width too, although that would require to pass around cu too, which might not be practical). Also I would add a comment that this is really to work around buggy producers. > 2. Instead of duplicating everywhere the conditions for > non-address forms in the handling of DW_AT_high_pc > attributes, I used the attr_form_is_constant function > instead. It's not stricly the same, but I think it is > closer to the DWARF reference. It is closer when used like you do, combined with a check for cu->header.version >= 4. > @@ -4201,7 +4217,7 @@ dwarf2_find_base_address (struct die_info *die, struct dwarf2_cu *cu) > attr = dwarf2_attr (die, DW_AT_entry_pc, cu); > if (attr) > { > - cu->base_address = DW_ADDR (attr); > + cu->base_address = attr_value_as_address (attr); > cu->base_known = 1; > } Note that this might break for DWARF5. See http://dwarfstd.org/ShowIssue.php?issue=120719.1 In general I would only use attr_value_as_address for attributes (low_pc and high_pc) which you know a buggy producer might encode with DW_FORM_data[48]. Cheers, Mark.