builtin-probe.c (c82ec0a2bd7725a2d2ac3065d8cde13e1f717d3c) builtin-probe.c (fb8c5a56c7ddbc2b0d2ee7a8da60fe1355f75141)
1/*
2 * builtin-probe.c
3 *
4 * Builtin probe command: Set up probe events by C expression
5 *
6 * Written by Masami Hiramatsu <mhiramat@redhat.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 37 unchanged lines hidden (view full) ---

46#define MAX_PATH_LEN 256
47
48/* Session management structure */
49static struct {
50 bool list_events;
51 bool force_add;
52 bool show_lines;
53 bool show_vars;
1/*
2 * builtin-probe.c
3 *
4 * Builtin probe command: Set up probe events by C expression
5 *
6 * Written by Masami Hiramatsu <mhiramat@redhat.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 37 unchanged lines hidden (view full) ---

46#define MAX_PATH_LEN 256
47
48/* Session management structure */
49static struct {
50 bool list_events;
51 bool force_add;
52 bool show_lines;
53 bool show_vars;
54 bool show_ext_vars;
54 bool mod_events;
55 int nevents;
56 struct perf_probe_event events[MAX_PROBES];
57 struct strlist *dellist;
58 struct line_range line_range;
59 int max_probe_points;
60} params;
61

--- 95 unchanged lines hidden (view full) ---

157
158static const char * const probe_usage[] = {
159 "perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]",
160 "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
161 "perf probe [<options>] --del '[GROUP:]EVENT' ...",
162 "perf probe --list",
163#ifdef DWARF_SUPPORT
164 "perf probe --line 'LINEDESC'",
55 bool mod_events;
56 int nevents;
57 struct perf_probe_event events[MAX_PROBES];
58 struct strlist *dellist;
59 struct line_range line_range;
60 int max_probe_points;
61} params;
62

--- 95 unchanged lines hidden (view full) ---

158
159static const char * const probe_usage[] = {
160 "perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]",
161 "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
162 "perf probe [<options>] --del '[GROUP:]EVENT' ...",
163 "perf probe --list",
164#ifdef DWARF_SUPPORT
165 "perf probe --line 'LINEDESC'",
165 "perf probe --vars 'PROBEPOINT'",
166 "perf probe [--externs] --vars 'PROBEPOINT'",
166#endif
167 NULL
168};
169
170static const struct option options[] = {
171 OPT_INCR('v', "verbose", &verbose,
172 "be more verbose (show parsed arguments, etc)"),
173 OPT_BOOLEAN('l', "list", &params.list_events,

--- 28 unchanged lines hidden (view full) ---

202 " with existing name"),
203#ifdef DWARF_SUPPORT
204 OPT_CALLBACK('L', "line", NULL,
205 "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
206 "Show source code lines.", opt_show_lines),
207 OPT_CALLBACK('V', "vars", NULL,
208 "FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT",
209 "Show accessible variables on PROBEDEF", opt_show_vars),
167#endif
168 NULL
169};
170
171static const struct option options[] = {
172 OPT_INCR('v', "verbose", &verbose,
173 "be more verbose (show parsed arguments, etc)"),
174 OPT_BOOLEAN('l', "list", &params.list_events,

--- 28 unchanged lines hidden (view full) ---

203 " with existing name"),
204#ifdef DWARF_SUPPORT
205 OPT_CALLBACK('L', "line", NULL,
206 "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
207 "Show source code lines.", opt_show_lines),
208 OPT_CALLBACK('V', "vars", NULL,
209 "FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT",
210 "Show accessible variables on PROBEDEF", opt_show_vars),
211 OPT_BOOLEAN('\0', "externs", &params.show_ext_vars,
212 "Show external variables too (with --vars only)"),
210 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
211 "file", "vmlinux pathname"),
212 OPT_STRING('s', "source", &symbol_conf.source_prefix,
213 "directory", "path to kernel source"),
214#endif
215 OPT__DRY_RUN(&probe_event_dry_run),
216 OPT_INTEGER('\0', "max-probes", &params.max_probe_points,
217 "Set how many probe points can be found for a probe."),

--- 64 unchanged lines hidden (view full) ---

282 }
283 if (params.show_vars) {
284 if (params.mod_events) {
285 pr_err(" Error: Don't use --vars with"
286 " --add/--del.\n");
287 usage_with_options(probe_usage, options);
288 }
289 ret = show_available_vars(params.events, params.nevents,
213 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
214 "file", "vmlinux pathname"),
215 OPT_STRING('s', "source", &symbol_conf.source_prefix,
216 "directory", "path to kernel source"),
217#endif
218 OPT__DRY_RUN(&probe_event_dry_run),
219 OPT_INTEGER('\0', "max-probes", &params.max_probe_points,
220 "Set how many probe points can be found for a probe."),

--- 64 unchanged lines hidden (view full) ---

285 }
286 if (params.show_vars) {
287 if (params.mod_events) {
288 pr_err(" Error: Don't use --vars with"
289 " --add/--del.\n");
290 usage_with_options(probe_usage, options);
291 }
292 ret = show_available_vars(params.events, params.nevents,
290 params.max_probe_points);
293 params.max_probe_points,
294 params.show_ext_vars);
291 if (ret < 0)
292 pr_err(" Error: Failed to show vars. (%d)\n", ret);
293 return ret;
294 }
295#endif
296
297 if (params.dellist) {
298 ret = del_perf_probe_events(params.dellist);

--- 18 unchanged lines hidden ---
295 if (ret < 0)
296 pr_err(" Error: Failed to show vars. (%d)\n", ret);
297 return ret;
298 }
299#endif
300
301 if (params.dellist) {
302 ret = del_perf_probe_events(params.dellist);

--- 18 unchanged lines hidden ---