perf tools: Don't try to lookup objdump for live mode
authorNamhyung Kim <namhyung.kim@lge.com>
Wed, 7 Nov 2012 01:30:15 +0000 (10:30 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 8 Nov 2012 20:26:52 +0000 (17:26 -0300)
Arnaldo reported that annotation during perf top resulted in a segfault.
It was because the env->arch was NULL and we don't set it for a live
session.  In fact, no need to look up objdump in this case since we can
use system's default (native) objdump.

Reported-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Irina Tirdea <irina.tirdea@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1352251815-12615-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/common.c

index 5683529135b19857077706c753c665a9683a1c97..3e975cb6232eb97b2d14a9d4f069653727a6d649 100644 (file)
@@ -199,6 +199,13 @@ out_error:
 
 int perf_session_env__lookup_objdump(struct perf_session_env *env)
 {
+       /*
+        * For live mode, env->arch will be NULL and we can use
+        * the native objdump tool.
+        */
+       if (env->arch == NULL)
+               return 0;
+
        return perf_session_env__lookup_binutils_path(env, "objdump",
                                                      &objdump_path);
 }