aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-finder.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-04-02 12:50:53 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-02 13:35:43 -0400
commit12e5a7ae475ccb2733d740ffb95d9ca0a18392da (patch)
treecfadd42c251612ead5db477f310318b774bc7d17 /tools/perf/util/probe-finder.c
parentc9e385826d4f1ca5a72005ab8503598f791a8dc0 (diff)
perf probe: Correct error message for non-structure type
perf probe outputs incorrect error message when it is called with non-existent field on a non-data structure local variable. <Before> # perf probe vfs_read 'count.hoge' Fatal: Structure on a register is not supported yet. # perf probe vfs_read 'count->hoge' Fatal: Semantic error: hoge must be referred by '.' This corrects the messsage. <After> # perf probe vfs_read 'count.hoge' Fatal: count is not a data structure. # perf probe vfs_read 'count->hoge' Fatal: count is not a data structure. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> LKML-Reference: <20100402165052.23551.75866.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/probe-finder.c')
-rw-r--r--tools/perf/util/probe-finder.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index b44132ead95a..59b0115de30a 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -429,12 +429,20 @@ static void convert_variable_fields(Dwarf_Die *vr_die, const char *varname,
429 if (die_get_real_type(&type, &type) == NULL) 429 if (die_get_real_type(&type, &type) == NULL)
430 die("Failed to get a type information of %s.", varname); 430 die("Failed to get a type information of %s.", varname);
431 431
432 /* Verify it is a data structure */
433 if (dwarf_tag(&type) != DW_TAG_structure_type)
434 die("%s is not a data structure.", varname);
435
432 ref = xzalloc(sizeof(struct kprobe_trace_arg_ref)); 436 ref = xzalloc(sizeof(struct kprobe_trace_arg_ref));
433 if (*ref_ptr) 437 if (*ref_ptr)
434 (*ref_ptr)->next = ref; 438 (*ref_ptr)->next = ref;
435 else 439 else
436 *ref_ptr = ref; 440 *ref_ptr = ref;
437 } else { 441 } else {
442 /* Verify it is a data structure */
443 if (dwarf_tag(&type) != DW_TAG_structure_type)
444 die("%s is not a data structure.", varname);
445
438 if (field->ref) 446 if (field->ref)
439 die("Semantic error: %s must be referred by '.'", 447 die("Semantic error: %s must be referred by '.'",
440 field->name); 448 field->name);
@@ -442,10 +450,6 @@ static void convert_variable_fields(Dwarf_Die *vr_die, const char *varname,
442 die("Structure on a register is not supported yet."); 450 die("Structure on a register is not supported yet.");
443 } 451 }
444 452
445 /* Verify it is a data structure */
446 if (dwarf_tag(&type) != DW_TAG_structure_type)
447 die("%s is not a data structure.", varname);
448
449 if (die_find_member(&type, field->name, &member) == NULL) 453 if (die_find_member(&type, field->name, &member) == NULL)
450 die("%s(tyep:%s) has no member %s.", varname, 454 die("%s(tyep:%s) has no member %s.", varname,
451 dwarf_diename(&type), field->name); 455 dwarf_diename(&type), field->name);