perf: fix the probe finder location (.dwo files)
PATCH 1/1 perf: fix the probe finder location (.dwo files)
If the file object is compiled using -gsplit-dwarf, the probe finder location will fail.
--- tools/perf/util/probe-finder.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
tools/perf/util/probe-finder.c +10 -1
@@ -1161,7 +1161,8 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,struct perf_probe_point *pp = &pf->pev->point;Dwarf_Off off, noff;size_t cuhl; -Dwarf_Die *diep; +Dwarf_Die *diep, cudie, subdie; +uint8_t unit_type;int ret =0 ; off =0 ;
@@ -1200,6 +1201,14 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,continue ; } +/* Check separate debug information file. */ +if (dwarf_cu_info (pf->cu_die.cu,NULL , &unit_type, &cudie, + &subdie,NULL ,NULL ,NULL )) +continue ; + +if (unit_type == DW_UT_skeleton) + pf->cu_die = subdie; +/* Check if target file is included. */ if (pp->file) pf->fname =cu_find_realpath (&pf->cu_die, pp->file);
Signature · 1 line
2.20.1
Namhyung Kim
maintainerHello,
Quoted 24 lines · Henry Castro
If the file object is compiled using -gsplit-dwarf, the probe finder location will fail.
Signed-off-by Henry Castro <[email protected]>--- tools/perf/util/probe-finder.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tools/perf/util/probe-finder.c +2
-1@@ -1161,7 +1161,8 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,struct perf_probe_point *pp = &pf->pev->point;Dwarf_Off off, noff;size_t cuhl; -Dwarf_Die *diep; +Dwarf_Die *diep, cudie, subdie; +uint8_t unit_type;int ret =0 ; off =0 ;
tools/perf/util/probe-finder.c static int debuginfo__find_probe_location(struct debuginfo *dbg, · line 1206
Quoted 6 lines
tools/perf/util/probe-finder.c +3
-0@@ -1200,6 +1201,14 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,continue ; } +/* Check separate debug information file. */ +if (dwarf_cu_info (pf->cu_die.cu,NULL , &unit_type, &cudie, + &subdie,NULL ,NULL ,NULL ))
It seems dwarf_cu_info was introduced in elfutils 0.171 which was released in June 2018. I hope all the test setups have more recent versions.
tools/perf/util/probe-finder.c static int debuginfo__find_probe_location(struct debuginfo *dbg, · line 1210
Quoted 4 lines
tools/perf/util/probe-finder.c +4
-0+continue ; + +if (unit_type == DW_UT_skeleton) + pf->cu_die = subdie;
Is this DWARF5 thing? Will it handle the previous version well? IOW wouldn't dwarf_cu_info() return fail?
Anyway I think it'd be safer to do
if (dwarf_cu_info() == 0 && unit_type == skeleton)
pf->cu_die = subdie;Thanks,
Namhyung
Quoted 7 lines
tools/perf/util/probe-finder.c +1
-1+/* Check if target file is included. */ if (pp->file) pf->fname =cu_find_realpath (&pf->cu_die, pp->file); --2.20.1
PATCH v2 1/1 perf: fix the probe finder location (.dwo files)
If the file object is compiled using -gsplit-dwarf, the probe finder location will fail.
---
Quoted 4 lines
Anyway I think it'd be safer to do
if (dwarf_cu_info() == 0 && unit_type == skeleton) pf->cu_die = subdie;
Thank you, I have modifed the patch :)
tools/perf/util/probe-finder.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
tools/perf/util/probe-finder.c +10 -1
@@ -1161,7 +1161,8 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,struct perf_probe_point *pp = &pf->pev->point;Dwarf_Off off, noff;size_t cuhl; -Dwarf_Die *diep; +Dwarf_Die *diep, cudie, subdie; +uint8_t unit_type;int ret =0 ; off =0 ;
@@ -1200,6 +1201,14 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,continue ; } +#if _ELFUTILS_VERSION >=171 +/* Check separate debug information file. */ +if (dwarf_cu_info (pf->cu_die.cu,NULL , &unit_type, + &cudie, &subdie,NULL ,NULL ,NULL ) ==0 + && unit_type == DW_UT_skeleton) + pf->cu_die = subdie; +#endif +/* Check if target file is included. */ if (pp->file) pf->fname =cu_find_realpath (&pf->cu_die, pp->file);
--
2.20.1