[Dwarf-discuss] null entry after DW_TAG_compile_unit?

Ron Brender ron.brender
Tue Dec 19 13:10:20 GMT 2006


Is it valid to have a null entry following a DW_TAG_compile_unit? 
Perhaps, but I think it was certainly not the intent. I recall tweaking 
the language you reference to make clear(er) that there could not be a 
sibling chain of multiple DW_TAG_compile_unit DIEs, but I don't recall 
discussing your particular point.

One piece of evidence comes from noting that Appendix A does not list 
DW_AT_sibling among the "normal" attributes for a compile unit. This 
Appendix is not controlling, of course, but it does suggest intent that 
there not be a following null entry.

OTOH, one could argue I suppose that it would be an allowed extension 
for a producer to waste a byte by throwing in an extra null entry. Or 
even that one or more nulls might be included as padding rather than as 
"real data".

If it is a touch easier for a parser to share a parse state with other 
DIEs-that-allow-siblings, then it seems harmless enough. But my 
inclination is that not allowing this (treating it as an error) is better.


Marcel Mettes wrote:
> 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.
> _______________________________________________
> Dwarf-discuss mailing list
> Dwarf-discuss at lists.freestandards.org
> http://lists.freestandards.org/mailman/listinfo/dwarf-discuss

More information about the Dwarf-discuss mailing list