Skip to content

Commit 8d11e6a

Browse files
daverigbygregkh
authored andcommitted
perf unwind: Set userdata for all __report_module() paths
commit 4e14814 upstream. 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 <[email protected]> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=211801 Acked-by: Jan Kratochvil <[email protected]> Acked-by: Jiri Olsa <[email protected]> Link: https://lore.kernel.org/linux-perf-users/[email protected]/ Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Cc: "Tommi Rantala" <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 53eaf28 commit 8d11e6a

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)