[Dwarf-Discuss] PROPOSAL: Constant expressions in location lists

Chris Quenelle Chris.Quenelle@Sun.COM
Tue Jan 8 00:11:07 GMT 2008

Jim Blandy wrote:
> If the task is to be able to recompute values
> of variables that have been optimized out, and those variables could
> potentially have any type, then DWARF needs to be able to express how
> to compute the run-time, target representations of values of arbitrary
> type.

This requires the compiler backend to retain the knowledge
of variable-related optimizations in a structured way,
and to record those transformation in the reverse way they
were performed to the code.  This sort of ability isn't
likely to appear full-blown in any compiler without some
serious evolution along the way.  The Sun compilers are expected
to learn how to record the simpler transformations first, and 
eventually move on to more complex optimizations.

The existing approach calls for making the leap from completely 
source level (in the symbolic dies) to the completely binary 
level (in the dwarf expressions).  This gap might be leapable
for simple to moderate optimizations and types.  But for more 
complex transformations the dwarf expressions needed to 
"jump the gap" might become very complex indeed.  Perhaps
impossibly complex (or perhaps not), but perhaps just prohibitively

Say you have some large and complex C++ class and a single variable
of that type.  Now let's say the optimizer has placed one tiny field
of a deeply nested inner member of that class into a register.
The only die is for the top-level variable.  How should the compiler
record that one tiny part of the overall class is now in a register?

The pragmatic answer is that we don't really have to answer that question
until someone says they want to do it.  Of course, it would be nice
to know where dwarf is headed, in a general way.


More information about the Dwarf-discuss mailing list