Commit b7cb10e7 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar

perf probe: Print debug messages using pr_*()

Use the new pr_{err,warning,debug,etc} printout methods, just
like in the kernel.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1256153646-10097-1-git-send-email-acme@redhat.com>
[ Split this patch out, to keep perf/probes separate. ]
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 43315956
...@@ -78,7 +78,7 @@ static int parse_probepoint(const struct option *opt __used, ...@@ -78,7 +78,7 @@ static int parse_probepoint(const struct option *opt __used,
if (!str) /* The end of probe points */ if (!str) /* The end of probe points */
return 0; return 0;
eprintf("probe-definition(%d): %s\n", session.nr_probe, str); pr_debug("probe-definition(%d): %s\n", session.nr_probe, str);
if (++session.nr_probe == MAX_PROBES) if (++session.nr_probe == MAX_PROBES)
semantic_error("Too many probes"); semantic_error("Too many probes");
...@@ -103,7 +103,7 @@ static int parse_probepoint(const struct option *opt __used, ...@@ -103,7 +103,7 @@ static int parse_probepoint(const struct option *opt __used,
die("strndup"); die("strndup");
if (++argc == MAX_PROBE_ARGS) if (++argc == MAX_PROBE_ARGS)
semantic_error("Too many arguments"); semantic_error("Too many arguments");
eprintf("argv[%d]=%s\n", argc, argv[argc - 1]); pr_debug("argv[%d]=%s\n", argc, argv[argc - 1]);
} }
} while (*str != '\0'); } while (*str != '\0');
if (argc < 2) if (argc < 2)
...@@ -133,7 +133,7 @@ static int parse_probepoint(const struct option *opt __used, ...@@ -133,7 +133,7 @@ static int parse_probepoint(const struct option *opt __used,
pp->line = atoi(ptr); pp->line = atoi(ptr);
if (!pp->file || !pp->line) if (!pp->file || !pp->line)
semantic_error("Failed to parse line."); semantic_error("Failed to parse line.");
eprintf("file:%s line:%d\n", pp->file, pp->line); pr_debug("file:%s line:%d\n", pp->file, pp->line);
} else { } else {
/* Function name */ /* Function name */
ptr = strchr(arg, '+'); ptr = strchr(arg, '+');
...@@ -150,7 +150,7 @@ static int parse_probepoint(const struct option *opt __used, ...@@ -150,7 +150,7 @@ static int parse_probepoint(const struct option *opt __used,
pp->file = strdup(ptr); pp->file = strdup(ptr);
} }
pp->function = strdup(arg); pp->function = strdup(arg);
eprintf("symbol:%s file:%s offset:%d\n", pr_debug("symbol:%s file:%s offset:%d\n",
pp->function, pp->file, pp->offset); pp->function, pp->file, pp->offset);
} }
free(argv[1]); free(argv[1]);
...@@ -175,7 +175,7 @@ static int parse_probepoint(const struct option *opt __used, ...@@ -175,7 +175,7 @@ static int parse_probepoint(const struct option *opt __used,
session.need_dwarf = 1; session.need_dwarf = 1;
} }
eprintf("%d arguments\n", pp->nr_args); pr_debug("%d arguments\n", pp->nr_args);
return 0; return 0;
} }
...@@ -188,7 +188,7 @@ static int open_default_vmlinux(void) ...@@ -188,7 +188,7 @@ static int open_default_vmlinux(void)
ret = uname(&uts); ret = uname(&uts);
if (ret) { if (ret) {
eprintf("uname() failed.\n"); pr_debug("uname() failed.\n");
return -errno; return -errno;
} }
session.release = uts.release; session.release = uts.release;
...@@ -196,12 +196,12 @@ static int open_default_vmlinux(void) ...@@ -196,12 +196,12 @@ static int open_default_vmlinux(void)
ret = snprintf(fname, MAX_PATH_LEN, ret = snprintf(fname, MAX_PATH_LEN,
default_search_path[i], session.release); default_search_path[i], session.release);
if (ret >= MAX_PATH_LEN || ret < 0) { if (ret >= MAX_PATH_LEN || ret < 0) {
eprintf("Filename(%d,%s) is too long.\n", i, pr_debug("Filename(%d,%s) is too long.\n", i,
uts.release); uts.release);
errno = E2BIG; errno = E2BIG;
return -E2BIG; return -E2BIG;
} }
eprintf("try to open %s\n", fname); pr_debug("try to open %s\n", fname);
fd = open(fname, O_RDONLY); fd = open(fname, O_RDONLY);
if (fd >= 0) if (fd >= 0)
break; break;
...@@ -341,7 +341,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) ...@@ -341,7 +341,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
ret = find_probepoint(fd, pp); ret = find_probepoint(fd, pp);
if (ret <= 0) if (ret <= 0)
die("No probe point found.\n"); die("No probe point found.\n");
eprintf("probe event %s found\n", session.events[j]); pr_debug("probe event %s found\n", session.events[j]);
} }
close(fd); close(fd);
......
...@@ -136,7 +136,7 @@ static Dwarf_Unsigned die_get_fileno(Dwarf_Die cu_die, const char *fname) ...@@ -136,7 +136,7 @@ static Dwarf_Unsigned die_get_fileno(Dwarf_Die cu_die, const char *fname)
dwarf_dealloc(__dw_debug, srcs, DW_DLA_LIST); dwarf_dealloc(__dw_debug, srcs, DW_DLA_LIST);
} }
if (found) if (found)
eprintf("found fno: %d\n", (int)found); pr_debug("found fno: %d\n", (int)found);
return found; return found;
} }
...@@ -442,7 +442,7 @@ static void find_variable(Dwarf_Die sp_die, struct probe_finder *pf) ...@@ -442,7 +442,7 @@ static void find_variable(Dwarf_Die sp_die, struct probe_finder *pf)
return ; return ;
} }
eprintf("Searching '%s' variable in context.\n", pf->var); pr_debug("Searching '%s' variable in context.\n", pf->var);
/* Search child die for local variables and parameters. */ /* Search child die for local variables and parameters. */
ret = search_die_from_children(sp_die, variable_callback, pf); ret = search_die_from_children(sp_die, variable_callback, pf);
if (!ret) if (!ret)
...@@ -552,7 +552,7 @@ static void find_by_line(Dwarf_Die cu_die, struct probe_finder *pf) ...@@ -552,7 +552,7 @@ static void find_by_line(Dwarf_Die cu_die, struct probe_finder *pf)
ret = dwarf_lineaddr(lines[i], &addr, &__dw_error); ret = dwarf_lineaddr(lines[i], &addr, &__dw_error);
DIE_IF(ret != DW_DLV_OK); DIE_IF(ret != DW_DLV_OK);
eprintf("Probe point found: 0x%llx\n", addr); pr_debug("Probe point found: 0x%llx\n", addr);
pf->addr = addr; pf->addr = addr;
/* Search a real subprogram including this line, */ /* Search a real subprogram including this line, */
ret = search_die_from_children(cu_die, probeaddr_callback, pf); ret = search_die_from_children(cu_die, probeaddr_callback, pf);
...@@ -583,7 +583,7 @@ static int probefunc_callback(struct die_link *dlink, void *data) ...@@ -583,7 +583,7 @@ static int probefunc_callback(struct die_link *dlink, void *data)
&pf->inl_offs, &pf->inl_offs,
&__dw_error); &__dw_error);
DIE_IF(ret != DW_DLV_OK); DIE_IF(ret != DW_DLV_OK);
eprintf("inline definition offset %lld\n", pr_debug("inline definition offset %lld\n",
pf->inl_offs); pf->inl_offs);
return 0; return 0;
} }
...@@ -599,7 +599,7 @@ static int probefunc_callback(struct die_link *dlink, void *data) ...@@ -599,7 +599,7 @@ static int probefunc_callback(struct die_link *dlink, void *data)
/* Get probe address */ /* Get probe address */
pf->addr = die_get_entrypc(dlink->die); pf->addr = die_get_entrypc(dlink->die);
pf->addr += pp->offset; pf->addr += pp->offset;
eprintf("found inline addr: 0x%llx\n", pf->addr); pr_debug("found inline addr: 0x%llx\n", pf->addr);
/* Inlined function. Get a real subprogram */ /* Inlined function. Get a real subprogram */
for (lk = dlink->parent; lk != NULL; lk = lk->parent) { for (lk = dlink->parent; lk != NULL; lk = lk->parent) {
tag = 0; tag = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment