Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147531
b: refs/heads/master
c: 59d8102
h: refs/heads/master
i:
  147529: 9121cb9
  147527: f0a7583
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed May 26, 2009
1 parent 1e8a94f commit e13139e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f17e04afaff84b5cfd317da29ac4d764908ff833
refs/heads/master: 59d81029b6804c3d5895d07cad77d7dfddc6b5b2
26 changes: 21 additions & 5 deletions trunk/Documentation/perf_counter/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}
}

Expand All @@ -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;
Expand Down

0 comments on commit e13139e

Please sign in to comment.