This reverts commit de95ab53645a2f0015e0f68ee723f18dce2b8b51. 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.
Unified · Split
| @@ -928,33 +928,8 @@ int dso__load_sym(struct dso *dso, struct map *map, · 927 unmodified lines | ||
| 928 | 928 | * to it... |
| 929 | 929 | */ |
| 930 | 930 | if (symbol_conf.demangle) { |
| 931 | − /* | |
| 932 | − * The demangler doesn't deal with cloned functions. | |
| 933 | − * XXXX.clone.NUM or similar | |
| 934 | − * Strip the dot part and readd it later. | |
| 935 | − */ | |
| 936 | − char *p = (char *)elf_name, *dot; | |
| 937 | − dot = strchr(elf_name, '.'); | |
| 938 | − if (dot) { | |
| 939 | − p = strdup(elf_name); | |
| 940 | − if (!p) | |
| 941 | − goto new_symbol; | |
| 942 | − dot = strchr(p, '.'); | |
| 943 | − *dot = 0; | |
| 944 | − } | |
| 945 | − | |
| 946 | − demangled = bfd_demangle(NULL, p, | |
| 931 | + demangled = bfd_demangle(NULL, elf_name, | |
| 947 | 932 | DMGL_PARAMS | DMGL_ANSI); |
| 948 | − if (dot) | |
| 949 | − *dot = '.'; | |
| 950 | − if (demangled && dot) { | |
| 951 | − demangled = realloc(demangled, strlen(demangled) + strlen(dot) + 1); | |
| 952 | − if (!demangled) | |
| 953 | − goto new_symbol; | |
| 954 | − strcpy(demangled + (dot - p), dot); | |
| 955 | − } | |
| 956 | − if (p != elf_name) | |
| 957 | − free(p); | |
| 958 | 933 | if (demangled != NULL) |
| 959 | 934 | elf_name = demangled; |
| 960 | 935 | } |