Skip to content

Commit

Permalink
perf symbols: Look at .dynsym again if .symtab not found
Browse files Browse the repository at this point in the history
The original intent of the code was to repeat the search with
want_symtab = 0. But as the code stands now, we never hit the "default"
case of the switch statement. Which means we never repeat the search.

Tested-by: Srikar Dronamraju <[email protected]>
Reported-by: Arun Sharma <[email protected]>
Reported-by: Srikar Dronamraju <[email protected]>
Cc: Dave Martin <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Tom Zanussi <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Mar 23, 2011
1 parent b251148 commit 60e4b10
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,9 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
* On the first pass, only load images if they have a full symtab.
* Failing that, do a second pass where we accept .dynsym also
*/
for (self->symtab_type = SYMTAB__BUILD_ID_CACHE, want_symtab = 1;
want_symtab = 1;
restart:
for (self->symtab_type = SYMTAB__BUILD_ID_CACHE;
self->symtab_type != SYMTAB__NOT_FOUND;
self->symtab_type++) {
switch (self->symtab_type) {
Expand Down Expand Up @@ -1536,17 +1538,7 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
snprintf(name, size, "%s%s", symbol_conf.symfs,
self->long_name);
break;

default:
/*
* If we wanted a full symtab but no image had one,
* relax our requirements and repeat the search.
*/
if (want_symtab) {
want_symtab = 0;
self->symtab_type = SYMTAB__BUILD_ID_CACHE;
} else
continue;
default:;
}

/* Name is now the name of the next image to try */
Expand All @@ -1573,6 +1565,15 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
}
}

/*
* If we wanted a full symtab but no image had one,
* relax our requirements and repeat the search.
*/
if (ret <= 0 && want_symtab) {
want_symtab = 0;
goto restart;
}

free(name);
if (ret < 0 && strstr(self->name, " (deleted)") != NULL)
return 0;
Expand Down

0 comments on commit 60e4b10

Please sign in to comment.