From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8842 invoked by alias); 4 Feb 2010 17:21:53 -0000 Received: (qmail 8832 invoked by uid 22791); 4 Feb 2010 17:21:52 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Feb 2010 17:21:48 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o14HLkhA025725 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 4 Feb 2010 12:21:46 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o14HLjdq029047; Thu, 4 Feb 2010 12:21:46 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o14HLi5s032046; Thu, 4 Feb 2010 12:21:45 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id A6D3337996D; Thu, 4 Feb 2010 10:21:44 -0700 (MST) From: Tom Tromey To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA 2/4] dwarf2_physname References: <20091217202843.GA11961@caradoc.them.org> <20091222192444.GB15339@caradoc.them.org> <4B576983.2090808@redhat.com> <20100126211733.GA17877@caradoc.them.org> <4B609019.1090807@redhat.com> <4B61F20B.7070908@redhat.com> <20100128202429.GA29835@caradoc.them.org> <4B622047.7020503@redhat.com> <20100201164837.GF21339@caradoc.them.org> Reply-To: tromey@redhat.com Date: Thu, 04 Feb 2010 17:21:00 -0000 In-Reply-To: <20100201164837.GF21339@caradoc.them.org> (Daniel Jacobowitz's message of "Mon, 1 Feb 2010 11:48:37 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (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: 2010-02/txt/msg00121.txt.bz2 >>>>> "Daniel" == Daniel Jacobowitz writes: >> +die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) >> { [...] >> + case DW_TAG_variable: >> + { >> + struct attribute *attr; >> + attr = dwarf2_attr (die, DW_AT_specification, cu); >> + if (attr) >> + return 1; >> + attr = dwarf2_attr (die, DW_AT_external, cu); >> + if (attr == NULL && die->parent->tag != DW_TAG_namespace) >> + return 0; >> + return 1; Daniel> What's this about? It needs an explanation, and I don't think Daniel> DW_AT_specification has anything to do with die_needs_namespace. I read through this sub-thread a little, and looked at the DWARF spec too. Here is what I believe to be the relevant text from the spec: If a type, variable, or function declared in a namespace is defined outside of the body of the namespace declaration, that type, variable, or function definition entry has a DW_AT_specification attribute whose value is a reference to the debugging information entry representing the declaration of the type, variable or function. Type, variable, or function entries with a DW_AT_specification attribute do not need to duplicate information provided by the declaration entry referenced by the specification attribute. So, if a DIE has a DW_AT_specification, then we must use the namespace indicated by the referenced DIE. If it does not have DW_AT_specification, then we use its own parentage. It is not clear to me whether it is possible for a DIE to have a DW_AT_specification referring to another DIE which is not in a namespace. Offhand this seems invalid, but if it does occur, it could be supported in this function with just a little more effort. I don't understand why die_needs_namespace only does this for DW_TAG_variable and not other things. I also don't understand why it unconditionally returns 1 for enumerators, functions, and the like. However, I didn't look to see how it is used, so perhaps it doesn't matter. After reading more of the thread, maybe I am missing the point. Tom