diff options
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r-- | tools/perf/builtin-probe.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index c98ccb570509..43ff33d0007b 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -169,6 +169,7 @@ static int opt_set_target(const struct option *opt, const char *str, | |||
169 | int unset __maybe_unused) | 169 | int unset __maybe_unused) |
170 | { | 170 | { |
171 | int ret = -ENOENT; | 171 | int ret = -ENOENT; |
172 | char *tmp; | ||
172 | 173 | ||
173 | if (str && !params.target) { | 174 | if (str && !params.target) { |
174 | if (!strcmp(opt->long_name, "exec")) | 175 | if (!strcmp(opt->long_name, "exec")) |
@@ -180,7 +181,19 @@ static int opt_set_target(const struct option *opt, const char *str, | |||
180 | else | 181 | else |
181 | return ret; | 182 | return ret; |
182 | 183 | ||
183 | params.target = str; | 184 | /* Expand given path to absolute path, except for modulename */ |
185 | if (params.uprobes || strchr(str, '/')) { | ||
186 | tmp = realpath(str, NULL); | ||
187 | if (!tmp) { | ||
188 | pr_warning("Failed to get the absolute path of %s: %m\n", str); | ||
189 | return ret; | ||
190 | } | ||
191 | } else { | ||
192 | tmp = strdup(str); | ||
193 | if (!tmp) | ||
194 | return -ENOMEM; | ||
195 | } | ||
196 | params.target = tmp; | ||
184 | ret = 0; | 197 | ret = 0; |
185 | } | 198 | } |
186 | 199 | ||
@@ -411,7 +424,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
411 | } | 424 | } |
412 | 425 | ||
413 | #ifdef HAVE_DWARF_SUPPORT | 426 | #ifdef HAVE_DWARF_SUPPORT |
414 | if (params.show_lines && !params.uprobes) { | 427 | if (params.show_lines) { |
415 | if (params.mod_events) { | 428 | if (params.mod_events) { |
416 | pr_err(" Error: Don't use --line with" | 429 | pr_err(" Error: Don't use --line with" |
417 | " --add/--del.\n"); | 430 | " --add/--del.\n"); |