Skip to content

Commit 4e14814

Browse files
daverigbyacmel
authored andcommitted
perf unwind: Set userdata for all __report_module() paths
When locating the DWARF module for a given address, __find_debuginfo() requires a 'struct dso' passed via the userdata argument. However, this field is only set in __report_module() if the module is found in via dwfl_addrmodule(), not if it is found later via dwfl_report_elf(). Set userdata irrespective of how the DWARF module was found, as long as we found a module. Fixes: bf53fc6 ("perf unwind: Fix separate debug info files when using elfutils' libdw's unwinder") Signed-off-by: Dave Rigby <d.rigby@me.com> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=211801 Acked-by: Jan Kratochvil <jan.kratochvil@redhat.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Link: https://lore.kernel.org/linux-perf-users/20210218165654.36604-1-d.rigby@me.com/ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent e16c2ce commit 4e14814

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/perf/util/unwind-libdw.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ static int __report_module(struct addr_location *al, u64 ip,
6060
mod = dwfl_addrmodule(ui->dwfl, ip);
6161
if (mod) {
6262
Dwarf_Addr s;
63-
void **userdatap;
6463

65-
dwfl_module_info(mod, &userdatap, &s, NULL, NULL, NULL, NULL, NULL);
66-
*userdatap = dso;
64+
dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL);
6765
if (s != al->map->start - al->map->pgoff)
6866
mod = 0;
6967
}
@@ -79,6 +77,13 @@ static int __report_module(struct addr_location *al, u64 ip,
7977
al->map->start - al->map->pgoff, false);
8078
}
8179

80+
if (mod) {
81+
void **userdatap;
82+
83+
dwfl_module_info(mod, &userdatap, NULL, NULL, NULL, NULL, NULL, NULL);
84+
*userdatap = dso;
85+
}
86+
8287
return mod && dwfl_addrmodule(ui->dwfl, ip) == mod ? 0 : -1;
8388
}
8489

0 commit comments

Comments
 (0)