Skip to content

Commit 2cc9d0e

Browse files
Namhyung Kimacmel
authored andcommitted
perf tools: Save failed result of get_srcline()
Some dso's lack srcline info, so there's no point to keep trying on them. Just save failture status and skip them. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Reviewed-by: Jiri Olsa <jolsa@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1378876173-13363-8-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 86c98ca commit 2cc9d0e

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎tools/perf/util/dso.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ struct dso *dso__new(const char *name)
450450
dso->rel = 0;
451451
dso->sorted_by_name = 0;
452452
dso->has_build_id = 0;
453+
dso->has_srcline = 1;
453454
dso->kernel = DSO_TYPE_USER;
454455
dso->needs_swap = DSO_SWAP__UNSET;
455456
INIT_LIST_HEAD(&dso->node);

‎tools/perf/util/dso.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct dso {
8383
enum dso_binary_type data_type;
8484
u8 adjust_symbols:1;
8585
u8 has_build_id:1;
86+
u8 has_srcline:1;
8687
u8 hit:1;
8788
u8 annotate_warned:1;
8889
u8 sname_alloc:1;

‎tools/perf/util/srcline.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ char *get_srcline(struct dso *dso, unsigned long addr)
5858
{
5959
char *file;
6060
unsigned line;
61-
char *srcline = SRCLINE_UNKNOWN;
61+
char *srcline;
6262
char *dso_name = dso->long_name;
6363
size_t size;
6464

65+
if (!dso->has_srcline)
66+
return SRCLINE_UNKNOWN;
67+
6568
if (dso_name[0] == '[')
6669
goto out;
6770

@@ -81,8 +84,11 @@ char *get_srcline(struct dso *dso, unsigned long addr)
8184
srcline = SRCLINE_UNKNOWN;
8285

8386
free(file);
84-
out:
8587
return srcline;
88+
89+
out:
90+
dso->has_srcline = 0;
91+
return SRCLINE_UNKNOWN;
8692
}
8793

8894
void free_srcline(char *srcline)

0 commit comments

Comments
 (0)