From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24159 invoked by alias); 5 Feb 2010 20:57:12 -0000 Received: (qmail 24151 invoked by uid 22791); 5 Feb 2010 20:57:11 -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; Fri, 05 Feb 2010 20:57:08 +0000 Received: (qmail 7067 invoked from network); 5 Feb 2010 20:57:06 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 Feb 2010 20:57:06 -0000 Date: Fri, 05 Feb 2010 20:57:00 -0000 From: Daniel Jacobowitz To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA 2/4] dwarf2_physname Message-ID: <20100205205617.GA30325@caradoc.them.org> Mail-Followup-To: Keith Seitz , gdb-patches@sourceware.org References: <20100201193941.GA17445@caradoc.them.org> <4B674D1B.5040209@redhat.com> <20100201221905.GA15584@caradoc.them.org> <4B68B400.3030407@redhat.com> <20100203024553.GA22235@caradoc.them.org> <20100204181358.GA27544@caradoc.them.org> <4B6C51BC.6040601@redhat.com> <20100205172352.GA16328@caradoc.them.org> <4B6C7E54.8080203@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B6C7E54.8080203@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/msg00175.txt.bz2 On Fri, Feb 05, 2010 at 12:23:48PM -0800, Keith Seitz wrote: > It might be a gcc-ism, but we actually get a DW_TAG_lexical_block > between DW_TAG_subprogram and DW_TAG_variable. I presume this is to > mark the prologue. It is a very nice way to know that a variable is > not global. O:-) It's a GCC-ism :-) > After revisiting that, I think it clearer to understand if I invert > the original test: > > case DW_TAG_variable: > { > struct attribute *attr; > > /* We only need to prefix "globally" visible variables. These include > any variable marked with DW_AT_external or any variable that > lives in a namespace. [Variables in anonymous namespaces > require prefixing, but they are not DW_AT_external.] */ > > if (dwarf2_attr (die, DW_AT_specification, cu)) > { > struct dwarf2_cu *spec_cu = cu; > return die_needs_namespace (die_specification (die, &spec_cu), > spec_cu); > } On this part we are in complete agreement. > attr = dwarf2_attr (die, DW_AT_external, cu); > if (attr || die->parent->tag == DW_TAG_namespace) > return 1; > > return 0; > } > > How does that look? I'm not sure, but I think it's close enough for now. (Things I'm wondering about that we can sort out later: namespace X { int f() { extern int y; } }, does y go in a namespace? What namespace? It certainly doesn't go in X::f()::y but I don't know what GCC emits. namespace X { class Y { static int x; } }, is that DW_AT_extern?) -- Daniel Jacobowitz CodeSourcery