All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Adrian Hunter <adrian.hunter@intel.com>
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: Re: [PATCH V6 3/8] perf tools: add map__find_other_map_symbol()
Date: Fri, 11 Oct 2013 10:41:53 -0300	[thread overview]
Message-ID: <20131011134153.GL28369@ghostprotocols.net> (raw)
In-Reply-To: <1381320078-16497-4-git-send-email-adrian.hunter@intel.com>

Em Wed, Oct 09, 2013 at 03:01:13PM +0300, Adrian Hunter escreveu:
> 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>

Can you take a look at the following patch? Since we have an
addr_map_symbol struct and the method looks more appropriate to be at
the map_groups abstraction, I thought this is simpler, what do you
think?

This struct is used in the machine__resolve_{mem,bstack} functions.

- Arnaldo

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 17ee458a0870..8f80463d9d46 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -371,6 +371,22 @@ struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg,
 	return NULL;
 }
 
+int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter)
+{
+	if (ams->addr < ams->map->start || ams->addr > ams->map->end) {
+		if (ams->map->groups == NULL)
+			return -1;
+		ams->map = map_groups__find(ams->map->groups, ams->map->type, ams->addr);
+		if (ams->map == NULL)
+			return -1;
+	}
+
+	ams->al_addr = ams->map->map_ip(ams->map, ams->addr);
+	ams->sym = map__find_symbol(ams->map, ams->al_addr, filter);
+
+	return ams->sym ? 0 : -1;
+}
+
 size_t __map_groups__fprintf_maps(struct map_groups *mg,
 				  enum map_type type, int verbose, FILE *fp)
 {
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 4886ca280536..0359b4a808f0 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -167,6 +167,10 @@ struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg,
 					       struct map **mapp,
 					       symbol_filter_t filter);
 
+struct addr_map_symbol;
+
+int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter);
+
 static inline
 struct symbol *map_groups__find_function_by_name(struct map_groups *mg,
 						 const char *name, struct map **mapp,

  reply	other threads:[~2013-10-11 13:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-09 12:01 [PATCH V6 0/8] perf tools: kcore improvements Adrian Hunter
2013-10-09 12:01 ` [PATCH V6 1/8] perf tools: validate kcore module addresses Adrian Hunter
2013-10-15  5:33   ` [tip:perf/core] perf symbols: Validate " tip-bot for Adrian Hunter
2013-10-09 12:01 ` [PATCH V6 2/8] perf tools: workaround objdump difficulties with kcore Adrian Hunter
2013-10-15  5:33   ` [tip:perf/core] perf symbols: Workaround " tip-bot for Adrian Hunter
2013-10-09 12:01 ` [PATCH V6 3/8] perf tools: add map__find_other_map_symbol() Adrian Hunter
2013-10-11 13:41   ` Arnaldo Carvalho de Melo [this message]
2013-10-09 12:01 ` [PATCH V6 4/8] perf tools: fix annotate_browser__callq() Adrian Hunter
2013-10-09 12:01 ` [PATCH V6 5/8] perf tools: find kcore symbols on other maps Adrian Hunter
2013-10-09 12:01 ` [PATCH V6 6/8] perf tools: add copyfile_mode() Adrian Hunter
2013-10-09 12:01 ` [PATCH V6 7/8] perf buildid-cache: add ability to add kcore to the cache Adrian Hunter
2013-10-09 12:01 ` [PATCH V6 8/8] perf tools: add ability to find kcore in build-id cache Adrian Hunter
2013-10-09 12:07 ` [PATCH V6 0/8] perf tools: kcore improvements Peter Zijlstra
2013-10-09 22:30   ` Andi Kleen
2013-10-10 12:48     ` Peter Zijlstra

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=20131011134153.GL28369@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=adrian.hunter@intel.com \
    --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.