Skip to content
/ linux Public

Commit 2edbcd5

Browse files
captain5050Sasha Levin
authored andcommitted
perf callchain: Fix srcline printing with inlines
[ Upstream commit abec464 ] sample__fprintf_callchain() was using map__fprintf_srcline() which won't report inline line numbers. Fix by using the srcline from the callchain and falling back to the map variant. Fixes: 25da4fa ("perf evsel: Move fprintf methods to separate source file") Reviewed-by: James Clark <james.clark@linaro.org> Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Howard Chu <howardchu95@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephen Brennan <stephen.s.brennan@oracle.com> Cc: Tony Jones <tonyj@suse.de> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ccfafeb commit 2edbcd5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/perf/util/evsel_fprintf.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,12 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
180180
if (print_dso && (!sym || !sym->inlined))
181181
printed += map__fprintf_dsoname_dsoff(map, print_dsoff, addr, fp);
182182

183-
if (print_srcline)
184-
printed += map__fprintf_srcline(map, addr, "\n ", fp);
183+
if (print_srcline) {
184+
if (node->srcline)
185+
printed += fprintf(fp, "\n %s", node->srcline);
186+
else
187+
printed += map__fprintf_srcline(map, addr, "\n ", fp);
188+
}
185189

186190
if (sym && sym->inlined)
187191
printed += fprintf(fp, " (inlined)");

0 commit comments

Comments
 (0)