Hi Tom,

On 10/16/25 09:05, Tom Tromey wrote:
>>>>>> "David" == David Faust <[email protected]> writes:
> 
> I was comparing the GCC and GDB copies of dwarf2.def today and ran
> across this patch.
> 
> David> DW_AT_GNU_annotation is a new attribute extension used to refer to 
> these
> David> new annotation DIEs.  If non-null in any given declaration or type DIE,
> David> it is a reference to a DW_TAG_GNU_annotation DIE holding an annotation
> David> for that declaration or type.  In addition, the DW_TAG_GNU_annotation
> David> DIEs may also have a non-null DW_AT_GNU_annotation, referring to 
> another
> David> annotation DIE.
> 
> David> +DW_TAG (DW_TAG_GNU_annotation, 0x6001)
> 
> It seems strange that this was given this value and not something closer
> to the other GNU extension tag values.

For a little bit of context, conceptually the DWARF was initially designed
and implemented in LLVM with the value 0x6000, and we were implementing the
same.  But, their DWARF format was found to be lacking during early reviews
of prior iterations of this series, and we diverged from it slightly.
That is why I chose 0x6001, but there wasn't really particular discussion
on it.

> 
> However, that's a minor thing.  The real reason I am writing is that I
> think all DWARF extensions should come with documentation.  In the old
> days this wasn't done and it's proved to be a pain for gdb.
> 
> The normal thing to do is write a page on the GCC wiki that explains the
> extension, then add a link from the .def file to that page.

Sorry for forgetting this, and thanks for raising the issue.

I have just created a wiki page here:

  https://gcc.gnu.org/wiki/GNUAnnotationsDwarf

The initial contents are an adaptation of this patch series cover
letter, aiming to describe the purpose of the new C attributes and the
DWARF representation (both TAG_GNU_annotation and AT_GNU_annotation).

I will update dwarf2.def with a link to the wiki page shortly.

Please let me know if there is more info that would be useful there
or if it can otherwise be improved.

> 
> Furthermore I think requiring documentation for GNU DWARF extensions
> should be part of the dwarf2.{def,h} review checklist.
> 
> thanks,
> Tom

Thanks,
David

Reply via email to