From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
Namhyung Kim <namhyung@gmail.com>,
Paul Mackerras <paulus@samba.org>,
Stephane Eranian <eranian@google.com>
Subject: [PATCH V5 4/9] perf tools: add map__find_other_map_symbol()
Date: Tue, 8 Oct 2013 11:45:51 +0300 [thread overview]
Message-ID: <1381221956-16699-5-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1381221956-16699-1-git-send-email-adrian.hunter@intel.com>
Add a function to find a symbol using an ip that
might be on a different map.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/map.c | 27 +++++++++++++++++++++++++++
tools/perf/util/map.h | 2 ++
2 files changed, 29 insertions(+)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 4f6680d..beedeef 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -213,6 +213,33 @@ struct symbol *map__find_symbol_by_name(struct map *map, const char *name,
return dso__find_symbol_by_name(map->dso, map->type, name);
}
+struct symbol *map__find_other_map_symbol(struct map **map_ptr, u64 *ip_ptr,
+ symbol_filter_t filter)
+{
+ struct map *map = *map_ptr;
+ u64 ip = *ip_ptr;
+ struct map *sym_map = NULL;
+ struct symbol *sym;
+
+ if (ip >= map->start && ip <= map->end)
+ sym_map = map;
+ else if (map->groups)
+ sym_map = map_groups__find(map->groups, map->type, ip);
+
+ if (!sym_map)
+ return NULL;
+
+ ip = sym_map->map_ip(sym_map, ip);
+
+ sym = map__find_symbol(sym_map, ip, filter);
+ if (sym) {
+ *map_ptr = sym_map;
+ *ip_ptr = ip;
+ }
+
+ return sym;
+}
+
struct map *map__clone(struct map *map)
{
return memdup(map, sizeof(*map));
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 4886ca2..b7b494c 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -106,6 +106,8 @@ struct symbol *map__find_symbol(struct map *map,
u64 addr, symbol_filter_t filter);
struct symbol *map__find_symbol_by_name(struct map *map, const char *name,
symbol_filter_t filter);
+struct symbol *map__find_other_map_symbol(struct map **map_ptr, u64 *ip_ptr,
+ symbol_filter_t filter);
void map__fixup_start(struct map *map);
void map__fixup_end(struct map *map);
--
1.7.11.7
next prev parent reply other threads:[~2013-10-08 8:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 8:45 [PATCH V5 0/9] perf tools: kcore improvements Adrian Hunter
2013-10-08 8:45 ` [PATCH V5 1/9] perf tools: make a separate function to parse /proc/modules Adrian Hunter
2013-10-15 5:31 ` [tip:perf/core] perf symbols: Make a separate function to parse / proc/modules tip-bot for Adrian Hunter
2013-10-08 8:45 ` [PATCH V5 2/9] perf tools: validate kcore module addresses Adrian Hunter
2013-10-08 8:45 ` [PATCH V5 3/9] perf tools: workaround objdump difficulties with kcore Adrian Hunter
2013-10-08 14:02 ` Jiri Olsa
2013-10-09 7:33 ` Adrian Hunter
2013-10-09 10:12 ` Jiri Olsa
2013-10-09 10:38 ` Adrian Hunter
2013-10-09 12:16 ` Jiri Olsa
2013-10-09 12:43 ` Adrian Hunter
2013-10-08 15:56 ` Arnaldo Carvalho de Melo
2013-10-08 8:45 ` Adrian Hunter [this message]
2013-10-08 8:45 ` [PATCH V5 5/9] perf tools: fix annotate_browser__callq() Adrian Hunter
2013-10-08 8:45 ` [PATCH V5 6/9] perf tools: find kcore symbols on other maps Adrian Hunter
2013-10-08 8:45 ` [PATCH V5 7/9] perf tools: add copyfile_mode() Adrian Hunter
2013-10-08 8:45 ` [PATCH V5 8/9] perf buildid-cache: add ability to add kcore to the cache Adrian Hunter
2013-10-08 8:45 ` [PATCH V5 9/9] perf tools: add ability to find kcore in build-id cache Adrian Hunter
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=1381221956-16699-5-git-send-email-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@gmail.com \
--cc=paulus@samba.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.