From f3e08c5341c528284460530b546608f27232f737 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Fri, 22 May 2009 15:34:54 +0200 Subject: [PATCH] perf report: Fix segfault on unknown symbols Ingo reported: > Program received signal SIGSEGV, Segmentation fault. > 0x0000003e25080f80 in strlen () from /lib64/libc.so.6 > Missing separate debuginfos, use: debuginfo-install elfutils.x86_64 > glibc.x86_64 zlib.x86_64 > (gdb) bt > #0 0x0000003e25080f80 in strlen () from /lib64/libc.so.6 > #1 0x0000003e2506954e in fputs () from /lib64/libc.so.6 > #2 0x00000000004059e8 in cmd_report (argc=, > argv=) at builtin-report.c:521 > #3 0x0000000000402dad in handle_internal_command (argc=1, argv=0x7fffe1218e30) > at perf.c:226 > #4 0x0000000000402f6d in main (argc=1, argv=0x7fffe1218e30) at perf.c:324 > (gdb) Signed-off-by Peter Zijlstra Cc: Paul Mackerras Cc: Corey Ashford Cc: Marcelo Tosatti Cc: Arnaldo Carvalho de Melo Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- Documentation/perf_counter/builtin-report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c index e857201e1e0f..21386a8c6f62 100644 --- a/Documentation/perf_counter/builtin-report.c +++ b/Documentation/perf_counter/builtin-report.c @@ -518,7 +518,7 @@ static size_t symhist__fprintf(struct symhist *self, FILE *fp) size_t ret = fprintf(fp, "%#llx [%c] ", (unsigned long long)self->ip, self->level); if (self->level != '.') - ret += fprintf(fp, "%s", self->sym->name); + ret += fprintf(fp, "%s", self->sym ? self->sym->name: ""); else ret += fprintf(fp, "%s: %s", self->dso ? self->dso->name : "