Skip to contentSkip to conversation

perf probe: Fix regression of variable finder

PATCH New Masami Hiramatsu 1 participant 1 message Aug 20, 2011 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf probe: Fix regression of variable finder

Fix to call convert_variable() if previous call does not fail.

To call convert_variable, it ensures "ret" is 0. However, since "ret" has the return value of synthesize_perf_probe_arg() which always returns positive value if it succeeded, perf probe doesn't call convert_variable(). This will cause a SEGV when we add an event with arguments.

This has to be fixed as it ensures "ret" is greater than 0 (or not negative).

This regression has been introduced by my previous patch, f182e3e1.

Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>

---

 tools/perf/util/probe-finder.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/probe-finder.c +1 -1
index 555fc38..5d73262 100644
@@ -659,7 +659,7 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)
 		if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, 0, &vr_die))
 			ret = -ENOENT;
 	}
-	if (ret == 0)
+	if (ret >= 0)
 		ret = convert_variable(&vr_die, pf);
 
 	if (ret < 0)