Add backtrace_string and export to libmemunreachable

Add backtrace_string to convert a malloc_debug backtrace to a string.
Also move the backtrace functions to libc_malloc_debug_backtrace so that
libmemunreachable can reuse them.

Bug: 27208635
(cherry picked from commit 2c75991359df165ca7cc7a6213fb227c0b5ed87c)

Change-Id: Ia93aaf010fbce1ace058439427066ea2dfd8bd13
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index e079c7e..aa6f5f7 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -223,10 +223,10 @@
     g_debug->track->DisplayLeaks(*g_debug);
   }
 
-  backtrace_shutdown();
-
   DebugDisableSet(true);
 
+  backtrace_shutdown();
+
   delete g_debug;
   g_debug = nullptr;