aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2010-07-09 05:29:17 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-07-16 10:48:34 -0400
commit8217563359878d11ef03cc76bc935ada89d73efd (patch)
treecdf0d275229100cf1c5ce2aa2b19dfbceacef7d7 /tools
parent6a330a3c8a648916b3c6bda79a78c38ac093af17 (diff)
perf probe: Fix the logic of die_compare_name
Invert the return value of die_compare_name(), because it returns a 'bool' result which should be expeced true if the die's name is same as compared string. LKML-Reference: <4C36EBED.1000006@hitachi.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> 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/probe-finder.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 37dcdb651a69..f88070ea5b90 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -158,7 +158,7 @@ static bool die_compare_name(Dwarf_Die *dw_die, const char *tname)
158{ 158{
159 const char *name; 159 const char *name;
160 name = dwarf_diename(dw_die); 160 name = dwarf_diename(dw_die);
161 return name ? strcmp(tname, name) : -1; 161 return name ? (strcmp(tname, name) == 0) : false;
162} 162}
163 163
164/* Get type die, but skip qualifiers and typedef */ 164/* Get type die, but skip qualifiers and typedef */
@@ -329,7 +329,7 @@ static int __die_find_variable_cb(Dwarf_Die *die_mem, void *data)
329 tag = dwarf_tag(die_mem); 329 tag = dwarf_tag(die_mem);
330 if ((tag == DW_TAG_formal_parameter || 330 if ((tag == DW_TAG_formal_parameter ||
331 tag == DW_TAG_variable) && 331 tag == DW_TAG_variable) &&
332 (die_compare_name(die_mem, name) == 0)) 332 die_compare_name(die_mem, name))
333 return DIE_FIND_CB_FOUND; 333 return DIE_FIND_CB_FOUND;
334 334
335 return DIE_FIND_CB_CONTINUE; 335 return DIE_FIND_CB_CONTINUE;
@@ -348,7 +348,7 @@ static int __die_find_member_cb(Dwarf_Die *die_mem, void *data)
348 const char *name = data; 348 const char *name = data;
349 349
350 if ((dwarf_tag(die_mem) == DW_TAG_member) && 350 if ((dwarf_tag(die_mem) == DW_TAG_member) &&
351 (die_compare_name(die_mem, name) == 0)) 351 die_compare_name(die_mem, name))
352 return DIE_FIND_CB_FOUND; 352 return DIE_FIND_CB_FOUND;
353 353
354 return DIE_FIND_CB_SIBLING; 354 return DIE_FIND_CB_SIBLING;
@@ -506,8 +506,8 @@ static int convert_variable_type(Dwarf_Die *vr_die,
506 return -ENOMEM; 506 return -ENOMEM;
507 } 507 }
508 } 508 }
509 if (die_compare_name(&type, "char") != 0 && 509 if (!die_compare_name(&type, "char") &&
510 die_compare_name(&type, "unsigned char") != 0) { 510 !die_compare_name(&type, "unsigned char")) {
511 pr_warning("Failed to cast into string: " 511 pr_warning("Failed to cast into string: "
512 "%s is not (unsigned) char *.", 512 "%s is not (unsigned) char *.",
513 dwarf_diename(vr_die)); 513 dwarf_diename(vr_die));
@@ -1017,7 +1017,7 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data)
1017 1017
1018 /* Check tag and diename */ 1018 /* Check tag and diename */
1019 if (dwarf_tag(sp_die) != DW_TAG_subprogram || 1019 if (dwarf_tag(sp_die) != DW_TAG_subprogram ||
1020 die_compare_name(sp_die, pp->function) != 0) 1020 !die_compare_name(sp_die, pp->function))
1021 return DWARF_CB_OK; 1021 return DWARF_CB_OK;
1022 1022
1023 pf->fname = dwarf_decl_file(sp_die); 1023 pf->fname = dwarf_decl_file(sp_die);
@@ -1340,7 +1340,7 @@ static int line_range_search_cb(Dwarf_Die *sp_die, void *data)
1340 struct line_range *lr = lf->lr; 1340 struct line_range *lr = lf->lr;
1341 1341
1342 if (dwarf_tag(sp_die) == DW_TAG_subprogram && 1342 if (dwarf_tag(sp_die) == DW_TAG_subprogram &&
1343 die_compare_name(sp_die, lr->function) == 0) { 1343 die_compare_name(sp_die, lr->function)) {
1344 lf->fname = dwarf_decl_file(sp_die); 1344 lf->fname = dwarf_decl_file(sp_die);
1345 dwarf_decl_line(sp_die, &lr->offset); 1345 dwarf_decl_line(sp_die, &lr->offset);
1346 pr_debug("fname: %s, lineno:%d\n", lf->fname, lr->offset); 1346 pr_debug("fname: %s, lineno:%d\n", lf->fname, lr->offset);