[Dwarf-Discuss] DW_AT_specification chains
ron.brender at charter.net
Wed Apr 23 07:15:46 PDT 2008
Marcel Mettes wrote:
> I was wondering what the semantics are of a series of DW_AT_specifications
> that are supposed to form some kind of chain?
> For example
> X1 TAG_variable
> X2 DW_AT_name = "x"
> Y1 TAG_variable
> Y2 DW_AT_specification = X1
> Y3 DW_AT_external = 1
> Y4 DW_AT_type = ...
> Z1 TAG_variable
> Z2 DW_AT_specification = Y1
> Z3 DW_AT_location = ...
> Would this be valid or should the DW_AT_specification at offset Z2
> point directly to X1?
> Best regards,
Are you assuming the three DIEs are in the same compilation unit?
I would say that the answer here depends as much on the semantics of the
source language as on DWARF as such. If this is for C/C++, for example,
my shaky language lawyer suggests that it is not valid for both an
external declaration and an allocating declaration to occur in the same
unit, so that even if you believed DWARF allowed it the combination
would not make sense.
OTOH, for a language where three occurences of x such as indicated above
is valid--and especially if the first is not visible at the place of the
third--then I would argue that a producer pretty much should output the
above in order to accurately reflect the language and a consumer would
be remiss to not accept and properly interpret it (for that language).
I don't think this construction is what us DWARF folks had in mind, but
given the permissive nature of DWARF I would not say it is *never* valid.
More information about the Dwarf-Discuss