[PATCH] perf, tools, script: Always print raw IP

From: Andi Kleen
Date: Fri Mar 06 2015 - 21:48:20 EST


From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

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.

Reported-by: Yuanfang Chen <cyfmxc@xxxxxxxxx>
Cc: Yuanfang Chen <cyfmxc@xxxxxxxxx>
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
tools/perf/util/srcline.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index c93fb0c..7d61f8b 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -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;
--
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/