From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, namhyung@kernel.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, jolsa@redhat.com, acme@redhat.com,
mhiramat@kernel.org, tglx@linutronix.de, peterz@infradead.org
Subject: [tip:perf/urgent] perf probe: Fix --funcs to show correct symbols for offline module
Date: Wed, 4 Jan 2017 23:54:06 -0800 [thread overview]
Message-ID: <tip-eebc509b20881b92d62e317b2c073e57c5f200f0@git.kernel.org> (raw)
In-Reply-To: <148350053478.19001.15435255244512631545.stgit@devbox>
Commit-ID: eebc509b20881b92d62e317b2c073e57c5f200f0
Gitweb: http://git.kernel.org/tip/eebc509b20881b92d62e317b2c073e57c5f200f0
Author: Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate: Wed, 4 Jan 2017 12:29:05 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 4 Jan 2017 11:15:09 -0300
perf probe: Fix --funcs to show correct symbols for offline module
Fix --funcs (-F) option to show correct symbols for offline module.
Since previous perf-probe uses machine__findnew_module_map() for offline
module, even if user passes a module file (with full path) which is for
other architecture, perf-probe always tries to load symbol map for
current kernel module.
This fix uses dso__new_map() to load the map from given binary as same
as a map for user applications.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/148350053478.19001.15435255244512631545.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 8f81096..542e647 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -163,7 +163,7 @@ static struct map *kernel_get_module_map(const char *module)
/* A file path -- this is an offline module */
if (module && strchr(module, '/'))
- return machine__findnew_module_map(host_machine, 0, module);
+ return dso__new_map(module);
if (!module)
module = "kernel";
@@ -173,6 +173,7 @@ static struct map *kernel_get_module_map(const char *module)
if (strncmp(pos->dso->short_name + 1, module,
pos->dso->short_name_len - 2) == 0 &&
module[pos->dso->short_name_len - 2] == '\0') {
+ map__get(pos);
return pos;
}
}
@@ -188,15 +189,6 @@ struct map *get_target_map(const char *target, bool user)
return kernel_get_module_map(target);
}
-static void put_target_map(struct map *map, bool user)
-{
- if (map && user) {
- /* Only the user map needs to be released */
- map__put(map);
- }
-}
-
-
static int convert_exec_to_group(const char *exec, char **result)
{
char *ptr1, *ptr2, *exec_copy;
@@ -412,7 +404,7 @@ static int find_alternative_probe_point(struct debuginfo *dinfo,
}
out:
- put_target_map(map, uprobes);
+ map__put(map);
return ret;
}
@@ -2869,7 +2861,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
}
out:
- put_target_map(map, pev->uprobes);
+ map__put(map);
free(syms);
return ret;
@@ -3362,10 +3354,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
return ret;
/* Get a symbol map */
- if (user)
- map = dso__new_map(target);
- else
- map = kernel_get_module_map(target);
+ map = get_target_map(target, user);
if (!map) {
pr_err("Failed to get a map for %s\n", (target) ? : "kernel");
return -EINVAL;
@@ -3397,9 +3386,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
}
end:
- if (user) {
- map__put(map);
- }
+ map__put(map);
exit_probe_symbol_maps();
return ret;
next prev parent reply other threads:[~2017-01-05 7:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-04 3:27 [PATCH perf/core 0/3] perf-probe: Fix offline module and cross-arch support Masami Hiramatsu
2017-01-04 3:29 ` [PATCH perf/core 1/3] perf-probe: Fix --funcs to show correct symbols for offline module Masami Hiramatsu
2017-01-05 7:54 ` tip-bot for Masami Hiramatsu [this message]
2017-01-04 3:30 ` [PATCH perf/core 2/3] perf-probe: Fix to probe on gcc generated symbols for offline kernel Masami Hiramatsu
2017-01-05 7:54 ` [tip:perf/urgent] perf probe: " tip-bot for Masami Hiramatsu
2017-01-04 3:31 ` [PATCH perf/core 3/3] perf-probe: Fix to probe on gcc generated functions in modules Masami Hiramatsu
2017-01-04 14:48 ` Arnaldo Carvalho de Melo
2017-01-05 11:20 ` Masami Hiramatsu
2017-01-05 14:16 ` Masami Hiramatsu
2017-01-05 15:30 ` Arnaldo Carvalho de Melo
2017-01-05 18:47 ` Arnaldo Carvalho de Melo
2017-01-06 2:16 ` Masami Hiramatsu
2017-01-06 16:22 ` Masami Hiramatsu
2017-01-06 18:17 ` Arnaldo Carvalho de Melo
2017-01-07 1:50 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-eebc509b20881b92d62e317b2c073e57c5f200f0@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome