Skip to content

Commit 86c98ca

Browse files
Namhyung Kimacmel
authored andcommitted
perf annotate: Pass dso instead of dso_name to get_srcline()
This is a preparation of next change. No functional changes are intended. 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-7-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 58d91a0 commit 86c98ca

5 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎tools/perf/util/annotate.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,8 +1081,7 @@ static void symbol__free_source_line(struct symbol *sym, int len)
10811081
/* Get the filename:line for the colored entries */
10821082
static int symbol__get_source_line(struct symbol *sym, struct map *map,
10831083
struct perf_evsel *evsel,
1084-
struct rb_root *root, int len,
1085-
const char *filename)
1084+
struct rb_root *root, int len)
10861085
{
10871086
u64 start;
10881087
int i, k;
@@ -1131,7 +1130,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
11311130
goto next;
11321131

11331132
offset = start + i;
1134-
src_line->path = get_srcline(filename, offset);
1133+
src_line->path = get_srcline(map->dso, offset);
11351134
insert_source_line(&tmp_root, src_line);
11361135

11371136
next:
@@ -1338,7 +1337,6 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
13381337
bool full_paths, int min_pcnt, int max_lines)
13391338
{
13401339
struct dso *dso = map->dso;
1341-
const char *filename = dso->long_name;
13421340
struct rb_root source_line = RB_ROOT;
13431341
u64 len;
13441342

@@ -1348,9 +1346,8 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
13481346
len = symbol__size(sym);
13491347

13501348
if (print_lines) {
1351-
symbol__get_source_line(sym, map, evsel, &source_line,
1352-
len, filename);
1353-
print_summary(&source_line, filename);
1349+
symbol__get_source_line(sym, map, evsel, &source_line, len);
1350+
print_summary(&source_line, dso->long_name);
13541351
}
13551352

13561353
symbol__annotate_printf(sym, map, evsel, full_paths,

‎tools/perf/util/dso.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <stdbool.h>
77
#include "types.h"
88
#include "map.h"
9+
#include "build-id.h"
910

1011
enum dso_binary_type {
1112
DSO_BINARY_TYPE__KALLSYMS = 0,

‎tools/perf/util/sort.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
259259
if (!self->ms.map)
260260
goto out_ip;
261261

262-
path = get_srcline(self->ms.map->dso->long_name, self->ip);
262+
path = get_srcline(self->ms.map->dso, self->ip);
263263
self->srcline = path;
264264

265265
out_path:

‎tools/perf/util/srcline.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <linux/kernel.h>
66

7+
#include "util/dso.h"
78
#include "util/util.h"
89
#include "util/debug.h"
910

@@ -53,11 +54,12 @@ static int addr2line(const char *dso_name, unsigned long addr,
5354
return ret;
5455
}
5556

56-
char *get_srcline(const char *dso_name, unsigned long addr)
57+
char *get_srcline(struct dso *dso, unsigned long addr)
5758
{
5859
char *file;
5960
unsigned line;
6061
char *srcline = SRCLINE_UNKNOWN;
62+
char *dso_name = dso->long_name;
6163
size_t size;
6264

6365
if (dso_name[0] == '[')

‎tools/perf/util/util.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ unsigned long parse_tag_value(const char *str, struct parse_tag *tags);
300300

301301
#define SRCLINE_UNKNOWN ((char *) "??:0")
302302

303-
char *get_srcline(const char *dso_name, unsigned long addr);
303+
struct dso;
304+
305+
char *get_srcline(struct dso *dso, unsigned long addr);
304306
void free_srcline(char *srcline);
305307
#endif /* GIT_COMPAT_UTIL_H */

0 commit comments

Comments
 (0)