Skip to content

Commit 3426933

Browse files
committed
dwarf_loader: Print the CU's language when a tag isn't supported
To help debug --lang_exclude, for instance, now, even with --lang_exclude=rust, we're getting this when processing a recent Fedora 40 kernel: $ uname -a Linux toolbox 6.11.3-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Oct 10 22:31:19 UTC 2024 x86_64 GNU/Linux $ pahole --running_kernel_vmlinux /home/acme/.cache/debuginfod_client/8c97f87b685044733f5d1576eca82df1f3b7fa0c/debuginfo acme@x1:~/git/pahole$ tests/btf_functions.sh Validation of BTF encoding of functions; this may take some time: die__process_class: tag not supported 0x33 (variant_part) at <7719ef8>! die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x77370f1> not handled in a rust CU! tag__recode_dwarf_type: couldn't find name for function 0x77558a9, abstract_origin=0, specification=0x77370f1 ^C $ Cc: Alan Maguire <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Stephen Brennan <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent fb53907 commit 3426933

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

dwarf_loader.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ static void __tag__print_not_supported(uint32_t tag, const char *func, unsigned
8686
#define tag__print_not_supported(die) \
8787
__tag__print_not_supported(dwarf_tag(die), __func__, dwarf_dieoffset(die))
8888

89-
static void __cu__tag_not_handled(Dwarf_Die *die, const char *fn)
89+
static void __cu__tag_not_handled(const struct cu *cu, Dwarf_Die *die, const char *fn)
9090
{
9191
uint32_t tag = dwarf_tag(die);
9292

93-
fprintf(stderr, "%s: DW_TAG_%s (%#x) @ <%#llx> not handled!\n",
93+
fprintf(stderr, "%s: DW_TAG_%s (%#x) @ <%#llx> not handled in a %s CU!\n",
9494
fn, dwarf_tag_name(tag), tag,
95-
(unsigned long long)dwarf_dieoffset(die));
95+
(unsigned long long)dwarf_dieoffset(die), lang__int2str(cu->language));
9696
}
9797

9898
static struct tag unsupported_tag;
9999

100-
#define cu__tag_not_handled(die) __cu__tag_not_handled(die, __FUNCTION__)
100+
#define cu__tag_not_handled(cu, die) __cu__tag_not_handled(cu, die, __FUNCTION__)
101101

102102
struct dwarf_tag {
103103
struct hlist_node hash_node;
@@ -1123,7 +1123,7 @@ static int template_parameter_pack__load_params(struct template_parameter_pack *
11231123
die = &child;
11241124
do {
11251125
if (dwarf_tag(die) != DW_TAG_template_type_parameter) {
1126-
cu__tag_not_handled(die);
1126+
cu__tag_not_handled(cu, die);
11271127
continue;
11281128
}
11291129

@@ -1255,7 +1255,7 @@ static int formal_parameter_pack__load_params(struct formal_parameter_pack *pack
12551255
die = &child;
12561256
do {
12571257
if (dwarf_tag(die) != DW_TAG_formal_parameter) {
1258-
cu__tag_not_handled(die);
1258+
cu__tag_not_handled(cu, die);
12591259
continue;
12601260
}
12611261

@@ -1694,7 +1694,7 @@ static struct tag *die__create_new_array(Dwarf_Die *die, struct cu *cu)
16941694
break;
16951695
}
16961696
} else
1697-
cu__tag_not_handled(die);
1697+
cu__tag_not_handled(cu, die);
16981698
} while (dwarf_siblingof(die, die) == 0);
16991699

17001700
array->nr_entries = memdup(nr_entries,
@@ -1875,7 +1875,7 @@ static struct tag *die__create_new_enumeration(Dwarf_Die *die, struct cu *cu, st
18751875
struct enumerator *enumerator;
18761876

18771877
if (dwarf_tag(die) != DW_TAG_enumerator) {
1878-
cu__tag_not_handled(die);
1878+
cu__tag_not_handled(cu, die);
18791879
continue;
18801880
}
18811881
enumerator = enumerator__new(die, cu, conf);
@@ -2104,7 +2104,7 @@ static int die__process_inline_expansion(Dwarf_Die *die, struct lexblock *lexblo
21042104
* DW_TAG_function... Lets just get the types
21052105
* for 1.8, then fix this properly.
21062106
*
2107-
* cu__tag_not_handled(die);
2107+
* cu__tag_not_handled(cu, die);
21082108
*/
21092109
continue;
21102110
case DW_TAG_inlined_subroutine:
@@ -2373,7 +2373,7 @@ static struct tag *__die__process_tag(Dwarf_Die *die, struct cu *cu,
23732373
case DW_TAG_constant: // First seen in a Go CU
23742374
tag = die__create_new_constant(die, cu, conf); break;
23752375
default:
2376-
__cu__tag_not_handled(die, fn);
2376+
__cu__tag_not_handled(cu, die, fn);
23772377
/* fall thru */
23782378
case DW_TAG_dwarf_procedure:
23792379
/*

0 commit comments

Comments
 (0)