[PATCH] D143967: [DebugInfo][BPF] Add 'btf:type_tag' annotation in DWARF

David Faust via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 10:15:28 PDT 2023


dfaust added a comment.

> Type tag for CVR modifier type
>
> C:
>
>   volatile int __attribute__((btf_type_tag("__b"))) b;
>
> DWARF:
>
>   0x31:   DW_TAG_variable
>             DW_AT_name      ("b")
>             DW_AT_type      (0x3c "volatile int")
>   
>   0x3c:   DW_TAG_volatile_type
>             DW_AT_type      (0x45 "int")
>   
>   0x41:     DW_TAG_LLVM_annotation
>               DW_AT_name    ("btf:type_tag")
>               DW_AT_const_value     ("__b")

I am not sure about this case. Do we want the tag on the CVR qualifier or on the type being qualified?

Current patches for GCC place the annotation DIE as child of the 'int':

  0x0000001e:   DW_TAG_variable
                  DW_AT_name	("b")
                  DW_AT_type	(0x00000047 "volatile int")
  
  0x00000032:   DW_TAG_base_type
                  DW_AT_byte_size	(0x04)
                  DW_AT_name	("int")
  
  0x0000003d:     DW_TAG_LLVM_annotation
                    DW_AT_name	("btf:type_tag")
                    DW_AT_const_value	("__b")
  
  0x00000047:   DW_TAG_volatile_type
                  DW_AT_type	(0x00000032 "int")

The way I see it both 'volatile' and the type tag are modifying 'int' type here, so the annotation DIE more properly fits as a child of 'int' rather than the 'volatile'.

I don't think we discussed this particular case, and I'm not sure whether there is any precedent here.

WDYT @eddyz87, @jemarch ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143967/new/

https://reviews.llvm.org/D143967



More information about the llvm-commits mailing list