Use abi::__cxa_demangle declared in cxxabi.h
Bug: http://b/175635923
Test: treehugger
Change-Id: Ia191be0b4861b011640edc703b55c13c88bce300
diff --git a/libc/malloc_debug/PointerData.cpp b/libc/malloc_debug/PointerData.cpp
index 5ab2232..e3a35a6 100644
--- a/libc/malloc_debug/PointerData.cpp
+++ b/libc/malloc_debug/PointerData.cpp
@@ -26,6 +26,7 @@
* SUCH DAMAGE.
*/
+#include <cxxabi.h>
#include <errno.h>
#include <inttypes.h>
#include <signal.h>
@@ -54,8 +55,6 @@
#include "malloc_debug.h"
#include "UnwindBacktrace.h"
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
std::atomic_uint8_t PointerData::backtrace_enabled_;
std::atomic_bool PointerData::backtrace_dump_;
@@ -617,8 +616,8 @@
if (frame.function_name.empty()) {
dprintf(fd, " \"\" 0}");
} else {
- char* demangled_name = __cxa_demangle(frame.function_name.c_str(), nullptr, nullptr,
- nullptr);
+ char* demangled_name =
+ abi::__cxa_demangle(frame.function_name.c_str(), nullptr, nullptr, nullptr);
const char* name;
if (demangled_name != nullptr) {
name = demangled_name;