[Dwarf-Discuss] imported_unit and reference identity
David Anderson
davea42@earthlink.net
Tue Jan 20 23:56:20 GMT 2009
Chris Quenelle wrote:
> I think most of the discussion in Appendix E relates to
> combining type information that is actually the exact
> same type, but it would otherwise be recorded multiple
> times in executable. In this sense, A::foo and B::foo are
> not the exact same type. They have the same shape, but
> they are not the same type.
>
>
I think this is the essential point for the example. They are not the
same type.
So sharing across namespaces is not correct. (Therefore making struct foo
a separate partial unit from the namespace is pointless.)
Looking for support in the document, I find in Section E.5 (picking the
Oct 7 2008 draft
somewhat arbitrarily as we've not changed this recently) :
"The DW_TAG_partial_unit compilation unit will be referenced from
elsewhere and the referencing locations give the appropriate context
for interpreting the partial compilation unit."
Roland's example fails this requirement in that it does not give the
appropriate context,
it does not refer to a struct-in-a-namespace. Therefore it's not an
appropriate
interpretation of DWARF in the way appendix E describes partial units.
I do wonder if there isn't a better way to express the requirement, as
in the example it's not entirely
the referencing location giving the namespace context of foo, but the
partial unit itself that
contributes to the namespace context of its unique struct foo type in
this example. Thereby expressing
the meaning of the C++ language construct as it applies to a use of a
particular struct foo.
[Sigh. This is an opaque paragraph. Sorry.]
A revised version of Roland's example might be a good example for section E.
Regards,
David Anderson
More information about the Dwarf-discuss
mailing list