Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a0e55d8 authored by Anton Blanchard's avatar Anton Blanchard Committed by Arnaldo Carvalho de Melo
Browse files

perf symbols: Synthesize anonymous mmap events



perf_event__synthesize_mmap_events does not create anonymous mmap events
even though the kernel does. As a result an already running application
with dynamically created code will not get profiled - all samples end up
in the unknown bucket.

This patch skips any entries with '[' in the name to avoid adding events
for special regions (eg the vsyscall page). All other executable mmaps
are assumed to be anonymous and an event is synthesized.

Acked-by: default avatarPekka Enberg <penberg@kernel.org>
Cc: Eric B Munson <emunson@mgebm.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Link: http://lkml.kernel.org/r/20110830091506.60b51fe8@kryten


Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 764e16a3
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -169,12 +169,17 @@ static int perf_event__synthesize_mmap_events(union perf_event *event,
			continue;
			continue;
		pbf += n + 3;
		pbf += n + 3;
		if (*pbf == 'x') { /* vm_exec */
		if (*pbf == 'x') { /* vm_exec */
			char anonstr[] = "//anon\n";
			char *execname = strchr(bf, '/');
			char *execname = strchr(bf, '/');


			/* Catch VDSO */
			/* Catch VDSO */
			if (execname == NULL)
			if (execname == NULL)
				execname = strstr(bf, "[vdso]");
				execname = strstr(bf, "[vdso]");


			/* Catch anonymous mmaps */
			if ((execname == NULL) && !strstr(bf, "["))
				execname = anonstr;

			if (execname == NULL)
			if (execname == NULL)
				continue;
				continue;