[Dwarf-Discuss] Default Location List Entry Issue 130121.1

Mark Wielaard mjw@redhat.com
Wed Apr 2 10:43:42 GMT 2014


On Tue, 2014-04-01 at 18:42 -0700, Michael Eager wrote:
> On 04/01/14 13:54, Mark Wielaard wrote:
> 
> > What about using the presence of a DW_AT_external attribute on the data
> > object that has a single location expression to know whether the described
> > location is valid/visible outside of the enclosing lexical scope?
> >
> > Using that or some new flag (DW_AT_global_scope) to mark a data object
> > that has a single location description with global scope might be cheaper
> > than encoding it with a location list pointer and a default entry.
> 
> Both DW_AT_external attribute and a hypothetical DW_AT_global_scope
> attribute would describe scope, not the storage life of the object.
> C unfortunately has confabulated the two concepts.

In practice I believe DW_AT_external does both and I have used it that
way to know whether to trust a single location description is globally
valid. But yes, just like lifetime both "external" and "scope" are again
bad words to use in this case and don't really express the thing we want
(they might only accidentally).

What about we call the flag attribute DW_AT_global_visible or
DW_AT_global_location then it would be clear I think because it signals
this isn't about language or DWARF tree (lexical) scoping?

> Objects which have only a single location can be described with a location
> expression.  They don't need a location list with a default entry.

For a data object that has a single location descriptor (DW_AT_location
in exprloc class form), the valid range is given by the address ranges
of the DIEs that own the data object. So it only lets me express the
location in a restricted range. I do need to use a location list with
(just) a default entry if I want to indicate that the location
description has a valid global range.

Is the above correct? Or is there another way to express that a location
description is globally valid? Or am I misunderstanding the purpose of
having a default entry in a location list?

Thanks,

Mark





More information about the Dwarf-discuss mailing list