From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24947 invoked by alias); 25 Mar 2009 22:26:15 -0000 Received: (qmail 24936 invoked by uid 22791); 25 Mar 2009 22:26:14 -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; Wed, 25 Mar 2009 22:26:09 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1249B2BAC1E for ; Wed, 25 Mar 2009 18:26:08 -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 7k-9tiwamwWU for ; Wed, 25 Mar 2009 18:26:08 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id D41532BAC16 for ; Wed, 25 Mar 2009 18:26:07 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id F244C5BD21; Wed, 25 Mar 2009 15:26:00 -0700 (PDT) Date: Wed, 25 Mar 2009 22:26:00 -0000 From: Joel Brobecker To: gdb@sourceware.org Subject: about PR gdb/10002 (extern optimized out symbols print: Address of symbol is unknown) Message-ID: <20090325222600.GI1583@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-03/txt/msg00159.txt.bz2 Here is the testcase that Jan provided: extern int missing; int main (void) { return 0 && missing; } This file is to be built using the following command: % gcc -o kfail kfail.c -Wall -g The debugger currently says that variable "missing" is unknown: % gdb kfail GNU gdb (GDB) 6.8.50.20090324-cvs (gdb) p missing Address of symbol "missing" is unknown. The debugging information inside kfail.c says: <1><55>: Abbrev Number: 4 (DW_TAG_variable) <56> DW_AT_name : (indirect string, offset: 0x66): missing <5c> DW_AT_type : <0x4e> <60> DW_AT_external : 1 <61> DW_AT_declaration : 1 This seems correct to me. However, the testcase itself is a little borderline in my opinion. The variable was not "optimized out", but was never linked in. It's as if it really does not exist. So I don't know if GDB is really all that incorrect, here. Thoughts? Maybe there is a testcase a little more involved that shows the same sort of issue? -- Joel