[Dwarf-Discuss] Does gcc optimization impacts retriving Dwarf information?

Michael Eager eager@eagercon.com
Thu May 28 15:55:31 GMT 2009


Frank Ch. Eigler wrote:
> Hi -
> 
> On Thu, May 28, 2009 at 02:57:08AM -0700, Michael Eager wrote:
>> [...]
>>> This problem (unable to retrieve variable values) raises two questions:
>>> 1. Does it mean that compiling with -O2 option removes some of the
>>> information needed by DWARF library functions?
>> [...]  DIEs for variables which do not have DW_AT_location
>> attributes do not have physical locations.  Your crash dump utility
>> should not attempt to find the locations or print the values for
>> these variables.
> 
> That's all true in the abstract, but modern gcc has been known to
> abscond with variable location data even for values that are
> live/recomputable.  This is the main reason why the VTA (and
> debuglocus and other) gcc projects are under way -- to represent the
> maximum possible conceptual data, despite -O2 etc.

Yes, that's a good thing.  Also the reason I suggested that Mohan
confirm that this was not caused by a bug in gcc.

On the other hand, a DWARF consumer doesn't really have much
choice in the matter.  If there is no DW_AT_location, then trying
to print the value will cause an error.

-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077




More information about the Dwarf-discuss mailing list