[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zjt41x4r.fsf@sejong.aot.lge.com>
Date: Tue, 30 Jul 2013 13:37:24 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <peterz@...radead.org>,
Stephane Eranian <eranian@...gle.com>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 7/9] perf tools: add support for reading from /proc/kcore
Hi,
On Thu, 25 Jul 2013 17:01:28 +0300, Adrian Hunter wrote:
> In the absence of vmlinux, perf tools uses kallsyms
> for symbols. If the user has access, now also map to
> /proc/kcore.
>
> The dso data_type is now set to either
> DSO_BINARY_TYPE__KCORE or DSO_BINARY_TYPE__GUEST_KCORE
> as approprite.
[SNIP]
> +
> +static bool is_host_buildid_str(const char *str)
> +{
> + u8 host_build_id[BUILD_ID_SIZE];
> + char host_build_id_str[BUILD_ID_SIZE * 2 + 1];
> +
> + if (sysfs__read_build_id("/sys/kernel/notes", host_build_id,
> + sizeof(host_build_id)))
> + return false;
> +
> + build_id__sprintf(host_build_id, sizeof(host_build_id),
> + host_build_id_str);
> +
> + return !strcmp(str, host_build_id_str);
> +}
> +
> +/*
> + * If kallsyms is referenced by name then we look for kcore in the same
> + * directory. Otherwise we use /proc/kcore but only if the buildid matches the
> + * host.
> + */
> +static bool kcore_filename_from_kallsyms_filename(char *kcore_filename,
> + const char *kallsyms_filename)
> +{
> + char *name;
> +
> + strcpy(kcore_filename, kallsyms_filename);
> + name = strrchr(kcore_filename, '/');
> + if (!name)
> + return false;
> +
> + if (!strcmp(name, "/kallsyms")) {
> + strcpy(name, "/kcore");
> + return true;
> + }
> +
> + if (is_host_buildid_str(name)) {
IIUC the name should start with '/' but build-id is not. So doesn't it
always fail?
Thanks,
Namhyung
> + strcpy(kcore_filename, "/proc/kcore");
> + return true;
> + }
> +
> + return false;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists