Use the demangler from libunwindstack.

The current demangler does not handle rust code, so use the libunwindstack
demangler which does.

Test: All unit tests pass.
Test: Verified that backtraces through Rust code get demangled.
Change-Id: I8fa45d88d9c1664c9f164edeab2a55d7c18b1283
diff --git a/libc/malloc_debug/PointerData.cpp b/libc/malloc_debug/PointerData.cpp
index c8aaa08..5129bf6 100644
--- a/libc/malloc_debug/PointerData.cpp
+++ b/libc/malloc_debug/PointerData.cpp
@@ -26,7 +26,6 @@
  * SUCH DAMAGE.
  */
 
-#include <cxxabi.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <signal.h>
@@ -49,6 +48,7 @@
 #include <android-base/stringprintf.h>
 #include <android-base/thread_annotations.h>
 #include <platform/bionic/macros.h>
+#include <unwindstack/Demangle.h>
 
 #include "Config.h"
 #include "DebugData.h"
@@ -619,16 +619,9 @@
         if (frame.function_name.empty()) {
           dprintf(fd, " \"\" 0}");
         } else {
-          char* demangled_name =
-              abi::__cxa_demangle(frame.function_name.c_str(), nullptr, nullptr, nullptr);
-          const char* name;
-          if (demangled_name != nullptr) {
-            name = demangled_name;
-          } else {
-            name = frame.function_name.c_str();
-          }
-          dprintf(fd, " \"%s\" %" PRIx64 "}", name, frame.function_offset);
-          free(demangled_name);
+          dprintf(fd, " \"%s\" %" PRIx64 "}",
+                  unwindstack::DemangleNameIfNeeded(frame.function_name).c_str(),
+                  frame.function_offset);
         }
       }
       dprintf(fd, "\n");