Commit 82151520 authored by Cody P Schafer's avatar Cody P Schafer Committed by Arnaldo Carvalho de Melo

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: default avatarCody 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 72f86204
...@@ -412,7 +412,7 @@ struct process_symbol_args { ...@@ -412,7 +412,7 @@ struct process_symbol_args {
}; };
static int find_symbol_cb(void *arg, const char *name, char type, static int find_symbol_cb(void *arg, const char *name, char type,
u64 start, u64 end __used) u64 start)
{ {
struct process_symbol_args *args = arg; struct process_symbol_args *args = arg;
......
...@@ -563,7 +563,7 @@ size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp) ...@@ -563,7 +563,7 @@ size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp)
int kallsyms__parse(const char *filename, void *arg, int kallsyms__parse(const char *filename, void *arg,
int (*process_symbol)(void *arg, const char *name, int (*process_symbol)(void *arg, const char *name,
char type, u64 start, u64 end)) char type, u64 start))
{ {
char *line = NULL; char *line = NULL;
size_t n; size_t n;
...@@ -603,13 +603,8 @@ int kallsyms__parse(const char *filename, void *arg, ...@@ -603,13 +603,8 @@ int kallsyms__parse(const char *filename, void *arg,
break; break;
} }
/*
* module symbols are not sorted so we add all
* symbols, setting length to 1, and rely on
* symbols__fixup_end() to fix it up.
*/
err = process_symbol(arg, symbol_name, err = process_symbol(arg, symbol_name,
symbol_type, start, start); symbol_type, start);
if (err) if (err)
break; break;
} }
...@@ -636,7 +631,7 @@ static u8 kallsyms2elf_type(char type) ...@@ -636,7 +631,7 @@ static u8 kallsyms2elf_type(char type)
} }
static int map__process_kallsym_symbol(void *arg, const char *name, static int map__process_kallsym_symbol(void *arg, const char *name,
char type, u64 start, u64 end) char type, u64 start)
{ {
struct symbol *sym; struct symbol *sym;
struct process_kallsyms_args *a = arg; struct process_kallsyms_args *a = arg;
...@@ -645,8 +640,12 @@ static int map__process_kallsym_symbol(void *arg, const char *name, ...@@ -645,8 +640,12 @@ static int map__process_kallsym_symbol(void *arg, const char *name,
if (!symbol_type__is_a(type, a->map->type)) if (!symbol_type__is_a(type, a->map->type))
return 0; return 0;
sym = symbol__new(start, end - start + 1, /*
kallsyms2elf_type(type), name); * module symbols are not sorted so we add all
* symbols, setting length to 0, and rely on
* symbols__fixup_end() to fix it up.
*/
sym = symbol__new(start, 0, kallsyms2elf_type(type), name);
if (sym == NULL) if (sym == NULL)
return -ENOMEM; return -ENOMEM;
/* /*
...@@ -1729,7 +1728,7 @@ struct process_args { ...@@ -1729,7 +1728,7 @@ struct process_args {
}; };
static int symbol__in_kernel(void *arg, const char *name, static int symbol__in_kernel(void *arg, const char *name,
char type __used, u64 start, u64 end __used) char type __used, u64 start)
{ {
struct process_args *args = arg; struct process_args *args = arg;
......
...@@ -299,7 +299,7 @@ bool __dsos__read_build_ids(struct list_head *head, bool with_hits); ...@@ -299,7 +299,7 @@ bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
int build_id__sprintf(const u8 *build_id, int len, char *bf); int build_id__sprintf(const u8 *build_id, int len, char *bf);
int kallsyms__parse(const char *filename, void *arg, int kallsyms__parse(const char *filename, void *arg,
int (*process_symbol)(void *arg, const char *name, int (*process_symbol)(void *arg, const char *name,
char type, u64 start, u64 end)); char type, u64 start));
int filename__read_debuglink(const char *filename, char *debuglink, int filename__read_debuglink(const char *filename, char *debuglink,
size_t size); size_t size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment