Use abi::__cxa_demangle declared in cxxabi.h
Bug: http://b/175635923
Test: treehugger
Change-Id: Ia191be0b4861b011640edc703b55c13c88bce300
diff --git a/libc/malloc_debug/UnwindBacktrace.cpp b/libc/malloc_debug/UnwindBacktrace.cpp
index c892a39..8a6ff7b 100644
--- a/libc/malloc_debug/UnwindBacktrace.cpp
+++ b/libc/malloc_debug/UnwindBacktrace.cpp
@@ -26,6 +26,7 @@
* SUCH DAMAGE.
*/
+#include <cxxabi.h>
#include <inttypes.h>
#include <pthread.h>
#include <stdint.h>
@@ -48,8 +49,6 @@
#define PAD_PTR "08" PRIx64
#endif
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
bool Unwind(std::vector<uintptr_t>* frames, std::vector<unwindstack::FrameData>* frame_info,
size_t max_frames) {
[[clang::no_destroy]] static unwindstack::AndroidLocalUnwinder unwinder(
@@ -89,7 +88,8 @@
if (!info->function_name.empty()) {
line += " (";
- char* demangled_name = __cxa_demangle(info->function_name.c_str(), nullptr, nullptr, nullptr);
+ char* demangled_name =
+ abi::__cxa_demangle(info->function_name.c_str(), nullptr, nullptr, nullptr);
if (demangled_name != nullptr) {
line += demangled_name;
free(demangled_name);