aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-05-26 10:14:27 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-26 10:19:05 -0400
commit59d81029b6804c3d5895d07cad77d7dfddc6b5b2 (patch)
tree8b2e9ba0bcd05d160b10249d96059a6b6f1578b0 /Documentation
parentf17e04afaff84b5cfd317da29ac4d764908ff833 (diff)
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')
-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)
360 char *line = NULL; 360 char *line = NULL;
361 size_t n; 361 size_t n;
362 362
363 if (getline(&line, &n, file) < 0 || !line)
364 goto out_delete_dso;
365
366 unsigned long long previous_start;
367 char c, previous_symbf[4096];
368 if (sscanf(line, "%llx %c %s", &previous_start, &c, previous_symbf) != 3)
369 goto out_delete_line;
370
363 while (!feof(file)) { 371 while (!feof(file)) {
364 unsigned long long start; 372 unsigned long long start;
365 char c, symbf[4096]; 373 char symbf[4096];
366 374
367 if (getline(&line, &n, file) < 0) 375 if (getline(&line, &n, file) < 0)
368 break; 376 break;
@@ -371,12 +379,18 @@ static int load_kallsyms(void)
371 goto out_delete_dso; 379 goto out_delete_dso;
372 380
373 if (sscanf(line, "%llx %c %s", &start, &c, symbf) == 3) { 381 if (sscanf(line, "%llx %c %s", &start, &c, symbf) == 3) {
374 struct symbol *sym = symbol__new(start, 0x1000000, symbf); 382 if (start > previous_start) {
383 struct symbol *sym = symbol__new(previous_start,
384 start - previous_start,
385 previous_symbf);
375 386
376 if (sym == NULL) 387 if (sym == NULL)
377 goto out_delete_dso; 388 goto out_delete_dso;
378 389
379 dso__insert_symbol(kernel_dso, sym); 390 dso__insert_symbol(kernel_dso, sym);
391 previous_start = start;
392 strcpy(previous_symbf, symbf);
393 }
380 } 394 }
381 } 395 }
382 396
@@ -385,6 +399,8 @@ static int load_kallsyms(void)
385 fclose(file); 399 fclose(file);
386 return 0; 400 return 0;
387 401
402out_delete_line:
403 free(line);
388out_delete_dso: 404out_delete_dso:
389 dso__delete(kernel_dso); 405 dso__delete(kernel_dso);
390 return -1; 406 return -1;