forked from Minki/linux
perf buildid-cache: Add --debuginfod option to specify a server to fetch debug files
Add the --debuginfod option to specify debuginfod URL and support to do that through config file as well. Use the following in ~/.perfconfig file: [buildid-cache] debuginfod=http://192.168.122.174:8002 Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <songliubraving@fb.com> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20201214105457.543111-14-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
0b5c88214e
commit
e8a2061f0b
@ -74,6 +74,12 @@ OPTIONS
|
||||
used when creating a uprobe for a process that resides in a
|
||||
different mount namespace from the perf(1) utility.
|
||||
|
||||
--debuginfod=URLs::
|
||||
Specify debuginfod URL to be used when retrieving perf.data binaries,
|
||||
it follows the same syntax as the DEBUGINFOD_URLS variable, like:
|
||||
|
||||
buildid-cache.debuginfod=http://192.168.122.174:8002
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
linkperf:perf-record[1], linkperf:perf-report[1], linkperf:perf-buildid-list[1]
|
||||
|
@ -238,6 +238,13 @@ buildid.*::
|
||||
cache location, or to disable it altogether. If you want to disable it,
|
||||
set buildid.dir to /dev/null. The default is $HOME/.debug
|
||||
|
||||
buildid-cache.*::
|
||||
buildid-cache.debuginfod=URLs
|
||||
Specify debuginfod URLs to be used when retrieving perf.data binaries,
|
||||
it follows the same syntax as the DEBUGINFOD_URLS variable, like:
|
||||
|
||||
buildid-cache.debuginfod=http://192.168.122.174:8002
|
||||
|
||||
annotate.*::
|
||||
These are in control of addresses, jump function, source code
|
||||
in lines of assembly code from a specific program.
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "util/time-utils.h"
|
||||
#include "util/util.h"
|
||||
#include "util/probe-file.h"
|
||||
#include "util/config.h"
|
||||
#include <linux/string.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
@ -348,12 +349,21 @@ static int build_id_cache__show_all(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int perf_buildid_cache_config(const char *var, const char *value, void *cb)
|
||||
{
|
||||
const char **debuginfod = cb;
|
||||
|
||||
if (!strcmp(var, "buildid-cache.debuginfod"))
|
||||
*debuginfod = strdup(value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cmd_buildid_cache(int argc, const char **argv)
|
||||
{
|
||||
struct strlist *list;
|
||||
struct str_node *pos;
|
||||
int ret = 0;
|
||||
int ns_id = -1;
|
||||
int ret, ns_id = -1;
|
||||
bool force = false;
|
||||
bool list_files = false;
|
||||
bool opts_flag = false;
|
||||
@ -363,7 +373,8 @@ int cmd_buildid_cache(int argc, const char **argv)
|
||||
*purge_name_list_str = NULL,
|
||||
*missing_filename = NULL,
|
||||
*update_name_list_str = NULL,
|
||||
*kcore_filename = NULL;
|
||||
*kcore_filename = NULL,
|
||||
*debuginfod = NULL;
|
||||
char sbuf[STRERR_BUFSIZE];
|
||||
|
||||
struct perf_data data = {
|
||||
@ -388,6 +399,8 @@ int cmd_buildid_cache(int argc, const char **argv)
|
||||
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
|
||||
OPT_STRING('u', "update", &update_name_list_str, "file list",
|
||||
"file(s) to update"),
|
||||
OPT_STRING(0, "debuginfod", &debuginfod, "debuginfod url",
|
||||
"set debuginfod url"),
|
||||
OPT_INCR('v', "verbose", &verbose, "be more verbose"),
|
||||
OPT_INTEGER(0, "target-ns", &ns_id, "target pid for namespace context"),
|
||||
OPT_END()
|
||||
@ -397,6 +410,10 @@ int cmd_buildid_cache(int argc, const char **argv)
|
||||
NULL
|
||||
};
|
||||
|
||||
ret = perf_config(perf_buildid_cache_config, &debuginfod);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
argc = parse_options(argc, argv, buildid_cache_options,
|
||||
buildid_cache_usage, 0);
|
||||
|
||||
@ -408,6 +425,11 @@ int cmd_buildid_cache(int argc, const char **argv)
|
||||
if (argc || !(list_files || opts_flag))
|
||||
usage_with_options(buildid_cache_usage, buildid_cache_options);
|
||||
|
||||
if (debuginfod) {
|
||||
pr_debug("DEBUGINFOD_URLS=%s\n", debuginfod);
|
||||
setenv("DEBUGINFOD_URLS", debuginfod, 1);
|
||||
}
|
||||
|
||||
/* -l is exclusive. It can not be used with other options. */
|
||||
if (list_files && opts_flag) {
|
||||
usage_with_options_msg(buildid_cache_usage,
|
||||
|
Loading…
Reference in New Issue
Block a user