diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-probe.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 2df23e177da5..f7b1af67e9f6 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -56,6 +56,7 @@ static struct { | |||
56 | bool mod_events; | 56 | bool mod_events; |
57 | bool uprobes; | 57 | bool uprobes; |
58 | bool quiet; | 58 | bool quiet; |
59 | bool target_used; | ||
59 | int nevents; | 60 | int nevents; |
60 | struct perf_probe_event events[MAX_PROBES]; | 61 | struct perf_probe_event events[MAX_PROBES]; |
61 | struct strlist *dellist; | 62 | struct strlist *dellist; |
@@ -82,6 +83,7 @@ static int parse_probe_event(const char *str) | |||
82 | pev->target = strdup(params.target); | 83 | pev->target = strdup(params.target); |
83 | if (!pev->target) | 84 | if (!pev->target) |
84 | return -ENOMEM; | 85 | return -ENOMEM; |
86 | params.target_used = true; | ||
85 | } | 87 | } |
86 | 88 | ||
87 | /* Parse a perf-probe command into event */ | 89 | /* Parse a perf-probe command into event */ |
@@ -107,6 +109,7 @@ static int set_target(const char *ptr) | |||
107 | params.target = strdup(ptr); | 109 | params.target = strdup(ptr); |
108 | if (!params.target) | 110 | if (!params.target) |
109 | return -ENOMEM; | 111 | return -ENOMEM; |
112 | params.target_used = false; | ||
110 | 113 | ||
111 | found = 1; | 114 | found = 1; |
112 | buf = ptr + (strlen(ptr) - 3); | 115 | buf = ptr + (strlen(ptr) - 3); |
@@ -207,6 +210,7 @@ static int opt_set_target(const struct option *opt, const char *str, | |||
207 | } | 210 | } |
208 | free(params.target); | 211 | free(params.target); |
209 | params.target = tmp; | 212 | params.target = tmp; |
213 | params.target_used = false; | ||
210 | ret = 0; | 214 | ret = 0; |
211 | } | 215 | } |
212 | 216 | ||
@@ -491,6 +495,12 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
491 | } | 495 | } |
492 | 496 | ||
493 | if (params.nevents) { | 497 | if (params.nevents) { |
498 | /* Ensure the last given target is used */ | ||
499 | if (params.target && !params.target_used) { | ||
500 | pr_warning(" Error: -x/-m must follow the probe definitions.\n"); | ||
501 | usage_with_options(probe_usage, options); | ||
502 | } | ||
503 | |||
494 | ret = add_perf_probe_events(params.events, params.nevents, | 504 | ret = add_perf_probe_events(params.events, params.nevents, |
495 | params.max_probe_points, | 505 | params.max_probe_points, |
496 | params.force_add); | 506 | params.force_add); |