This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: GCC 4.1.0 doesn't generate DWARF 2 output for function arguments?
- From: Nick Roberts <nickrob at snap dot net dot nz>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: gdb at sources dot redhat dot com
- Date: Wed, 5 Apr 2006 18:25:58 +1200
- Subject: Re: GCC 4.1.0 doesn't generate DWARF 2 output for function arguments?
- References: <17457.1343.364824.430939@farnswood.snap.net.nz> <20060403135713.GA6308@nevyn.them.org> <17457.36376.661285.541008@farnswood.snap.net.nz> <20060403211050.GA15501@nevyn.them.org>
[moved from gcc@gnu.org]
> > It also causes GDB to generate errors on the output of other commands:
> >
> > (gdb) info locals
> > argc = Cannot access memory at address 0x0
> >
> > as well as the GDB/MI equivalent -stack-list-locals. This breaks the
> > front end that I'm writing fo Emacs.
>
> That's a bug in GDB, and not hard to fix. You're welcome to do it, or
> to file it in GNATS :-)
Is it easy? With the optimisation GDB thinks argc is LOC_STATIC, which is why
it tries to print its value with the "info locals" command, even though it is
not a local variable in GDB's usual sense. The only way I can think of doing
thi is testing if sym->ginfo.name is "argc" or "argv" in the LOC_STATIC case of
the switch statements of print_block_frame_locals and list_args_or_locals.
Its inelegant and probably not general either.
--
Nick http://www.inet.net.nz/~nickrob