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

Commit 14951f22 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Revert "perf symbols: Demangle cloned functions"



This reverts commit de95ab53.

Markus Trippelsdorf reported that this commit broke 'perf top':

 > I just see a gray screen with no text at all. Sometimes the
 > following error messages are printed:
 >
 >  *** Error in `perf': invalid fastbin entry (free): 0x00000000029b18c0
 >  ***
 >  *** Error in `perf': malloc(): memory corruption (fast): 0x0000000000ee0b10 ***

While this code is fixable, the commit itself fails on several levels:

 - it should have been a separate helper function
 - why the heck does it do strchr() twice
 - it casts a const char * over into char *
 - sloppy style
 - it's not even a regression fix!

So lets revert it and re-try the patch in v3.13.

Reported-by: default avatarMarkus Trippelsdorf <markus@trippelsdorf.de>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 9b565a80
Loading
Loading
Loading
Loading
+1 −26
Original line number Original line Diff line number Diff line
@@ -928,33 +928,8 @@ int dso__load_sym(struct dso *dso, struct map *map,
		 * to it...
		 * to it...
		 */
		 */
		if (symbol_conf.demangle) {
		if (symbol_conf.demangle) {
			/*
			demangled = bfd_demangle(NULL, elf_name,
			 * The demangler doesn't deal with cloned functions.
			 * XXXX.clone.NUM or similar
			 * Strip the dot part and readd it later.
			 */
			char *p = (char *)elf_name, *dot;
			dot = strchr(elf_name, '.');
			if (dot) {
				p = strdup(elf_name);
				if (!p)
					goto new_symbol;
				dot = strchr(p, '.');
				*dot = 0;
			}

			demangled = bfd_demangle(NULL, p,
						 DMGL_PARAMS | DMGL_ANSI);
						 DMGL_PARAMS | DMGL_ANSI);
			if (dot)
				*dot = '.';
			if (demangled && dot) {
				demangled = realloc(demangled, strlen(demangled) + strlen(dot) + 1);
				if (!demangled)
					goto new_symbol;
				strcpy(demangled + (dot - p), dot);
			}
			if (p != elf_name)
				free(p);
			if (demangled != NULL)
			if (demangled != NULL)
				elf_name = demangled;
				elf_name = demangled;
		}
		}