[Dwarf-discuss] null attributes (was: 2.12.1, Non-defining Declarations)
Cary Coutant
cary
Mon May 16 20:28:58 GMT 2005
> That aside, you're suggesting something kind of interesting: an
> attribute whose presence alone indicates something. We could have a
> new form, DW_FORM_none, meaning that the attribute had *no* data in
> the DIE itself. You'd be effectively packing the information into the
> abbreviation number.
>
> I wonder, though, if this might make life harder for simple Dwarf
> producers: instead of being able to statically assign an abbrev for
> each kind of die you write out, you would need to dynamically assign
> abbrevs for each combination of DW_FORM_none flags you needed to write
> out. With DW_FORM_flag, you can always write out a zero.
In my opinion, DWARF should be careful to avoid situations where the
mere presence of an attribute means something. I can provide one
example of this problem in the current spec -- there is no (documented)
way of providing a null value for the DW_AT_sibling attribute when the
current entry is at the end of a list of siblings. The compiler either
has to create abbrev entries with and without this attribute, or it
needs to carefully compute the offset of the zero byte that terminates
the sibling chain (speaking from experience, this is very error-prone).
I'd prefer that the spec explicitly state that DW_AT_sibling == 0 means
that there are no more siblings. We tried using 0, but it caused gdb to
crash.
-cary
More information about the Dwarf-discuss
mailing list