[tip:perf/urgent] perf probe: Fix type searching

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: tip-bot for Masami Hiramatsu
Date: Saturday, October 23, 2010 - 12:40 pm

Commit-ID:  4046b8bb5ffae9ee916e504cdadee804f10e0c56
Gitweb:     http://git.kernel.org/tip/4046b8bb5ffae9ee916e504cdadee804f10e0c56
Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Thu, 21 Oct 2010 19:13:02 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 21 Oct 2010 15:57:08 -0200

perf probe: Fix type searching

Fix to get the actual type die of variables by using dwarf_attr_integrate()
which gets attribute from die even if the type die is connected by
DW_AT_abstract_origin.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <20101021101302.3542.38549.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-finder.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 32b81f7..a2d1f79 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -160,26 +160,35 @@ static bool die_compare_name(Dwarf_Die *dw_die, const char *tname)
 	return name ? (strcmp(tname, name) == 0) : false;
 }
 
+/* Get type die */
+static Dwarf_Die *die_get_type(Dwarf_Die *vr_die, Dwarf_Die *die_mem)
+{
+	Dwarf_Attribute attr;
+
+	if (dwarf_attr_integrate(vr_die, DW_AT_type, &attr) &&
+	    dwarf_formref_die(&attr, die_mem))
+		return die_mem;
+	else
+		return NULL;
+}
+
 /* Get type die, but skip qualifiers and typedef */
 static Dwarf_Die *die_get_real_type(Dwarf_Die *vr_die, Dwarf_Die *die_mem)
 {
-	Dwarf_Attribute attr;
 	int tag;
 
 	do {
-		if (dwarf_attr(vr_die, DW_AT_type, &attr) == NULL ||
-		    dwarf_formref_die(&attr, die_mem) == NULL)
-			return NULL;
-
-		tag = dwarf_tag(die_mem);
-		vr_die = die_mem;
+		vr_die = die_get_type(vr_die, die_mem);
+		if (!vr_die)
+			break;
+		tag = dwarf_tag(vr_die);
 	} while (tag == DW_TAG_const_type ||
 		 tag == DW_TAG_restrict_type ||
 		 tag == DW_TAG_volatile_type ||
 		 tag == DW_TAG_shared_type ||
 		 tag == DW_TAG_typedef);
 
-	return die_mem;
+	return vr_die;
 }
 
 static bool die_is_signed_type(Dwarf_Die *tp_die)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -tip 0/7] Perf probe update (--vars/--module), Masami Hiramatsu, (Thu Oct 21, 3:12 am)
[PATCH -tip 1/7] [BUGFIX] perf probe: Fix type searching, Masami Hiramatsu, (Thu Oct 21, 3:13 am)
[PATCH -tip 3/7] perf probe: Support global variables, Masami Hiramatsu, (Thu Oct 21, 3:13 am)
[PATCH -tip 4/7] perf probe: Show accessible local variables, Masami Hiramatsu, (Thu Oct 21, 3:13 am)
[PATCH -tip 5/7] perf probe: Function style fix, Masami Hiramatsu, (Thu Oct 21, 3:13 am)
[PATCH -tip 6/7] perf probe: Show accessible global variables, Masami Hiramatsu, (Thu Oct 21, 3:13 am)
[PATCH -tip 7/7] perf probe: Add basic module support, Masami Hiramatsu, (Thu Oct 21, 3:13 am)
Re: [PATCH -tip 6/7] perf probe: Show accessible global v ..., Arnaldo Carvalho de Melo, (Thu Oct 21, 1:50 pm)
Re: [PATCH -tip 6/7] perf probe: Show accessible global v ..., Masami Hiramatsu, (Thu Oct 21, 7:25 pm)
Re: [PATCH -tip 6/7] perf probe: Show accessible global v ..., Masami Hiramatsu, (Thu Oct 21, 10:31 pm)
[tip:perf/urgent] perf probe: Fix type searching, tip-bot for Masami H ..., (Sat Oct 23, 12:40 pm)
[tip:perf/urgent] perf probe: Fix local variable searching ..., tip-bot for Masami H ..., (Sat Oct 23, 12:40 pm)
[tip:perf/urgent] perf probe: Support global variables, tip-bot for Masami H ..., (Sat Oct 23, 12:40 pm)
[tip:perf/urgent] perf probe: Show accessible local variables, tip-bot for Masami H ..., (Sat Oct 23, 12:41 pm)
[tip:perf/urgent] perf probe: Function style fix, tip-bot for Masami H ..., (Sat Oct 23, 12:41 pm)
[tip:perf/urgent] perf probe: Show accessible global variables, tip-bot for Masami H ..., (Sat Oct 23, 12:42 pm)
[tip:perf/urgent] perf probe: Add basic module support, tip-bot for Masami H ..., (Sat Oct 23, 12:42 pm)