From: Jiri Olsa Date: Mon, 10 Sep 2012 16:50:16 +0000 (+0200) Subject: perf tools: Do backtrace post unwind only if we regs and stack were captured X-Git-Tag: next-20120917~37^2~8^2^2~9 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bdde37163e1fd474509aab90f5eaacee46100107;p=karo-tx-linux.git perf tools: Do backtrace post unwind only if we regs and stack were captured Bail out without error if we want to do backtrace post unwind, but were not able to capture user registers or user stack during the record phase, which is possible and valid case. Signed-off-by: Jiri Olsa Cc: Frederic Weisbecker Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1347295819-23177-2-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 3806ea49f1f7..0ecd62be2091 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -388,6 +388,11 @@ int machine__resolve_callchain(struct machine *machine, (evsel->attr.sample_type & PERF_SAMPLE_STACK_USER))) return 0; + /* Bail out if nothing was captured. */ + if ((!sample->user_regs.regs) || + (!sample->user_stack.size)) + return 0; + return unwind__get_entries(unwind_entry, &callchain_cursor, machine, thread, evsel->attr.sample_regs_user, sample);