aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-probe.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-02-25 08:35:42 -0500
committerIngo Molnar <mingo@elte.hu>2010-02-25 11:49:29 -0500
commit804b36068eccd8163ccea420c662fb5d1a21b141 (patch)
tree08837b6d7be24d56c30af2932e59fa1c23420396 /tools/perf/builtin-probe.c
parent81cb8aa327b5923b38eccc795c8b7170be20b9ff (diff)
perf probe: Use elfutils-libdw for analyzing debuginfo
Newer gcc introduces newer & richer debuginfo, and only libdw in elfutils project can support it. So perf probe moves onto elfutils-libdw from libdwarf. Changes in v3: - Cast Dwarf_Addr/Dwarf_Word to uintmax_t for printf-formats. - Recover a sign-prefix which was removed in v2 by mistake. Changes in v2: - Fix a type-casting bug in Makefile. - Cast Dwarf_Addr/Dwarf_Word to unsigned long long for printf-formats. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Mike Galbraith <efault@gmx.de> Cc: K.Prasad <prasad@linux.vnet.ibm.com> Cc: Ulrich Drepper <drepper@redhat.com> Cc: Roland McGrath <roland@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> LKML-Reference: <20100225133542.6725.34724.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r--tools/perf/builtin-probe.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index c3e61194f4c6..d8d3f0525895 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -128,7 +128,7 @@ static void evaluate_probe_point(struct probe_point *pp)
128 pp->function); 128 pp->function);
129} 129}
130 130
131#ifndef NO_LIBDWARF 131#ifndef NO_DWARF_SUPPORT
132static int open_vmlinux(void) 132static int open_vmlinux(void)
133{ 133{
134 if (map__load(session.kmaps[MAP__FUNCTION], NULL) < 0) { 134 if (map__load(session.kmaps[MAP__FUNCTION], NULL) < 0) {
@@ -156,7 +156,7 @@ static const char * const probe_usage[] = {
156 "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", 156 "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
157 "perf probe [<options>] --del '[GROUP:]EVENT' ...", 157 "perf probe [<options>] --del '[GROUP:]EVENT' ...",
158 "perf probe --list", 158 "perf probe --list",
159#ifndef NO_LIBDWARF 159#ifndef NO_DWARF_SUPPORT
160 "perf probe --line 'LINEDESC'", 160 "perf probe --line 'LINEDESC'",
161#endif 161#endif
162 NULL 162 NULL
@@ -165,7 +165,7 @@ static const char * const probe_usage[] = {
165static const struct option options[] = { 165static const struct option options[] = {
166 OPT_BOOLEAN('v', "verbose", &verbose, 166 OPT_BOOLEAN('v', "verbose", &verbose,
167 "be more verbose (show parsed arguments, etc)"), 167 "be more verbose (show parsed arguments, etc)"),
168#ifndef NO_LIBDWARF 168#ifndef NO_DWARF_SUPPORT
169 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, 169 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
170 "file", "vmlinux pathname"), 170 "file", "vmlinux pathname"),
171#endif 171#endif
@@ -174,7 +174,7 @@ static const struct option options[] = {
174 OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.", 174 OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.",
175 opt_del_probe_event), 175 opt_del_probe_event),
176 OPT_CALLBACK('a', "add", NULL, 176 OPT_CALLBACK('a', "add", NULL,
177#ifdef NO_LIBDWARF 177#ifdef NO_DWARF_SUPPORT
178 "[EVENT=]FUNC[+OFFS|%return] [ARG ...]", 178 "[EVENT=]FUNC[+OFFS|%return] [ARG ...]",
179#else 179#else
180 "[EVENT=]FUNC[+OFFS|%return|:RLN][@SRC]|SRC:ALN [ARG ...]", 180 "[EVENT=]FUNC[+OFFS|%return|:RLN][@SRC]|SRC:ALN [ARG ...]",
@@ -185,7 +185,7 @@ static const struct option options[] = {
185 "\t\tFUNC:\tFunction name\n" 185 "\t\tFUNC:\tFunction name\n"
186 "\t\tOFFS:\tOffset from function entry (in byte)\n" 186 "\t\tOFFS:\tOffset from function entry (in byte)\n"
187 "\t\t%return:\tPut the probe at function return\n" 187 "\t\t%return:\tPut the probe at function return\n"
188#ifdef NO_LIBDWARF 188#ifdef NO_DWARF_SUPPORT
189 "\t\tARG:\tProbe argument (only \n" 189 "\t\tARG:\tProbe argument (only \n"
190#else 190#else
191 "\t\tSRC:\tSource code path\n" 191 "\t\tSRC:\tSource code path\n"
@@ -197,7 +197,7 @@ static const struct option options[] = {
197 opt_add_probe_event), 197 opt_add_probe_event),
198 OPT_BOOLEAN('f', "force", &session.force_add, "forcibly add events" 198 OPT_BOOLEAN('f', "force", &session.force_add, "forcibly add events"
199 " with existing name"), 199 " with existing name"),
200#ifndef NO_LIBDWARF 200#ifndef NO_DWARF_SUPPORT
201 OPT_CALLBACK('L', "line", NULL, 201 OPT_CALLBACK('L', "line", NULL,
202 "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]", 202 "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]",
203 "Show source code lines.", opt_show_lines), 203 "Show source code lines.", opt_show_lines),
@@ -225,7 +225,7 @@ static void init_vmlinux(void)
225int cmd_probe(int argc, const char **argv, const char *prefix __used) 225int cmd_probe(int argc, const char **argv, const char *prefix __used)
226{ 226{
227 int i, ret; 227 int i, ret;
228#ifndef NO_LIBDWARF 228#ifndef NO_DWARF_SUPPORT
229 int fd; 229 int fd;
230#endif 230#endif
231 struct probe_point *pp; 231 struct probe_point *pp;
@@ -261,7 +261,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
261 return 0; 261 return 0;
262 } 262 }
263 263
264#ifndef NO_LIBDWARF 264#ifndef NO_DWARF_SUPPORT
265 if (session.show_lines) { 265 if (session.show_lines) {
266 if (session.nr_probe != 0 || session.dellist) { 266 if (session.nr_probe != 0 || session.dellist) {
267 pr_warning(" Error: Don't use --line with" 267 pr_warning(" Error: Don't use --line with"
@@ -292,9 +292,9 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
292 init_vmlinux(); 292 init_vmlinux();
293 293
294 if (session.need_dwarf) 294 if (session.need_dwarf)
295#ifdef NO_LIBDWARF 295#ifdef NO_DWARF_SUPPORT
296 die("Debuginfo-analysis is not supported"); 296 die("Debuginfo-analysis is not supported");
297#else /* !NO_LIBDWARF */ 297#else /* !NO_DWARF_SUPPORT */
298 pr_debug("Some probes require debuginfo.\n"); 298 pr_debug("Some probes require debuginfo.\n");
299 299
300 fd = open_vmlinux(); 300 fd = open_vmlinux();
@@ -335,7 +335,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
335 close(fd); 335 close(fd);
336 336
337end_dwarf: 337end_dwarf:
338#endif /* !NO_LIBDWARF */ 338#endif /* !NO_DWARF_SUPPORT */
339 339
340 /* Synthesize probes without dwarf */ 340 /* Synthesize probes without dwarf */
341 for (i = 0; i < session.nr_probe; i++) { 341 for (i = 0; i < session.nr_probe; i++) {