aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2011-08-11 07:03:18 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-08-12 08:34:35 -0400
commit3f4460a28fb2f73df6c32c3a305797abc01c0f9c (patch)
treeb3c6864c3da3d864471f74a5014800ac38f62dcd /tools
parentdb0d2c6420eeb8fd669bac84d72f1ab828bbaa64 (diff)
perf probe: Filter out redundant inline-instances
With gcc4.6, some instances of concrete inlined function looks redundant and broken, because it appears inside of a concrete instance and its call_file and call_line are same as the original abstruct's decl_file and decl_line respectively. e.g. [ d1aa] subprogram external (flag) Yes name (strp) "add_timer" decl_file (data1) 2 ;here is original decl_line (data2) 847 ;line and file prototyped (flag) Yes inline (data1) inlined (1) sibling (ref4) [ d1c6] ... [ 11d84] subprogram abstract_origin (ref4) [ d1aa] ; concrete instance low_pc (addr) .text+0x000000000000246f <add_timer> high_pc (addr) .text+0x000000000000248b <mod_timer_pending> frame_base (block1) [ 0] call_frame_cfa sibling (ref4) [ 11dd9] [ 11d9f] formal_parameter abstract_origin (ref4) [ d1b9] location (data4) location list [ 701b] [ 11da8] inlined_subroutine abstract_origin (ref4) [ d1aa] ; redundant instance low_pc (addr) .text+0x000000000000247e <add_timer+0xf> high_pc (addr) .text+0x0000000000002480 <add_timer+0x11> call_file (data1) 2 ; call line and file call_line (data2) 847 ; are same as above Those redundant instances leads unwilling results; e.g. find probe points inside of functions even if we specify a function entry as below; $ perf probe -V add_timer Available variables at add_timer @<add_timer+0> struct timer_list* timer @<add_timer+15> (No matched variables) So, this filters out those redundant instances based on call-site and decl-site information. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: yrl.pp-manager.tt@hitachi.com Link: http://lkml.kernel.org/r/20110811110317.19900.59525.stgit@fedora15 Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/dwarf-aux.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index d0f4048b634f..ee51e9b4dc09 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -307,6 +307,17 @@ static int die_get_call_fileno(Dwarf_Die *in_die)
307 return -ENOENT; 307 return -ENOENT;
308} 308}
309 309
310/* Get the declared file index number in CU DIE */
311static int die_get_decl_fileno(Dwarf_Die *pdie)
312{
313 Dwarf_Sword idx;
314
315 if (die_get_attr_sdata(pdie, DW_AT_decl_file, &idx) == 0)
316 return (int)idx;
317 else
318 return -ENOENT;
319}
320
310/** 321/**
311 * die_get_call_file - Get callsite file name of inlined function instance 322 * die_get_call_file - Get callsite file name of inlined function instance
312 * @in_die: a DIE of an inlined function instance 323 * @in_die: a DIE of an inlined function instance
@@ -467,6 +478,7 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data)
467 Dwarf_Die origin_mem; 478 Dwarf_Die origin_mem;
468 Dwarf_Attribute *attr; 479 Dwarf_Attribute *attr;
469 Dwarf_Die *origin; 480 Dwarf_Die *origin;
481 int tmp;
470 482
471 attr = dwarf_attr(inst, DW_AT_abstract_origin, &attr_mem); 483 attr = dwarf_attr(inst, DW_AT_abstract_origin, &attr_mem);
472 if (attr == NULL) 484 if (attr == NULL)
@@ -476,6 +488,16 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data)
476 if (origin == NULL || origin->addr != iwp->addr) 488 if (origin == NULL || origin->addr != iwp->addr)
477 return DIE_FIND_CB_CONTINUE; 489 return DIE_FIND_CB_CONTINUE;
478 490
491 /* Ignore redundant instances */
492 if (dwarf_tag(inst) == DW_TAG_inlined_subroutine) {
493 dwarf_decl_line(origin, &tmp);
494 if (die_get_call_lineno(inst) == tmp) {
495 tmp = die_get_decl_fileno(origin);
496 if (die_get_call_fileno(inst) == tmp)
497 return DIE_FIND_CB_CONTINUE;
498 }
499 }
500
479 iwp->retval = iwp->callback(inst, iwp->data); 501 iwp->retval = iwp->callback(inst, iwp->data);
480 502
481 return (iwp->retval) ? DIE_FIND_CB_END : DIE_FIND_CB_CONTINUE; 503 return (iwp->retval) ? DIE_FIND_CB_END : DIE_FIND_CB_CONTINUE;