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: Fri, 7 Apr 2006 00:54:44 +0100 (BST)
- 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> <17459.25334.413731.57965@farnswood.snap.net.nz> <20060405133638.GC28872@nevyn.them.org>
> > 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.
>
> Well, there are at least three bugs here. First, it should be printed
> in "info args" instead of "info locals". Secondly, failure to access
> it should not be fatal. Third, it's not really LOC_STATIC.
>
> The third is the easiest to fix. I assume the reason that it is
> assigned LOC_STATIC is in new_symbol, where we check for
> DW_AT_external? In that branch, if there is no external flag, we could
> change the LOC_STATIC to LOC_OPTIMIZED_OUT. That should get you an
> <optimized out> instead of an error at address 0x0.
OK, I've changed the default value in new_symbol from LOC_STATIC to
LOC_OPTIMIZED_OUT. This means "info locals" works as expected. The
command "info args" still gives "No arguments." when the arguments are
not used and they've been optimised out. I've also checked that a static
variable is correctly identified as LOC_STATIC and that no new fails are
introduced into the testsuite.
I guess it still might break something else though, so how about applying
this patch after the next release so it gets a bit of testing first?
--
Nick http://www.inet.net.nz/~nickrob
2006-04-07 Nick Roberts <nickrob@snap.net.nz>
* dwarf2read.c (new_symbol): Make LOC_OPTIMIZED_OUT the default
value for a symbol.
*** dwarf2read.c 31 Mar 2006 12:46:15 +1200 1.193
--- dwarf2read.c 06 Apr 2006 10:11:22 +1200
***************
*** 6853,6859 ****
/* Default assumptions.
Use the passed type or decode it from the die. */
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
! SYMBOL_CLASS (sym) = LOC_STATIC;
if (type != NULL)
SYMBOL_TYPE (sym) = type;
else
--- 6853,6859 ----
/* Default assumptions.
Use the passed type or decode it from the die. */
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
! SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
if (type != NULL)
SYMBOL_TYPE (sym) = type;
else