From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4384 invoked by alias); 2 Sep 2005 13:28:25 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 4227 invoked by uid 22791); 2 Sep 2005 13:27:56 -0000 Received: from zigzag.lvk.cs.msu.su (HELO zigzag.lvk.cs.msu.su) (158.250.17.23) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 02 Sep 2005 13:27:56 +0000 Received: from Debian-exim by zigzag.lvk.cs.msu.su with spam-scanned (Exim 4.50) id 1EBBaC-0005Va-KW for gdb@sources.redhat.com; Fri, 02 Sep 2005 17:27:53 +0400 Received: from zigzag.lvk.cs.msu.su ([158.250.17.23]) by zigzag.lvk.cs.msu.su with esmtp (Exim 4.50) id 1EBBa9-0005VK-Sy; Fri, 02 Sep 2005 17:27:49 +0400 From: Vladimir Prus To: Daniel Jacobowitz Subject: Re: "info locals" -- is variable initialized Date: Fri, 02 Sep 2005 13:28:00 -0000 User-Agent: KMail/1.7.2 Cc: gdb@sources.redhat.com References: <200509021718.47151.ghost@cs.msu.su> <20050902132045.GA13068@nevyn.them.org> In-Reply-To: <20050902132045.GA13068@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200509021727.49281.ghost@cs.msu.su> X-SW-Source: 2005-09/txt/msg00017.txt.bz2 On Friday 02 September 2005 17:20, Daniel Jacobowitz wrote: > On Fri, Sep 02, 2005 at 05:18:46PM +0400, Vladimir Prus wrote: > > On Friday 02 September 2005 17:13, Daniel Jacobowitz wrote: > > > On Fri, Sep 02, 2005 at 01:53:41PM +0400, Vladimir Prus wrote: > > > > So, there's a window there variable does not exists according to C++, > > > > but exists according to gdb. > > > > > > With better debug information, this doesn't happen (or the window is > > > reduced to an instruction or two in the call sequence for the > > > constructor). GCC 4's variable tracking feature does this passably > > > well, IIRC, by use of dwarf2 location lists. > > > > Do I need for extra flags for gcc? I've tried with gcc-4.0 before posting > > the message, and it did printed all vars. > > I think it's activated with optimization, but with -O0 you may need > -fvar-tracking. I don't know for sure. -fvar-tracking is accepted, but does not have any result on "info locals". > > > In general no there is nothing gdb can do. > > > > How about using decl_line. Here's what debug info says > > > > <2><2188c>: Abbrev Number: 140 (DW_TAG_variable) > > DW_AT_name : url > > DW_AT_decl_file : 1 > > DW_AT_decl_line : 14 > > DW_AT_type : <1d555> > > DW_AT_location : 3 byte block: 91 98 7f (DW_OP_fbreg: > > -104) > > > > If gdb could tell the value of 'decl_line' via some command, that might > > be a good approximation. > > Using line numbers for this sort of thing is really not a good idea. > They're useful for displaying source to the user, but for anything > else, there are too many potential strangenesses... I realize, but given that no better mechanism exist, what can I do? - Volodya