#include "perf.h"
#include "builtin.h"
#include "util/util.h"
+#include "util/event.h"
+#include "util/debug.h"
#include "util/parse-options.h"
#include "util/parse-events.h" /* For debugfs_path */
#include "util/probe-finder.h"
if (!str) /* The end of probe points */
return 0;
- debug("Probe-define(%d): %s\n", session.nr_probe, str);
+ eprintf("probe-definition(%d): %s\n", session.nr_probe, str);
if (++session.nr_probe == MAX_PROBES)
semantic_error("Too many probes");
die("strndup");
if (++argc == MAX_PROBE_ARGS)
semantic_error("Too many arguments");
- debug("argv[%d]=%s\n", argc, argv[argc - 1]);
+ eprintf("argv[%d]=%s\n", argc, argv[argc - 1]);
}
} while (*str != '\0');
if (argc < 2)
pp->line = atoi(ptr);
if (!pp->file || !pp->line)
semantic_error("Failed to parse line.");
- debug("file:%s line:%d\n", pp->file, pp->line);
+ eprintf("file:%s line:%d\n", pp->file, pp->line);
} else {
/* Function name */
ptr = strchr(arg, '+');
pp->file = strdup(ptr);
}
pp->function = strdup(arg);
- debug("symbol:%s file:%s offset:%d\n",
+ eprintf("symbol:%s file:%s offset:%d\n",
pp->function, pp->file, pp->offset);
}
free(argv[1]);
session.need_dwarf = 1;
}
- debug("%d arguments\n", pp->nr_args);
+ eprintf("%d arguments\n", pp->nr_args);
return 0;
}
ret = uname(&uts);
if (ret) {
- debug("uname() failed.\n");
+ eprintf("uname() failed.\n");
return -errno;
}
session.release = uts.release;
ret = snprintf(fname, MAX_PATH_LEN,
default_search_path[i], session.release);
if (ret >= MAX_PATH_LEN || ret < 0) {
- debug("Filename(%d,%s) is too long.\n", i, uts.release);
+ eprintf("Filename(%d,%s) is too long.\n", i,
+ uts.release);
errno = E2BIG;
return -E2BIG;
}
- debug("try to open %s\n", fname);
+ eprintf("try to open %s\n", fname);
fd = open(fname, O_RDONLY);
if (fd >= 0)
break;
};
static const struct option options[] = {
+ OPT_BOOLEAN('v', "verbose", &verbose,
+ "be more verbose (show parsed arguments, etc)"),
#ifndef NO_LIBDWARF
OPT_STRING('k', "vmlinux", &session.vmlinux, "file",
"vmlinux/module pathname"),
ret = find_probepoint(fd, pp);
if (ret <= 0)
die("No probe point found.\n");
- debug("probe event %s found\n", session.events[j]);
+ eprintf("probe event %s found\n", session.events[j]);
}
close(fd);
#include <stdarg.h>
#include <ctype.h>
+#include "event.h"
+#include "debug.h"
#include "util.h"
#include "probe-finder.h"
dwarf_dealloc(__dw_debug, srcs, DW_DLA_LIST);
}
if (found)
- debug("found fno: %d\n", (int)found);
+ eprintf("found fno: %d\n", (int)found);
return found;
}
return ;
}
- debug("Searching '%s' variable in context.\n", pf->var);
+ eprintf("Searching '%s' variable in context.\n", pf->var);
/* Search child die for local variables and parameters. */
ret = search_die_from_children(sp_die, variable_callback, pf);
if (!ret)
ret = dwarf_lineaddr(lines[i], &addr, &__dw_error);
ERR_IF(ret != DW_DLV_OK);
- debug("Probe point found: 0x%llx\n", addr);
+ eprintf("Probe point found: 0x%llx\n", addr);
pf->addr = addr;
/* Search a real subprogram including this line, */
ret = search_die_from_children(cu_die, probeaddr_callback, pf);
&pf->inl_offs,
&__dw_error);
ERR_IF(ret != DW_DLV_OK);
- debug("inline definition offset %lld\n",
+ eprintf("inline definition offset %lld\n",
pf->inl_offs);
return 0;
}
/* Get probe address */
pf->addr = die_get_entrypc(dlink->die);
pf->addr += pp->offset;
- debug("found inline addr: 0x%llx\n", pf->addr);
+ eprintf("found inline addr: 0x%llx\n", pf->addr);
/* Inlined function. Get a real subprogram */
for (lk = dlink->parent; lk != NULL; lk = lk->parent) {
tag = 0;