From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19113 invoked by alias); 3 Feb 2010 02:46:05 -0000 Received: (qmail 19104 invoked by uid 22791); 3 Feb 2010 02:46:04 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Feb 2010 02:45:59 +0000 Received: (qmail 4858 invoked from network); 3 Feb 2010 02:45:57 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 3 Feb 2010 02:45:57 -0000 Date: Wed, 03 Feb 2010 02:46:00 -0000 From: Daniel Jacobowitz To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA 2/4] dwarf2_physname Message-ID: <20100203024553.GA22235@caradoc.them.org> Mail-Followup-To: Keith Seitz , gdb-patches@sourceware.org References: <4B609019.1090807@redhat.com> <4B61F20B.7070908@redhat.com> <20100128202429.GA29835@caradoc.them.org> <4B622047.7020503@redhat.com> <20100201164837.GF21339@caradoc.them.org> <4B672C38.60007@redhat.com> <20100201193941.GA17445@caradoc.them.org> <4B674D1B.5040209@redhat.com> <20100201221905.GA15584@caradoc.them.org> <4B68B400.3030407@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B68B400.3030407@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-02/txt/msg00052.txt.bz2 On Tue, Feb 02, 2010 at 03:23:44PM -0800, Keith Seitz wrote: > To elaborate on #2: > > Consider the following class: > > class A > { > public: > static const int a_constant = 3; > }; > > int > main (int argc, char* argv[]) > { > return A::a_constant; > } > > Gcc will *NOT* output anything about A::a_constant *except* for a > DW_TAG_variable describing it (DW_AT_name = "a_constant"). No > DW_AT_specification (as I think there should be). In fact, > DW_TAG_class_type for A is completely omitted. The only clue that gdb > gets (either dwarf2_physname or CVS HEAD) is in > DW_AT_MIPS_linkage_name. This is obviously a gcc bug. It's not obvious that it's a bug. I believe you need to declare the constant again, outside of the class, for it to be really 'defined'. This trips people up all the time. (Including me, so don't trust me too much.) e.g. it won't have the correct external linkage it's supposed to have. > Or maybe I'm simply not answering your question? [A kind of > forest/tree thing...] You're right, we're talking past each other. I don't doubt that what you've got is correctly identifying and handling GCC's output. But it does so by pattern matching on what GCC currently emits, not by using tests that are sound according to the standard. So with some future GCC, or some other non-GCC compiler, it will probably fall down. I don't believe that most of GCC's uses of DW_AT_specification are required by the standard. And I don't think they're the only valid uses of DW_AT_specification. So keying off whether that attribute is present is too 'fuzzy' for me. I'm asking for you to either convince me that my assumptions in the previous paragraph are incorrect, or to find some way that the standard will support to answer the same query about the properties of the DW_TAG_variable DIE. For instance, should we find the DIE's logical location the same way determine_prefix does (parent, or specification's parent) and then draw some conclusion based on the type of the logical parent? -- Daniel Jacobowitz CodeSourcery