Commit 4046b8bb authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Arnaldo Carvalho de Melo

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: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f4bc6bb2
...@@ -160,26 +160,35 @@ static bool die_compare_name(Dwarf_Die *dw_die, const char *tname) ...@@ -160,26 +160,35 @@ static bool die_compare_name(Dwarf_Die *dw_die, const char *tname)
return name ? (strcmp(tname, name) == 0) : false; 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 */ /* Get type die, but skip qualifiers and typedef */
static Dwarf_Die *die_get_real_type(Dwarf_Die *vr_die, Dwarf_Die *die_mem) static Dwarf_Die *die_get_real_type(Dwarf_Die *vr_die, Dwarf_Die *die_mem)
{ {
Dwarf_Attribute attr;
int tag; int tag;
do { do {
if (dwarf_attr(vr_die, DW_AT_type, &attr) == NULL || vr_die = die_get_type(vr_die, die_mem);
dwarf_formref_die(&attr, die_mem) == NULL) if (!vr_die)
return NULL; break;
tag = dwarf_tag(vr_die);
tag = dwarf_tag(die_mem);
vr_die = die_mem;
} while (tag == DW_TAG_const_type || } while (tag == DW_TAG_const_type ||
tag == DW_TAG_restrict_type || tag == DW_TAG_restrict_type ||
tag == DW_TAG_volatile_type || tag == DW_TAG_volatile_type ||
tag == DW_TAG_shared_type || tag == DW_TAG_shared_type ||
tag == DW_TAG_typedef); tag == DW_TAG_typedef);
return die_mem; return vr_die;
} }
static bool die_is_signed_type(Dwarf_Die *tp_die) static bool die_is_signed_type(Dwarf_Die *tp_die)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment