This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: "info locals" -- is variable initialized
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.
> 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.
- Volodya