aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCody P Schafer <cody@linux.vnet.ibm.com>2012-08-10 18:22:48 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-13 13:10:31 -0400
commit82151520938ec79e5e3adb7e61977f002031c38c (patch)
tree336ccad50a253ff00b0cf52b71761e546a3546d0
parent72f86204419e1b83f18b9bc2c97141a52dc534d2 (diff)
perf symbols: Remove unused 'end' arg in kallsyms parse cb
kallsyms__parse() takes a callback that is called on every discovered symbol. As /proc/kallsyms does not supply symbol sizes, the callback was simply called with end=start, faking the symbol size to 1. All of the callbacks (there are 2) used in calls to kallsyms__parse() are _only_ used as callbacks for kallsyms__parse(). Given that kallsyms__parse() lacks real information about what end/length should be, don't make up a length in kallsyms__parse(). Instead have the callbacks handle guessing the length. Also relocate a comment regarding symbol creation to the callback which does symbol creation (kallsyms__parse() is not in general used to create symbols). Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com> Cc: David Hansen <dave@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Matt Hellsley <matthltc@us.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Link: http://lkml.kernel.org/r/1344637382-22789-3-git-send-email-cody@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/event.c2
-rw-r--r--tools/perf/util/symbol.c21
-rw-r--r--tools/perf/util/symbol.h2
3 files changed, 12 insertions, 13 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 2a6f33cd888c..3a0f1a5da91c 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -412,7 +412,7 @@ struct process_symbol_args {
412}; 412};
413 413
414static int find_symbol_cb(void *arg, const char *name, char type, 414static int find_symbol_cb(void *arg, const char *name, char type,
415 u64 start, u64 end __used) 415 u64 start)
416{ 416{
417 struct process_symbol_args *args = arg; 417 struct process_symbol_args *args = arg;
418 418
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 9f181a86f3b2..21270029f07b 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -563,7 +563,7 @@ size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp)
563 563
564int kallsyms__parse(const char *filename, void *arg, 564int kallsyms__parse(const char *filename, void *arg,
565 int (*process_symbol)(void *arg, const char *name, 565 int (*process_symbol)(void *arg, const char *name,
566 char type, u64 start, u64 end)) 566 char type, u64 start))
567{ 567{
568 char *line = NULL; 568 char *line = NULL;
569 size_t n; 569 size_t n;
@@ -603,13 +603,8 @@ int kallsyms__parse(const char *filename, void *arg,
603 break; 603 break;
604 } 604 }
605 605
606 /*
607 * module symbols are not sorted so we add all
608 * symbols, setting length to 1, and rely on
609 * symbols__fixup_end() to fix it up.
610 */
611 err = process_symbol(arg, symbol_name, 606 err = process_symbol(arg, symbol_name,
612 symbol_type, start, start); 607 symbol_type, start);
613 if (err) 608 if (err)
614 break; 609 break;
615 } 610 }
@@ -636,7 +631,7 @@ static u8 kallsyms2elf_type(char type)
636} 631}
637 632
638static int map__process_kallsym_symbol(void *arg, const char *name, 633static int map__process_kallsym_symbol(void *arg, const char *name,
639 char type, u64 start, u64 end) 634 char type, u64 start)
640{ 635{
641 struct symbol *sym; 636 struct symbol *sym;
642 struct process_kallsyms_args *a = arg; 637 struct process_kallsyms_args *a = arg;
@@ -645,8 +640,12 @@ static int map__process_kallsym_symbol(void *arg, const char *name,
645 if (!symbol_type__is_a(type, a->map->type)) 640 if (!symbol_type__is_a(type, a->map->type))
646 return 0; 641 return 0;
647 642
648 sym = symbol__new(start, end - start + 1, 643 /*
649 kallsyms2elf_type(type), name); 644 * module symbols are not sorted so we add all
645 * symbols, setting length to 0, and rely on
646 * symbols__fixup_end() to fix it up.
647 */
648 sym = symbol__new(start, 0, kallsyms2elf_type(type), name);
650 if (sym == NULL) 649 if (sym == NULL)
651 return -ENOMEM; 650 return -ENOMEM;
652 /* 651 /*
@@ -1729,7 +1728,7 @@ struct process_args {
1729}; 1728};
1730 1729
1731static int symbol__in_kernel(void *arg, const char *name, 1730static int symbol__in_kernel(void *arg, const char *name,
1732 char type __used, u64 start, u64 end __used) 1731 char type __used, u64 start)
1733{ 1732{
1734 struct process_args *args = arg; 1733 struct process_args *args = arg;
1735 1734
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 38ccbbb39faa..c9534fe0720d 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -299,7 +299,7 @@ bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
299int build_id__sprintf(const u8 *build_id, int len, char *bf); 299int build_id__sprintf(const u8 *build_id, int len, char *bf);
300int kallsyms__parse(const char *filename, void *arg, 300int kallsyms__parse(const char *filename, void *arg,
301 int (*process_symbol)(void *arg, const char *name, 301 int (*process_symbol)(void *arg, const char *name,
302 char type, u64 start, u64 end)); 302 char type, u64 start));
303int filename__read_debuglink(const char *filename, char *debuglink, 303int filename__read_debuglink(const char *filename, char *debuglink,
304 size_t size); 304 size_t size);
305 305