[Dwarf-discuss] 2.12.1, Non-defining Declarations

Jim Blandy jimb
Mon May 16 19:21:33 PDT 2005


"Bishop, John E" <john.e.bishop at intel.com> writes:
> Maybe I'm missing something, but it looks like
> it says that if this DIE for a non-defining declaration,
> then it has the DW_AT_declaration attribute.
> 
> Presumably if it's not a non-defining declaration,
> it doesn't have the DW_AT_declaration attribute.
> 
> So why does the attribute need a flag value?  Isn't
> having the attribute enough?

The description of the 'flag' form in chapter 7 says:

    A flag is represented as a single byte of data (DW_FROM_flag).  If
    the flag has value zero, it indicates the absence of the
    attribute.  If the flag has a non-zero value, it indicates the
    presence of the attribute.

So I think that text (2.12.1 Non-Defining Declarations) is meant to read:

    If a debugging information entry has a DW_AT_declaration attribute
    whose value is a true flag, then that entry represents a
    non-defining or otherwise incomplete declaration of a program
    entity.

It's my impression that Dwarf generally didn't require information,
but if the intent was to require DW_AT_declaration attributes on such
entries, we could say:

    Debugging information entries that represent non-defining or
    otherwise incomplete declarations for a program entity must have a
    DW_AT_declaration attribute, whose value is a true flag.

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.




More information about the Dwarf-Discuss mailing list