aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-finder.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-04-12 13:17:22 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-04-14 16:28:09 -0400
commit11a1ca3554b377d2a8a318a3cbf8ce10a7a2a8e4 (patch)
tree36483c56ee6b7148247ef6fbe349b09ee8cfcb25 /tools/perf/util/probe-finder.c
parent4984912eb23113a4007940cd09c8351c0623ea5f (diff)
perf probe: Support basic type casting
Add basic type casting for arguments to perf probe. This allows users to specify the actual type of arguments. Of course, if user sets invalid types, kprobe-tracer rejects that. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20100412171722.3790.50372.stgit@localhost6.localdomain6> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-finder.c')
-rw-r--r--tools/perf/util/probe-finder.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index ebeb413ac473..ab476736cbe7 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -547,7 +547,10 @@ static void convert_variable(Dwarf_Die *vr_die, struct probe_finder *pf)
547 &die_mem); 547 &die_mem);
548 vr_die = &die_mem; 548 vr_die = &die_mem;
549 } 549 }
550 convert_variable_type(vr_die, pf->tvar); 550 if (pf->pvar->type)
551 pf->tvar->type = xstrdup(pf->pvar->type);
552 else
553 convert_variable_type(vr_die, pf->tvar);
551 /* *expr will be cached in libdw. Don't free it. */ 554 /* *expr will be cached in libdw. Don't free it. */
552 return ; 555 return ;
553error: 556error:
@@ -560,13 +563,16 @@ error:
560static void find_variable(Dwarf_Die *sp_die, struct probe_finder *pf) 563static void find_variable(Dwarf_Die *sp_die, struct probe_finder *pf)
561{ 564{
562 Dwarf_Die vr_die; 565 Dwarf_Die vr_die;
563 char buf[32]; 566 char buf[32], *ptr;
564 567
565 /* TODO: Support arrays */ 568 /* TODO: Support arrays */
566 if (pf->pvar->name) 569 if (pf->pvar->name)
567 pf->tvar->name = xstrdup(pf->pvar->name); 570 pf->tvar->name = xstrdup(pf->pvar->name);
568 else { 571 else {
569 synthesize_perf_probe_arg(pf->pvar, buf, 32); 572 synthesize_perf_probe_arg(pf->pvar, buf, 32);
573 ptr = strchr(buf, ':'); /* Change type separator to _ */
574 if (ptr)
575 *ptr = '_';
570 pf->tvar->name = xstrdup(buf); 576 pf->tvar->name = xstrdup(buf);
571 } 577 }
572 578