perf probe: Show need-dwarf message only if it is really needed
Masami Hiramatsu [Tue, 15 Dec 2009 15:31:35 +0000 (10:31 -0500)]
Show need-dwarf message only if the probe is really requires
debuginfo analysis. This also use pr_debug for debugging message
instead of pr_warning.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091215153135.17436.99052.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

tools/perf/builtin-probe.c
tools/perf/util/probe-finder.c

index 919037b..438a7bb 100644 (file)
@@ -261,15 +261,19 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
 
                lseek(fd, SEEK_SET, 0);
                ret = find_probepoint(fd, pp);
-               if (ret < 0) {
-                       if (session.need_dwarf)
-                               die("Could not analyze debuginfo.");
-
-                       pr_warning("An error occurred in debuginfo analysis. Try to use symbols.\n");
-                       break;
-               }
+               if (ret > 0)
+                       continue;
                if (ret == 0)   /* No error but failed to find probe point. */
                        die("No probe point found.");
+               /* Error path */
+               if (session.need_dwarf) {
+                       if (ret == -ENOENT)
+                               pr_warning("No dwarf info found in the vmlinux - please rebuild with CONFIG_DEBUG_INFO=y.\n");
+                       die("Could not analyze debuginfo.");
+               }
+               pr_debug("An error occurred in debuginfo analysis."
+                        " Try to use symbols.\n");
+               break;
        }
        close(fd);
 
index 4585f1d..4b852c0 100644 (file)
@@ -687,10 +687,8 @@ int find_probepoint(int fd, struct probe_point *pp)
        struct probe_finder pf = {.pp = pp};
 
        ret = dwarf_init(fd, DW_DLC_READ, 0, 0, &__dw_debug, &__dw_error);
-       if (ret != DW_DLV_OK) {
-               pr_warning("No dwarf info found in the vmlinux - please rebuild with CONFIG_DEBUG_INFO.\n");
+       if (ret != DW_DLV_OK)
                return -ENOENT;
-       }
 
        pp->found = 0;
        while (++cu_number) {