perf report: Fix return value when loading PE DSO
PATCH 4/4 perf report: Fix return value when loading PE DSO
The first time dso__load() was called on a PE file it always returned -1 error. This caused the first call to map__find_symbol() to always fail on a PE file so the first sample from each PE file always had symbol <unknown>. Subsequent samples succeed however because the DSO is already loaded.
This fixes dso__load() to return 0 when successfully loading a DSO with libbfd.
--- tools/perf/util/symbol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/symbol.c +3 -1
@@ -1861,8 +1861,10 @@ int dso__load(struct dso *dso, struct map *map)if (nsexit)nsinfo__mountns_enter (dso->nsinfo, &nsc); -if (bfdrc ==0 ) +if (bfdrc ==0 ) { + ret =0 ;break ; + }if (!is_reg || sirc <0 )continue ;
Signature · 1 line
2.30.0
Arnaldo Carvalho de Melo
maintainerEm Wed, Feb 10, 2021 at 02:18:02PM -0500, Nicholas Fraser escreveu:
Quoted 8 lines
The first time
dso__load()was called on a PE file it always returned -1 error. This caused the first call tomap__find_symbol()to always fail on a PE file so the first sample from each PE file always had symbol <unknown>. Subsequent samples succeed however because the DSO is already loaded.This fixes
dso__load()to return 0 when successfully loading a DSO with libbfd.
You forgot to add this:
This helps, for instance, the [email protected] guys, since their scripts will scrape this and find that it should also go to whatever stable releases are based on:
$ git tag --contains eac9a4342e5447ca | grep ^v[45].* | grep -v -- -rc v5.10 $
Applied and added the Fixes tag,
- Arnaldo
Quoted 24 lines
Signed-off-by Nicholas Fraser <[email protected]>--- tools/perf/util/symbol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/perf/util/symbol.c +3
-1@@ -1861,8 +1861,10 @@ int dso__load(struct dso *dso, struct map *map)if (nsexit)nsinfo__mountns_enter (dso->nsinfo, &nsc); -if (bfdrc ==0 ) +if (bfdrc ==0 ) { + ret =0 ;break ; + }if (!is_reg || sirc <0 )continue ;Signature · 1 line
2.30.0
Signature · 1 line
- Arnaldo