[Dwarf-discuss] null entry after DW_TAG_compile_unit?

Marcel Mettes marcelm
Tue Dec 19 10:35:49 GMT 2006


Hello,

I have question about a small detail. It concerns the termination of DIE 
sibling chains at the highest level of a compilation unit.
For one compilation unit, DWARF 3, paragraph 7.5, states:

    Each such contribution consists of a compilation unit header (see
    Section 7.5.1) followed by a single DW_TAG_compile_unit or
    DW_TAG_partial_unit debugging information entry, together with its
    children.

So only one TAG should appear at the highest level.

In all objects I have seen so far this is the case, and no null entry 
follows the DW_TAG_compile_unit. This seems correct because the standard 
specifies only one entry can occur and a null entry counts for one as well.

When writing a parser, the top level looks to have the same form as 
child-DIE-chains. So when parsing using recursive descend, one would 
expect the top-tag-chain to be zero terminated to signal the end of the 
tags.

The question now is, is it valid to have a null entry following that 
DW_TAG_compile_unit? Or is that in violation with the debug format 
specification?

Best regards,
Marcel Mettes.





More information about the Dwarf-discuss mailing list