diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-03-22 12:10:26 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-22 13:47:35 -0400 |
commit | 4b4da7f76660ea8b5aa45615165c48f62167ffa8 (patch) | |
tree | 927274cf9fe9fca657983f4a5d3d3a91a40a051b /tools/perf/builtin-probe.c | |
parent | f3a1f0ea9432ec395cd112f42201e8e523c07bc5 (diff) |
perf probe: Cleanup debuginfo related code
Cleanup debuginfo related code to eliminate fragile code which
pointed by Ingo (Thanks!).
1) Invert logic of NO_DWARF_SUPPORT to DWARF_SUPPORT.
2) For removing assymetric/local variable ifdefs, introduce
more helper functions.
3) Change options order to reduce the number of ifdefs.
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1269274229-20442-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r-- | tools/perf/builtin-probe.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index e0dafd9dfeb5..cf2ffa5a3842 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -109,7 +109,7 @@ static int opt_del_probe_event(const struct option *opt __used, | |||
109 | return 0; | 109 | return 0; |
110 | } | 110 | } |
111 | 111 | ||
112 | #ifndef NO_DWARF_SUPPORT | 112 | #ifdef DWARF_SUPPORT |
113 | static int opt_show_lines(const struct option *opt __used, | 113 | static int opt_show_lines(const struct option *opt __used, |
114 | const char *str, int unset __used) | 114 | const char *str, int unset __used) |
115 | { | 115 | { |
@@ -126,7 +126,7 @@ static const char * const probe_usage[] = { | |||
126 | "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", | 126 | "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", |
127 | "perf probe [<options>] --del '[GROUP:]EVENT' ...", | 127 | "perf probe [<options>] --del '[GROUP:]EVENT' ...", |
128 | "perf probe --list", | 128 | "perf probe --list", |
129 | #ifndef NO_DWARF_SUPPORT | 129 | #ifdef DWARF_SUPPORT |
130 | "perf probe --line 'LINEDESC'", | 130 | "perf probe --line 'LINEDESC'", |
131 | #endif | 131 | #endif |
132 | NULL | 132 | NULL |
@@ -135,20 +135,16 @@ static const char * const probe_usage[] = { | |||
135 | static const struct option options[] = { | 135 | static const struct option options[] = { |
136 | OPT_BOOLEAN('v', "verbose", &verbose, | 136 | OPT_BOOLEAN('v', "verbose", &verbose, |
137 | "be more verbose (show parsed arguments, etc)"), | 137 | "be more verbose (show parsed arguments, etc)"), |
138 | #ifndef NO_DWARF_SUPPORT | ||
139 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, | ||
140 | "file", "vmlinux pathname"), | ||
141 | #endif | ||
142 | OPT_BOOLEAN('l', "list", ¶ms.list_events, | 138 | OPT_BOOLEAN('l', "list", ¶ms.list_events, |
143 | "list up current probe events"), | 139 | "list up current probe events"), |
144 | OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.", | 140 | OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.", |
145 | opt_del_probe_event), | 141 | opt_del_probe_event), |
146 | OPT_CALLBACK('a', "add", NULL, | 142 | OPT_CALLBACK('a', "add", NULL, |
147 | #ifdef NO_DWARF_SUPPORT | 143 | #ifdef DWARF_SUPPORT |
148 | "[EVENT=]FUNC[+OFF|%return] [ARG ...]", | ||
149 | #else | ||
150 | "[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT" | 144 | "[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT" |
151 | " [ARG ...]", | 145 | " [ARG ...]", |
146 | #else | ||
147 | "[EVENT=]FUNC[+OFF|%return] [ARG ...]", | ||
152 | #endif | 148 | #endif |
153 | "probe point definition, where\n" | 149 | "probe point definition, where\n" |
154 | "\t\tGROUP:\tGroup name (optional)\n" | 150 | "\t\tGROUP:\tGroup name (optional)\n" |
@@ -156,23 +152,25 @@ static const struct option options[] = { | |||
156 | "\t\tFUNC:\tFunction name\n" | 152 | "\t\tFUNC:\tFunction name\n" |
157 | "\t\tOFF:\tOffset from function entry (in byte)\n" | 153 | "\t\tOFF:\tOffset from function entry (in byte)\n" |
158 | "\t\t%return:\tPut the probe at function return\n" | 154 | "\t\t%return:\tPut the probe at function return\n" |
159 | #ifdef NO_DWARF_SUPPORT | 155 | #ifdef DWARF_SUPPORT |
160 | "\t\tARG:\tProbe argument (only \n" | ||
161 | #else | ||
162 | "\t\tSRC:\tSource code path\n" | 156 | "\t\tSRC:\tSource code path\n" |
163 | "\t\tRL:\tRelative line number from function entry.\n" | 157 | "\t\tRL:\tRelative line number from function entry.\n" |
164 | "\t\tAL:\tAbsolute line number in file.\n" | 158 | "\t\tAL:\tAbsolute line number in file.\n" |
165 | "\t\tPT:\tLazy expression of line code.\n" | 159 | "\t\tPT:\tLazy expression of line code.\n" |
166 | "\t\tARG:\tProbe argument (local variable name or\n" | 160 | "\t\tARG:\tProbe argument (local variable name or\n" |
167 | #endif | ||
168 | "\t\t\tkprobe-tracer argument format.)\n", | 161 | "\t\t\tkprobe-tracer argument format.)\n", |
162 | #else | ||
163 | "\t\tARG:\tProbe argument (kprobe-tracer argument format.)\n", | ||
164 | #endif | ||
169 | opt_add_probe_event), | 165 | opt_add_probe_event), |
170 | OPT_BOOLEAN('f', "force", ¶ms.force_add, "forcibly add events" | 166 | OPT_BOOLEAN('f', "force", ¶ms.force_add, "forcibly add events" |
171 | " with existing name"), | 167 | " with existing name"), |
172 | #ifndef NO_DWARF_SUPPORT | 168 | #ifdef DWARF_SUPPORT |
173 | OPT_CALLBACK('L', "line", NULL, | 169 | OPT_CALLBACK('L', "line", NULL, |
174 | "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]", | 170 | "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]", |
175 | "Show source code lines.", opt_show_lines), | 171 | "Show source code lines.", opt_show_lines), |
172 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, | ||
173 | "file", "vmlinux pathname"), | ||
176 | #endif | 174 | #endif |
177 | OPT__DRY_RUN(&probe_event_dry_run), | 175 | OPT__DRY_RUN(&probe_event_dry_run), |
178 | OPT_END() | 176 | OPT_END() |
@@ -211,7 +209,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
211 | return 0; | 209 | return 0; |
212 | } | 210 | } |
213 | 211 | ||
214 | #ifndef NO_DWARF_SUPPORT | 212 | #ifdef DWARF_SUPPORT |
215 | if (params.show_lines) { | 213 | if (params.show_lines) { |
216 | if (params.nevents != 0 || params.dellist) { | 214 | if (params.nevents != 0 || params.dellist) { |
217 | pr_warning(" Error: Don't use --line with" | 215 | pr_warning(" Error: Don't use --line with" |