diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-06-04 08:13:04 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-04 08:16:38 -0400 |
commit | bd74137ec9aaca3df3ff22b92455fddf7afaced1 (patch) | |
tree | 8b96fa45fd3104f56bb0122b6215c0e7202df825 /Documentation/perf_counter/util/symbol.c | |
parent | 95ed6fd06e52bf850cd17524f0b36ed14300c10d (diff) |
perf_counter tools: Print out symbol parsing errors only if --verbose
Also, add a suggestion to 'perf report', if the default sort order is
used.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/util/symbol.c')
-rw-r--r-- | Documentation/perf_counter/util/symbol.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c index 35ee6de1e513..15d5cf9abfac 100644 --- a/Documentation/perf_counter/util/symbol.c +++ b/Documentation/perf_counter/util/symbol.c | |||
@@ -124,7 +124,7 @@ size_t dso__fprintf(struct dso *self, FILE *fp) | |||
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | 126 | ||
127 | static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter) | 127 | static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verbose) |
128 | { | 128 | { |
129 | struct rb_node *nd, *prevnd; | 129 | struct rb_node *nd, *prevnd; |
130 | char *line = NULL; | 130 | char *line = NULL; |
@@ -370,7 +370,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, Elf *elf, | |||
370 | } | 370 | } |
371 | 371 | ||
372 | static int dso__load_sym(struct dso *self, int fd, const char *name, | 372 | static int dso__load_sym(struct dso *self, int fd, const char *name, |
373 | symbol_filter_t filter) | 373 | symbol_filter_t filter, int verbose) |
374 | { | 374 | { |
375 | Elf_Data *symstrs; | 375 | Elf_Data *symstrs; |
376 | uint32_t nr_syms; | 376 | uint32_t nr_syms; |
@@ -387,13 +387,15 @@ static int dso__load_sym(struct dso *self, int fd, const char *name, | |||
387 | 387 | ||
388 | elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); | 388 | elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); |
389 | if (elf == NULL) { | 389 | if (elf == NULL) { |
390 | fprintf(stderr, "%s: cannot read %s ELF file.\n", | 390 | if (verbose) |
391 | __func__, name); | 391 | fprintf(stderr, "%s: cannot read %s ELF file.\n", |
392 | __func__, name); | ||
392 | goto out_close; | 393 | goto out_close; |
393 | } | 394 | } |
394 | 395 | ||
395 | if (gelf_getehdr(elf, &ehdr) == NULL) { | 396 | if (gelf_getehdr(elf, &ehdr) == NULL) { |
396 | fprintf(stderr, "%s: cannot get elf header.\n", __func__); | 397 | if (verbose) |
398 | fprintf(stderr, "%s: cannot get elf header.\n", __func__); | ||
397 | goto out_elf_end; | 399 | goto out_elf_end; |
398 | } | 400 | } |
399 | 401 | ||
@@ -473,7 +475,7 @@ out_close: | |||
473 | return err; | 475 | return err; |
474 | } | 476 | } |
475 | 477 | ||
476 | int dso__load(struct dso *self, symbol_filter_t filter) | 478 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose) |
477 | { | 479 | { |
478 | int size = strlen(self->name) + sizeof("/usr/lib/debug%s.debug"); | 480 | int size = strlen(self->name) + sizeof("/usr/lib/debug%s.debug"); |
479 | char *name = malloc(size); | 481 | char *name = malloc(size); |
@@ -505,7 +507,7 @@ more: | |||
505 | fd = open(name, O_RDONLY); | 507 | fd = open(name, O_RDONLY); |
506 | } while (fd < 0); | 508 | } while (fd < 0); |
507 | 509 | ||
508 | ret = dso__load_sym(self, fd, name, filter); | 510 | ret = dso__load_sym(self, fd, name, filter, verbose); |
509 | close(fd); | 511 | close(fd); |
510 | 512 | ||
511 | /* | 513 | /* |
@@ -520,28 +522,29 @@ out: | |||
520 | } | 522 | } |
521 | 523 | ||
522 | static int dso__load_vmlinux(struct dso *self, const char *vmlinux, | 524 | static int dso__load_vmlinux(struct dso *self, const char *vmlinux, |
523 | symbol_filter_t filter) | 525 | symbol_filter_t filter, int verbose) |
524 | { | 526 | { |
525 | int err, fd = open(vmlinux, O_RDONLY); | 527 | int err, fd = open(vmlinux, O_RDONLY); |
526 | 528 | ||
527 | if (fd < 0) | 529 | if (fd < 0) |
528 | return -1; | 530 | return -1; |
529 | 531 | ||
530 | err = dso__load_sym(self, fd, vmlinux, filter); | 532 | err = dso__load_sym(self, fd, vmlinux, filter, verbose); |
531 | close(fd); | 533 | close(fd); |
532 | 534 | ||
533 | return err; | 535 | return err; |
534 | } | 536 | } |
535 | 537 | ||
536 | int dso__load_kernel(struct dso *self, const char *vmlinux, symbol_filter_t filter) | 538 | int dso__load_kernel(struct dso *self, const char *vmlinux, |
539 | symbol_filter_t filter, int verbose) | ||
537 | { | 540 | { |
538 | int err = -1; | 541 | int err = -1; |
539 | 542 | ||
540 | if (vmlinux) | 543 | if (vmlinux) |
541 | err = dso__load_vmlinux(self, vmlinux, filter); | 544 | err = dso__load_vmlinux(self, vmlinux, filter, verbose); |
542 | 545 | ||
543 | if (err) | 546 | if (err) |
544 | err = dso__load_kallsyms(self, filter); | 547 | err = dso__load_kallsyms(self, filter, verbose); |
545 | 548 | ||
546 | return err; | 549 | return err; |
547 | } | 550 | } |