From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Mike Galbraith" <efault@gmx.de>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Paul Mackerras" <paulus@samba.org>
Subject: [PATCH 2/4] perf symbols: Introduce symbol_type__is_a
Date: Fri, 11 Dec 2009 14:50:37 -0200 [thread overview]
Message-ID: <1260550239-5372-2-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1260550239-5372-1-git-send-email-acme@infradead.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
For selecting the right types of symbols in /proc/kallsyms, will be
followed by elf_symbol_type__is_a, for the same purpose on ELF symtabs.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/event.h | 4 ++--
tools/perf/util/symbol.c | 15 +++++++++++----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index c7a78ee..d9a65d9 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -103,10 +103,10 @@ void event__print_totals(void);
enum map_type {
MAP__FUNCTION = 0,
-
- MAP__NR_TYPES,
};
+#define MAP__NR_TYPES (MAP__FUNCTION + 1)
+
struct map {
union {
struct rb_node rb_node;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 9362023..bb21c96 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -56,6 +56,16 @@ static void dso__set_loaded(struct dso *self, enum map_type type)
self->loaded |= (1 << type);
}
+static bool symbol_type__is_a(char symbol_type, enum map_type map_type)
+{
+ switch (map_type) {
+ case MAP__FUNCTION:
+ return symbol_type == 'T' || symbol_type == 'W';
+ default:
+ return false;
+ }
+}
+
static void symbols__fixup_end(struct rb_root *self)
{
struct rb_node *nd, *prevnd = rb_first(self);
@@ -327,10 +337,7 @@ static int dso__load_all_kallsyms(struct dso *self, struct map *map)
continue;
symbol_type = toupper(line[len]);
- /*
- * We're interested only in code ('T'ext)
- */
- if (symbol_type != 'T' && symbol_type != 'W')
+ if (!symbol_type__is_a(symbol_type, map->type))
continue;
symbol_name = line + len + 2;
--
1.6.2.5
next prev parent reply other threads:[~2009-12-11 16:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-11 16:50 [PATCH 1/4] perf symbols: Rename kthreads to kmaps, using another abstraction for it Arnaldo Carvalho de Melo
2009-12-11 16:50 ` Arnaldo Carvalho de Melo [this message]
2009-12-11 16:50 ` [PATCH 3/4] perf symbols: Introduce ELF counterparts to symbol_type__is_a Arnaldo Carvalho de Melo
2009-12-11 16:50 ` [PATCH 4/4] perf symbols: Add support for 'variable' symtabs Arnaldo Carvalho de Melo
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=1260550239-5372-2-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®