perf symbols: Improve kallsyms symbol end addr calculation
Commit-ID: 3b01a413c196c91040d41c86e5b56f76bb369f74 Gitweb: http://git.kernel.org/tip/3b01a413c196c91040d41c86e5b56f76bb369f74 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Wed, 22 Dec 2010 01:08:36 -0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 22 Dec 2010 20:31:45 -0200
perf symbols: Improve kallsyms symbol end addr calculation
For kallsyms we don't have the symbol address end, so we do an extra pass and set the symbol end addr as being the start of the next minus one.
But this was being done just after we filtered the symbols of a particular type (functions, variables), so the symbol end was sometimes after what it really is.
Fixing up symbol end also was falling apart when we have symbol aliases, then the end address of all but the last alias was being set to be before its start.
Fix it up by checking for symbol aliases and making the kallsyms__parse routine use the next symbol, whatever its type, as the limit for the previous symbol, passing that end address to the callback.
This was detected by the 'perf test' synthetic paranoid regression tests, fix it up so that even that case doesn't mislead us.
Cc: Frederic Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <new-submission>
--- tools/perf/util/event.c | 3 +- tools/perf/util/symbol.c | 56 ++++++++++++++++++++++++++++++++++----------- tools/perf/util/symbol.h | 2 +- 3 files changed, 45 insertions(+), 16 deletions(-)
tools/perf/util/event.c +2 -1
@@ -332,7 +332,8 @@ struct process_symbol_args {u64 start; }; -static int find_symbol_cb (void *arg,const char *name,char type,u64 start) +static int find_symbol_cb (void *arg,const char *name,char type, +u64 start,u64 end__used ) {struct process_symbol_args *args = arg;
tools/perf/util/symbol.c +42 -14
117 lines not on this page · raw message
tools/perf/util/symbol.h +1 -1
@@ -215,7 +215,7 @@ bool __dsos__read_build_ids(struct list_head *head, bool with_hits);int build_id__sprintf (const u8 *self,int len,char *bf);int kallsyms__parse (const char *filename,void *arg,int (*process_symbol)(void *arg,const char *name, -char type,u64 start)); +char type,u64 start,u64 end));void machine__destroy_kernel_maps (struct machine *self);int __machine__create_kernel_maps (struct machine *self,struct dso *kernel);