From: Vladimir Prus <ghost@cs.msu.su>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sources.redhat.com
Subject: Re: "info locals" -- is variable initialized
Date: Fri, 02 Sep 2005 13:28:00 -0000 [thread overview]
Message-ID: <200509021727.49281.ghost@cs.msu.su> (raw)
In-Reply-To: <20050902132045.GA13068@nevyn.them.org>
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
prev parent reply other threads:[~2005-09-02 13:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-02 7:58 Vladimir Prus
2005-09-02 9:28 ` Ramana Radhakrishnan
2005-09-02 9:57 ` Vladimir Prus
2005-09-02 13:13 ` Daniel Jacobowitz
2005-09-02 13:19 ` Vladimir Prus
2005-09-02 13:21 ` Daniel Jacobowitz
2005-09-02 13:28 ` Vladimir Prus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200509021727.49281.ghost@cs.msu.su \
--to=ghost@cs.msu.su \
--cc=drow@false.org \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).