summaryrefslogtreecommitdiff
path: root/Documentation/perf_counter/builtin-report.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-05-26 11:14:27 -0300
committerIngo Molnar <mingo@elte.hu>2009-05-26 16:19:05 +0200
commit59d81029b6804c3d5895d07cad77d7dfddc6b5b2 (patch)
tree8b2e9ba0bcd05d160b10249d96059a6b6f1578b0 /Documentation/perf_counter/builtin-report.c
parentf17e04afaff84b5cfd317da29ac4d764908ff833 (diff)
downloadlwn-59d81029b6804c3d5895d07cad77d7dfddc6b5b2.tar.gz
lwn-59d81029b6804c3d5895d07cad77d7dfddc6b5b2.zip
perf report: Fix kernel symbol resolution
kallsyms have just the symbol start, so we need to read two lines to get the len. [ Impact: fix incorrect kernel symbol display in perf report ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> 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> Cc: John Kacur <jkacur@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/builtin-report.c')
-rw-r--r--Documentation/perf_counter/builtin-report.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 697f960495fc..b19b893d4ff5 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -360,9 +360,17 @@ static int load_kallsyms(void)
char *line = NULL;
size_t n;
+ if (getline(&line, &n, file) < 0 || !line)
+ goto out_delete_dso;
+
+ unsigned long long previous_start;
+ char c, previous_symbf[4096];
+ if (sscanf(line, "%llx %c %s", &previous_start, &c, previous_symbf) != 3)
+ goto out_delete_line;
+
while (!feof(file)) {
unsigned long long start;
- char c, symbf[4096];
+ char symbf[4096];
if (getline(&line, &n, file) < 0)
break;
@@ -371,12 +379,18 @@ static int load_kallsyms(void)
goto out_delete_dso;
if (sscanf(line, "%llx %c %s", &start, &c, symbf) == 3) {
- struct symbol *sym = symbol__new(start, 0x1000000, symbf);
+ if (start > previous_start) {
+ struct symbol *sym = symbol__new(previous_start,
+ start - previous_start,
+ previous_symbf);
- if (sym == NULL)
- goto out_delete_dso;
+ if (sym == NULL)
+ goto out_delete_dso;
- dso__insert_symbol(kernel_dso, sym);
+ dso__insert_symbol(kernel_dso, sym);
+ previous_start = start;
+ strcpy(previous_symbf, symbf);
+ }
}
}
@@ -385,6 +399,8 @@ static int load_kallsyms(void)
fclose(file);
return 0;
+out_delete_line:
+ free(line);
out_delete_dso:
dso__delete(kernel_dso);
return -1;