This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4.1.0 doesn't generate DWARF 2 output for function arguments?


 > > 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]