From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26026 invoked by alias); 2 Apr 2009 18:54:28 -0000 Received: (qmail 26016 invoked by uid 22791); 2 Apr 2009 18:54:27 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Apr 2009 18:54:20 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A81FC2C489C; Thu, 2 Apr 2009 14:54:18 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MJeVfbrVNHnd; Thu, 2 Apr 2009 14:54:18 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 74BA22C48A6; Thu, 2 Apr 2009 14:54:18 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id F1163F5A6F; Thu, 2 Apr 2009 11:54:13 -0700 (PDT) Date: Thu, 02 Apr 2009 18:54:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] Fix C `extern' shadowing in a local block Message-ID: <20090402185413.GC9017@adacore.com> References: <20090326212128.GA32657@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090326212128.GA32657@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-04/txt/msg00040.txt.bz2 Hi Jan, > 2009-03-26 Jan Kratochvil > > * dwarf2read.c > (new_symbol ): > Create the symbol in local scope. This part makes me uncomfortable. I am afraid that doing so would be misinterpreting the meaning of DW_AT_external. Also, I would mean that we are treating this attribute differently depending on whether we have a location attribute or not. This may be the correct thing to do, but I want to make sure that the debugging information generated in this case is correct. We have to consider for instance the following example: extern int toto; int main (void) { toto++; return 0; } The debugging information generated for our extern looks like this: .uleb128 0x4 # (DIE (0x55) DW_TAG_variable) .long .LASF4 # DW_AT_name: "toto" .byte 0x1 # DW_AT_decl_file (foo.c) .byte 0x1 # DW_AT_decl_line .long 0x4e # DW_AT_type .byte 0x1 # DW_AT_external .byte 0x1 # DW_AT_declaration .byte 0x0 # end of children of DIE 0xb The description for the global variable looks completely identical to your example where the variable is bound to a local scope. Now, in practice, I think that things would work in both cases. In my example, with your patch, the variable would be inserted at the file_symbols level instead of inside the local scope associated to your block. I would like to have Daniel's opinion on this. I'll see if he's on IRC. -- Joel