[Dwarf-Discuss] imported_unit and reference identity

David Anderson davea42 at earthlink.net
Mon Jan 19 19:42:09 PST 2009


Roland McGrath wrote:
> Appendix E talks about particular ways of producing DWARF data using
> imported_unit and partial_unit.  But that is not part of the spec.  The
> descriptions of imported_unit and partial_unit themselves are part of the
> spec.  I'd like to talk about what we can agree on for what a DWARF
> encoding using imported_unit should mean (or the range of what it could
> mean) as a proper understanding of that format as it lies in a DWARF file,
> independent of the particular means of producing that file.
>
> C
> Using imported_unit to reduce the duplication, this would become:
>
> #b10: partial_unit
> #b20:	structure_type{name="foo", decl_file=["foo.cc"], decl_line=1}
> 		...
> <new CU header>
> #b30: compile_unit{name="main.cc", ...}
> #b40:	namespace{name="A", decl_file=["main.cc"], decl_line=1}
> #b50:		imported_unit{import=#b10}
> #b60:	namespace{name="B", decl_file=["main.cc"], decl_line=4}
> #b70:		imported_unit{import=#b10}
> #b80:	variable{name="var", location=..., type=#b20}
>
> This is a "correct" transformation using imported_unit in the way that
> partial and imported units are described in the spec.  Appendix E mentions
> using partial_unit in this way particularly.
>   
It looks wrong to me.   Precisely because #b20 is ambiguous.
Instead make namespace A and B be independent partial units
with independent  foo in them. Then your #b?? has to be unambiguous.

It does not make sense to make 'foo' a partial unit, independent of its 
namespace.

What am I missing here?
DavidAnderson



More information about the Dwarf-Discuss mailing list