提交 15a0a870 编写于 作者: A Adrian Hunter 提交者: Arnaldo Carvalho de Melo

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: NAdrian Hunter <adrian.hunter@intel.com>
Tested-by: NJiri 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 29b596b5
...@@ -496,19 +496,22 @@ static int symbol__in_kernel(void *arg, const char *name, ...@@ -496,19 +496,22 @@ static int symbol__in_kernel(void *arg, const char *name,
return 1; return 1;
} }
static void machine__get_kallsyms_filename(struct machine *machine, char *buf,
size_t bufsz)
{
if (machine__is_default_guest(machine))
scnprintf(buf, bufsz, "%s", symbol_conf.default_guest_kallsyms);
else
scnprintf(buf, bufsz, "%s/proc/kallsyms", machine->root_dir);
}
/* Figure out the start address of kernel map from /proc/kallsyms */ /* Figure out the start address of kernel map from /proc/kallsyms */
static u64 machine__get_kernel_start_addr(struct machine *machine) static u64 machine__get_kernel_start_addr(struct machine *machine)
{ {
const char *filename; char filename[PATH_MAX];
char path[PATH_MAX];
struct process_args args; struct process_args args;
if (machine__is_default_guest(machine)) machine__get_kallsyms_filename(machine, filename, PATH_MAX);
filename = (char *)symbol_conf.default_guest_kallsyms;
else {
sprintf(path, "%s/proc/kallsyms", machine->root_dir);
filename = path;
}
if (symbol__restricted_filename(filename, "/proc/kallsyms")) if (symbol__restricted_filename(filename, "/proc/kallsyms"))
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册