fprintf: Correct names for types with btf_type_tag attribute

The following example contains a structure field annotated with
btf_type_tag attribute:

    #define __tag1 __attribute__((btf_type_tag("tag1")))

    struct st {
      int __tag1 *a;
    } g;

It is not printed correctly by `pahole -F dwarf` command:

    $ clang -g -c test.c -o test.o
    pahole -F dwarf test.o
    struct st {
    	tag1 *                     a;                    /*     0     8 */
    	...
    };

Note the type for variable `a`: `tag1` is printed instead of `int`.
This commit teaches `type__fprintf()` and `__tag_name()` logic to skip
`DW_TAG_LLVM_annotation` objects that are used to encode type tags.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Cc: Alan Maguire <alan.maguire@oracle.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Faust <david.faust@oracle.com>
Cc: Jose Marchesi <jose.marchesi@oracle.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Cc: kernel-team@fb.com
Link: https://lore.kernel.org/r/20230314230417.1507266-2-eddyz87@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed