[Dwarf-discuss] Re: Dwarf2 Beginner's Question: Pointer variable...

Koji Noguchi knoguchi
Wed Jun 15 05:24:14 GMT 2005

Thank you so much for all the feedbacks.

>>>David Anderson wrote:
 > Instead, produce a .o file and use
 > readelf (gnu tool) or dwarfdump (from my web site)
 > to display the .debug_info section readably.
I see.
I didn't know the difference between the gcc -S -gdwarf-2 -dA output 
and the readelf/dwarfdump outputs.

>>>Ron 603-884-2088 said:
 > The lack of a DW_AT_location attribute on the DIE for p_int
 > indicates that it has no address. That is, it was "optimized
 > away". In this example, value propagation might well move the
 > address of bbb directly into the point of use without ever
 > allocating a place specifically for p_int.
Does this mean these two lines 

  p_int = &bbb;
  printf(..., p_int);

can be optimized into the following one line?

  printf(..., &bbb )

In this case, is it possible to determine the register of '&bbb'
from the DWARF output?
I was hoping that the DW_AT_location of 'p_int' would still be the register of 
the '&bbb' even after this 'optimized away' step.

 > Compilers for so-called "garbage collected languages" generally 
 > need to be especially tuned to avoid creating temporaries that cannot 
 > be handled by the runtime garbage collector.
Thanks.  My goal was to track the pointers without sacrificing 
the optimization, but I guess it was an impossible dream.  

Koji Noguchi

More information about the Dwarf-discuss mailing list