From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3033 invoked by alias); 13 Mar 2010 02:36:43 -0000 Received: (qmail 3016 invoked by uid 22791); 13 Mar 2010 02:36:42 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 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; Sat, 13 Mar 2010 02:36:38 +0000 Received: (qmail 4270 invoked from network); 13 Mar 2010 02:36:36 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 13 Mar 2010 02:36:36 -0000 Date: Sat, 13 Mar 2010 02:36:00 -0000 From: Daniel Jacobowitz To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: FYI: fix PR 9708 Message-ID: <20100313023630.GA29285@caradoc.them.org> Mail-Followup-To: Tom Tromey , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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-03/txt/msg00483.txt.bz2 On Fri, Mar 12, 2010 at 05:25:05PM -0700, Tom Tromey wrote: > + attr = dwarf2_attr (die, DW_AT_external, cu); > + if (attr == NULL && die->parent->tag != DW_TAG_namespace) > + return 0; > + /* A variable in a lexical block of some kind does not need a > + namespace, even though in C++ such variables may be external > + and have a mangled name. */ > + if (die->parent->tag == DW_TAG_lexical_block > + || die->parent->tag == DW_TAG_try_block > + || die->parent->tag == DW_TAG_catch_block) > + return 0; > + return 1; Why is this: int f() { static int x; ... } Different from this: int f() { if (foo) { static int x; ... } } Now one of those is going to get a namespace and the other isn't. I'd have thought we would call them both f()::x - although clearly that's not sufficient to uniquely identify them. Should they both be ! die_needs_namespace? > + > + long method () > + { > + static bool svar = true; > + return key2; > + } Looking at your test case, I guess the answer is that you're relying on GCC's extra DW_TAG_lexical_block emitted for all C++ functions; this is not a DWARF requirement and other compilers omit it. I'm sure I originally fixed some bug by giving these things the physname of 'x'... but probably, whatever it was is also fixed by your change to use list_in_scope. -- Daniel Jacobowitz CodeSourcery