|
33 | 33 | #include "runtime/os.hpp"
|
34 | 34 | #include "utilities/align.hpp"
|
35 | 35 | #include "utilities/debug.hpp"
|
36 |
| - |
37 |
| -// distinguish old xlc and xlclang++, where |
38 |
| -// <ibmdemangle.h> is suggested but not found in GA release (might come with a fix) |
39 |
| -#if defined(__clang__) |
40 |
| -#define DISABLE_DEMANGLE |
41 |
| -// #include <ibmdemangle.h> |
42 |
| -#else |
43 |
| -#include <demangle.h> |
44 |
| -#endif |
45 |
| - |
| 36 | +#include <cxxabi.h> |
46 | 37 | #include <sys/debug.h>
|
47 | 38 | #include <pthread.h>
|
48 | 39 | #include <ucontext.h>
|
@@ -244,21 +235,18 @@ bool AixSymbols::get_function_name (
|
244 | 235 | }
|
245 | 236 | p_name[i] = '\0';
|
246 | 237 |
|
247 |
| - // If it is a C++ name, try and demangle it using the Demangle interface (see demangle.h). |
248 |
| -#ifndef DISABLE_DEMANGLE |
| 238 | + // If it is a C++ name, try and demangle it using the __cxa_demangle interface(see demangle.h). |
249 | 239 | if (demangle) {
|
250 |
| - char* rest; |
251 |
| - Name* const name = Demangle(p_name, rest); |
252 |
| - if (name) { |
253 |
| - const char* const demangled_name = name->Text(); |
254 |
| - if (demangled_name) { |
255 |
| - strncpy(p_name, demangled_name, namelen-1); |
256 |
| - p_name[namelen-1] = '\0'; |
257 |
| - } |
258 |
| - delete name; |
| 240 | + int status; |
| 241 | + char *demangled_name = abi::__cxa_demangle(p_name, nullptr, nullptr, &status); |
| 242 | + if ((demangled_name != nullptr) && (status == 0)) { |
| 243 | + strncpy(p_name, demangled_name, namelen-1); |
| 244 | + p_name[namelen-1] = '\0'; |
| 245 | + } |
| 246 | + if (demangled_name != nullptr) { |
| 247 | + ALLOW_C_FUNCTION(::free, ::free(demangled_name)); |
259 | 248 | }
|
260 | 249 | }
|
261 |
| -#endif |
262 | 250 | } else {
|
263 | 251 | strncpy(p_name, "<nameless function>", namelen-1);
|
264 | 252 | p_name[namelen-1] = '\0';
|
|
0 commit comments