perf probe: Fix multiple --vars options behavior
Masami Hiramatsu [Wed, 30 Mar 2011 09:25:53 +0000 (18:25 +0900)]
Fix a bug that perf-probe fails to initialize libdwfl and shows incorrect error
when user gives multiple --vars options.

Cc: 2nddept-manager@sdl.hitachi.co.jp
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <20110330092553.2132.42691.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

tools/perf/util/probe-event.c

index a372d74..f022316 100644 (file)
@@ -510,18 +510,18 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
        if (ret < 0)
                return ret;
 
-       fd = open_vmlinux(module);
-       if (fd < 0) {
-               pr_warning("Failed to open debug information file.\n");
-               return fd;
-       }
-
        setup_pager();
 
-       for (i = 0; i < npevs && ret >= 0; i++)
+       for (i = 0; i < npevs && ret >= 0; i++) {
+               fd = open_vmlinux(module);
+               if (fd < 0) {
+                       pr_warning("Failed to open debug information file.\n");
+                       ret = fd;
+                       break;
+               }
                ret = show_available_vars_at(fd, &pevs[i], max_vls, _filter,
                                             externs);
-
+       }
        return ret;
 }