Commit 4e148144 authored by Dave Rigby's avatar Dave Rigby Committed by Arnaldo Carvalho de Melo

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: bf53fc6b ("perf unwind: Fix separate debug info files when using elfutils' libdw's unwinder")
Signed-off-by: default avatarDave Rigby <d.rigby@me.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=211801Acked-by: default avatarJan Kratochvil <jan.kratochvil@redhat.com>
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Link: https://lore.kernel.org/linux-perf-users/20210218165654.36604-1-d.rigby@me.com/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e16c2ce7
...@@ -60,10 +60,8 @@ static int __report_module(struct addr_location *al, u64 ip, ...@@ -60,10 +60,8 @@ static int __report_module(struct addr_location *al, u64 ip,
mod = dwfl_addrmodule(ui->dwfl, ip); mod = dwfl_addrmodule(ui->dwfl, ip);
if (mod) { if (mod) {
Dwarf_Addr s; Dwarf_Addr s;
void **userdatap;
dwfl_module_info(mod, &userdatap, &s, NULL, NULL, NULL, NULL, NULL); dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL);
*userdatap = dso;
if (s != al->map->start - al->map->pgoff) if (s != al->map->start - al->map->pgoff)
mod = 0; mod = 0;
} }
...@@ -79,6 +77,13 @@ static int __report_module(struct addr_location *al, u64 ip, ...@@ -79,6 +77,13 @@ static int __report_module(struct addr_location *al, u64 ip,
al->map->start - al->map->pgoff, false); al->map->start - al->map->pgoff, false);
} }
if (mod) {
void **userdatap;
dwfl_module_info(mod, &userdatap, NULL, NULL, NULL, NULL, NULL, NULL);
*userdatap = dso;
}
return mod && dwfl_addrmodule(ui->dwfl, ip) == mod ? 0 : -1; return mod && dwfl_addrmodule(ui->dwfl, ip) == mod ? 0 : -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment