diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-07-22 09:17:57 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-23 16:36:32 -0400 |
commit | 51682dc744c3db89e515ac47a4c1f7003fd81d20 (patch) | |
tree | c87e787e53ed3593c03149aa524465ae6cbf034f /tools/perf | |
parent | 4f71f2a0abe8b2a76669a4608a62f5020a64205a (diff) |
perf tools: Separate the VDSO map name from the VDSO dso name
This is in preparation for supporting 32-bit compatibility VDSOs.
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1406035081-14301-49-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/header.c | 10 | ||||
-rw-r--r-- | tools/perf/util/symbol-elf.c | 2 | ||||
-rw-r--r-- | tools/perf/util/vdso.c | 11 | ||||
-rw-r--r-- | tools/perf/util/vdso.h | 6 |
4 files changed, 20 insertions, 9 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index a588a3eb5753..158c787ce0c4 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -256,9 +256,9 @@ static int __dsos__write_buildid_table(struct list_head *head, | |||
256 | if (!pos->hit) | 256 | if (!pos->hit) |
257 | continue; | 257 | continue; |
258 | 258 | ||
259 | if (is_vdso_map(pos->short_name)) { | 259 | if (dso__is_vdso(pos)) { |
260 | name = (char *) VDSO__MAP_NAME; | 260 | name = pos->short_name; |
261 | name_len = sizeof(VDSO__MAP_NAME) + 1; | 261 | name_len = pos->short_name_len + 1; |
262 | } else if (dso__is_kcore(pos)) { | 262 | } else if (dso__is_kcore(pos)) { |
263 | machine__mmap_name(machine, nm, sizeof(nm)); | 263 | machine__mmap_name(machine, nm, sizeof(nm)); |
264 | name = nm; | 264 | name = nm; |
@@ -339,7 +339,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
339 | 339 | ||
340 | len = scnprintf(filename, size, "%s%s%s", | 340 | len = scnprintf(filename, size, "%s%s%s", |
341 | debugdir, slash ? "/" : "", | 341 | debugdir, slash ? "/" : "", |
342 | is_vdso ? VDSO__MAP_NAME : realname); | 342 | is_vdso ? DSO__NAME_VDSO : realname); |
343 | if (mkdir_p(filename, 0755)) | 343 | if (mkdir_p(filename, 0755)) |
344 | goto out_free; | 344 | goto out_free; |
345 | 345 | ||
@@ -427,7 +427,7 @@ static int dso__cache_build_id(struct dso *dso, struct machine *machine, | |||
427 | const char *debugdir) | 427 | const char *debugdir) |
428 | { | 428 | { |
429 | bool is_kallsyms = dso->kernel && dso->long_name[0] != '/'; | 429 | bool is_kallsyms = dso->kernel && dso->long_name[0] != '/'; |
430 | bool is_vdso = is_vdso_map(dso->short_name); | 430 | bool is_vdso = dso__is_vdso(dso); |
431 | const char *name = dso->long_name; | 431 | const char *name = dso->long_name; |
432 | char nm[PATH_MAX]; | 432 | char nm[PATH_MAX]; |
433 | 433 | ||
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index cef8f426356e..61b9cd456310 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -622,7 +622,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, | |||
622 | GElf_Shdr shdr; | 622 | GElf_Shdr shdr; |
623 | ss->adjust_symbols = (ehdr.e_type == ET_EXEC || | 623 | ss->adjust_symbols = (ehdr.e_type == ET_EXEC || |
624 | ehdr.e_type == ET_REL || | 624 | ehdr.e_type == ET_REL || |
625 | is_vdso_map(dso->short_name) || | 625 | dso__is_vdso(dso) || |
626 | elf_section_by_name(elf, &ehdr, &shdr, | 626 | elf_section_by_name(elf, &ehdr, &shdr, |
627 | ".gnu.prelink_undo", | 627 | ".gnu.prelink_undo", |
628 | NULL) != NULL); | 628 | NULL) != NULL); |
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c index 946d927765c6..a9300f83654b 100644 --- a/tools/perf/util/vdso.c +++ b/tools/perf/util/vdso.c | |||
@@ -33,7 +33,7 @@ static struct vdso_info *vdso_info__new(void) | |||
33 | static const struct vdso_info vdso_info_init = { | 33 | static const struct vdso_info vdso_info_init = { |
34 | .vdso = { | 34 | .vdso = { |
35 | .temp_file_name = VDSO__TEMP_FILE_NAME, | 35 | .temp_file_name = VDSO__TEMP_FILE_NAME, |
36 | .dso_name = VDSO__MAP_NAME, | 36 | .dso_name = DSO__NAME_VDSO, |
37 | }, | 37 | }, |
38 | }; | 38 | }; |
39 | 39 | ||
@@ -147,7 +147,7 @@ struct dso *vdso__dso_findnew(struct machine *machine) | |||
147 | if (!vdso_info) | 147 | if (!vdso_info) |
148 | return NULL; | 148 | return NULL; |
149 | 149 | ||
150 | dso = dsos__find(&machine->user_dsos, VDSO__MAP_NAME, true); | 150 | dso = dsos__find(&machine->user_dsos, DSO__NAME_VDSO, true); |
151 | if (!dso) { | 151 | if (!dso) { |
152 | char *file; | 152 | char *file; |
153 | 153 | ||
@@ -155,8 +155,13 @@ struct dso *vdso__dso_findnew(struct machine *machine) | |||
155 | if (!file) | 155 | if (!file) |
156 | return NULL; | 156 | return NULL; |
157 | 157 | ||
158 | dso = vdso__new(machine, VDSO__MAP_NAME, file); | 158 | dso = vdso__new(machine, DSO__NAME_VDSO, file); |
159 | } | 159 | } |
160 | 160 | ||
161 | return dso; | 161 | return dso; |
162 | } | 162 | } |
163 | |||
164 | bool dso__is_vdso(struct dso *dso) | ||
165 | { | ||
166 | return !strcmp(dso->short_name, DSO__NAME_VDSO); | ||
167 | } | ||
diff --git a/tools/perf/util/vdso.h b/tools/perf/util/vdso.h index 7cf1576863a4..be3eb4324c1e 100644 --- a/tools/perf/util/vdso.h +++ b/tools/perf/util/vdso.h | |||
@@ -7,11 +7,17 @@ | |||
7 | 7 | ||
8 | #define VDSO__MAP_NAME "[vdso]" | 8 | #define VDSO__MAP_NAME "[vdso]" |
9 | 9 | ||
10 | #define DSO__NAME_VDSO "[vdso]" | ||
11 | |||
10 | static inline bool is_vdso_map(const char *filename) | 12 | static inline bool is_vdso_map(const char *filename) |
11 | { | 13 | { |
12 | return !strcmp(filename, VDSO__MAP_NAME); | 14 | return !strcmp(filename, VDSO__MAP_NAME); |
13 | } | 15 | } |
14 | 16 | ||
17 | struct dso; | ||
18 | |||
19 | bool dso__is_vdso(struct dso *dso); | ||
20 | |||
15 | struct machine; | 21 | struct machine; |
16 | 22 | ||
17 | struct dso *vdso__dso_findnew(struct machine *machine); | 23 | struct dso *vdso__dso_findnew(struct machine *machine); |