Skip to contentSkip to conversation

perf, tools, script: Always print raw IP

PATCH New Andi Kleen 1 participant 1 message Mar 7, 2015 perf events

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 perf, tools, script: Always print raw IP

From: Andi Kleen <[email protected]>

Fix regression caused by 85c116a6cb

We did not print the IP anymore for perf script -o ip, but instead symbol+offset, and if there was no symbol only +offset.

Print the raw IP correctly again in this case.

---
 tools/perf/util/srcline.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/util/srcline.c +8 -2
index c93fb0c..7d61f8b 100644
@@ -293,8 +293,14 @@ out:
 		dso__free_a2l(dso);
 	}
 	if (sym) {
-		if (asprintf(&srcline, "%s+%" PRIu64, show_sym ? sym->name : "",
-					addr - sym->start) < 0)
+		int err;
+
+		if (show_sym)
+			err = asprintf(&srcline, "%s+%" PRIu64, sym->name,
+					addr - sym->start);
+		else
+			err = asprintf(&srcline, "%" PRIx64, addr);
+		if (err < 0)
 			return SRCLINE_UNKNOWN;
 	} else if (asprintf(&srcline, "%s[%" PRIx64 "]", dso->short_name, addr) < 0)
 		return SRCLINE_UNKNOWN;
Signature · 1 line
1.9.3