Skip to content

Commit 0058aef

Browse files
ahunter6acmel
authored andcommitted
perf symbols: Retain symbol source file name to lookup source line numbers
Currently, lookup of an ip's source file name and line number is done using the dso file name. Instead retain the file name used to lookup the dso's symbols and use that. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1386055390-13757-6-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 454ff00 commit 0058aef

4 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎tools/perf/util/dso.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ void dso__delete(struct dso *dso)
470470
free(dso->long_name);
471471
dso_cache__free(&dso->cache);
472472
dso__free_a2l(dso);
473+
free(dso->symsrc_filename);
473474
free(dso);
474475
}
475476

‎tools/perf/util/dso.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct dso {
7878
struct rb_root symbol_names[MAP__NR_TYPES];
7979
struct rb_root cache;
8080
void *a2l;
81+
char *symsrc_filename;
8182
enum dso_kernel_type kernel;
8283
enum dso_swap_type needs_swap;
8384
enum dso_binary_type symtab_type;

‎tools/perf/util/srcline.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,16 @@ char *get_srcline(struct dso *dso, unsigned long addr)
249249
char *file = NULL;
250250
unsigned line = 0;
251251
char *srcline;
252-
char *dso_name = dso->long_name;
252+
char *dso_name;
253253

254254
if (!dso->has_srcline)
255255
return SRCLINE_UNKNOWN;
256256

257+
if (dso->symsrc_filename)
258+
dso_name = dso->symsrc_filename;
259+
else
260+
dso_name = dso->long_name;
261+
257262
if (dso_name[0] == '[')
258263
goto out;
259264

‎tools/perf/util/symbol.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
13361336
if (!syms_ss && symsrc__has_symtab(ss)) {
13371337
syms_ss = ss;
13381338
next_slot = true;
1339+
if (!dso->symsrc_filename)
1340+
dso->symsrc_filename = strdup(name);
13391341
}
13401342

13411343
if (!runtime_ss && symsrc__possibly_runtime(ss)) {

0 commit comments

Comments
 (0)