[Dwarf-Discuss] Default Location List Entry Issue 130121.1
mjw at redhat.com
Mon Apr 7 03:04:58 PDT 2014
On Thu, 2014-04-03 at 13:46 +0000, Robinson, Paul wrote:
> > > A default location list entry (as proposed in 130121.1) gives the
> > location
> > > of an object for address values which are not otherwise specified in
> > the
> > > location list.
> > Maybe an example of this would be helpful too. I am under the (wrong)
> > impression that a default location list entry would be used to describe
> > "static objects". But the use case is probably different than I imagine.
> Consider a subprogram with a local stack-allocated variable. In the
> simple case, a simple location description gives that location, and
> of course it's valid for the address-range of the containing subprogram.
> The compiler might optimize this variable into a register for part of
> the subprogram, a different register for a different part of the
> subprogram, and leave it on the stack otherwise. This can be described
> by a set of normal location list entries for the ranges where the
> variable is in a register, and a default location entry for the entire
> range of the subprogram, giving the stack location. Of course the
> compiler *could* emit many individual entries with the stack location,
> filling in the gaps, but the default location entry is more compact.
Aha. Thanks, that makes sense. I assumed a different use case, causing
some confusion. I had assumed the use case was for a static object that
had a known location outside a specific lexical block range. The above
is more an optimization. One that would certainly be helpful, I have
seen very fragmented location lists that flip a lot between just two
locations. So this proposal would be perfect for that case.
> In any case, the locations for the local variable are valid only for
> the address range of the containing subprogram.
OK. It would be good to mention that explicitly (and how to make clear
how to distinguish local variables from global ones, but that is the
subject of the other thread in this discussion). Since the range can be
read as if it was valid outside the range of the containing lexical DIE
if it is a default entry. And it isn't immediately clear to me from the
text whether producers are supposed to only generate location list
ranges that fall within the address range of the containing
subprogram/lexical block, or that the consumer is supposed to make sure
to only use the ranges that are valid for the address range of the
containing subprogram/lexical block DIE.
> Well, technically
> only for the address range that has a valid stack frame.
In the case that the range is smaller than the scope of the most
enclosing object the producer should add a DW_AT_start_scope for the
data object to indicate where the ranges for the data object are valid.
That seems to apply in this case too, wouldn't it? If so, it would again
be good to explicitly mention that the valid range of the default entry
are constrained by this, so consumers don't interpret it in ranges that
More information about the Dwarf-Discuss