path: root/tools/perf/builtin-probe.c
diff options
authorMasami Hiramatsu <>2015-10-02 21:58:32 +0900
committerArnaldo Carvalho de Melo <>2015-10-02 15:59:23 -0300
commit1a8ac29cbffc261f6d7c92e573878110a7dcbd94 (patch)
treea03dbd5c53ed99b1b804e8039533b30a25b645b0 /tools/perf/builtin-probe.c
parentfa52ceabc2a3e70431a82bca2bc547a15eaf19df (diff)
perf probe: Allow probing on kmodules without dwarf
Allow probing on kernel modules when 'perf' is built without debuginfo support. Currently perf-probe --module requires linking with libdw, but this doesn't make sense. E.g. ---- # make NO_DWARF=1 # ./perf probe -m pcspkr pcspkr_event%return Error: unknown switch `m' ---- With this patch ---- # ./perf probe -m pcspkr pcspkr_event%return Added new event: probe:pcspkr_event (on pcspkr_event%return in pcspkr) You can now use it in all perf tools, such as: perf record -e probe:pcspkr_event -aR sleep 1 ---- Signed-off-by: Masami Hiramatsu <> Cc: Jiri Olsa <> Cc: Namhyung Kim <> Cc: Wang Nan <> Link: Signed-off-by: Arnaldo Carvalho de Melo <>
Diffstat (limited to 'tools/perf/builtin-probe.c')
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index f7882ae9ebc6..530c3a28a58c 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -182,10 +182,8 @@ static int opt_set_target(const struct option *opt, const char *str,
if (str) {
if (!strcmp(opt->long_name, "exec"))
params.uprobes = true;
else if (!strcmp(opt->long_name, "module"))
params.uprobes = false;
return ret;
@@ -490,9 +488,6 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
"file", "vmlinux pathname"),
OPT_STRING('s', "source", &symbol_conf.source_prefix,
"directory", "path to kernel source"),
- OPT_CALLBACK('m', "module", NULL, "modname|path",
- "target module name (for online) or path (for offline)",
- opt_set_target),
OPT_BOOLEAN('\0', "no-inlines", &probe_conf.no_inlines,
"Don't search inlined functions"),
@@ -509,6 +504,9 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_CALLBACK('x', "exec", NULL, "executable|path",
"target executable name or path", opt_set_target),
+ OPT_CALLBACK('m', "module", NULL, "modname|path",
+ "target module name (for online) or path (for offline)",
+ opt_set_target),
OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle,
"Enable symbol demangling"),
OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,