diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-01-29 09:14:38 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-31 15:21:48 -0500 |
commit | 15a0a8706c32bd38bff9ebf7c6ef24f32d1ea921 (patch) | |
tree | 6a1b2679f1cab35a1ca6818380795a97bc48a0fc /tools | |
parent | 29b596b57426831fce92cd0ebb01c77627616fdf (diff) |
perf machine: Add machine__get_kallsyms_filename()
Separate out the logic used to make the kallsyms full path name for a
machine. It will be reused in a subsequent patch.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Jiri Olsa <jolsa@redhat.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/1391004884-10334-4-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/machine.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index ded74590b92f..290c2e6d4001 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -496,19 +496,22 @@ static int symbol__in_kernel(void *arg, const char *name, | |||
496 | return 1; | 496 | return 1; |
497 | } | 497 | } |
498 | 498 | ||
499 | static void machine__get_kallsyms_filename(struct machine *machine, char *buf, | ||
500 | size_t bufsz) | ||
501 | { | ||
502 | if (machine__is_default_guest(machine)) | ||
503 | scnprintf(buf, bufsz, "%s", symbol_conf.default_guest_kallsyms); | ||
504 | else | ||
505 | scnprintf(buf, bufsz, "%s/proc/kallsyms", machine->root_dir); | ||
506 | } | ||
507 | |||
499 | /* Figure out the start address of kernel map from /proc/kallsyms */ | 508 | /* Figure out the start address of kernel map from /proc/kallsyms */ |
500 | static u64 machine__get_kernel_start_addr(struct machine *machine) | 509 | static u64 machine__get_kernel_start_addr(struct machine *machine) |
501 | { | 510 | { |
502 | const char *filename; | 511 | char filename[PATH_MAX]; |
503 | char path[PATH_MAX]; | ||
504 | struct process_args args; | 512 | struct process_args args; |
505 | 513 | ||
506 | if (machine__is_default_guest(machine)) | 514 | machine__get_kallsyms_filename(machine, filename, PATH_MAX); |
507 | filename = (char *)symbol_conf.default_guest_kallsyms; | ||
508 | else { | ||
509 | sprintf(path, "%s/proc/kallsyms", machine->root_dir); | ||
510 | filename = path; | ||
511 | } | ||
512 | 515 | ||
513 | if (symbol__restricted_filename(filename, "/proc/kallsyms")) | 516 | if (symbol__restricted_filename(filename, "/proc/kallsyms")) |
514 | return 0; | 517 | return 0; |