aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-08-18 07:52:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-18 08:00:52 -0400
commit15f3fa4e7f608c5ce19187b3b4a953222fdfa751 (patch)
tree97ef1f8e7beb151759a664ddda1a4d1c5cfdc84d
parentf738eb1b63edf664da1b4ac76895d988749b2f07 (diff)
perf annotate: Fix segmentation fault
Linus reported this perf annotate segfault: [torvalds@nehalem git]$ perf annotate unmap_vmas Segmentation fault #0 map__clone (self=<value optimized out>) at builtin-annotate.c:236 #1 thread__fork (self=<value optimized out>) at builtin-annotate.c:372 The bug here was that builtin-annotate.c was a copy of builtin-report.c and a threading related fix to builtin-report.c didnt get propagated to builtin-annotate.c ... Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--tools/perf/builtin-annotate.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 1dba568e1941..343e7b14bf01 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -980,6 +980,13 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head)
980 (void *)(long)(event->header.size), 980 (void *)(long)(event->header.size),
981 event->fork.pid, event->fork.ppid); 981 event->fork.pid, event->fork.ppid);
982 982
983 /*
984 * A thread clone will have the same PID for both
985 * parent and child.
986 */
987 if (thread == parent)
988 return 0;
989
983 if (!thread || !parent || thread__fork(thread, parent)) { 990 if (!thread || !parent || thread__fork(thread, parent)) {
984 dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); 991 dprintf("problem processing PERF_EVENT_FORK, skipping event.\n");
985 return -1; 992 return -1;