[PATCH 9/9] Use BFD demangler

Alexander Monakov amonakov at ispras.ru
Sun May 19 22:50:01 PDT 2013


On Sun, 19 May 2013, José Fonseca wrote:

> Possibly an even simpler (both from licensing and dependency POV) would be
> libstdc++'s abi::__cxa_demangle. Have you tried that?

Good idea, thanks.

diff --git a/common/trace_backtrace.cpp b/common/trace_backtrace.cpp
index 83c9d46..a47ae9e 100644
--- a/common/trace_backtrace.cpp
+++ b/common/trace_backtrace.cpp
@@ -276,6 +276,7 @@ std::vector<RawStackFrame> get_backtrace() {
 #include <dlfcn.h>
 #include <map>
 #include <vector>
+#include <cxxabi.h>

 #include "backtrace.h"

@@ -330,6 +331,9 @@ class libbacktraceProvider {
         frame.linenumber = line;
         if (func)
             frame.function = func;
+        int status;
+        if (func && (func = abi::__cxa_demangle(func, NULL, NULL, &status)))
+            frame.function = func;
         this_->current_frames->push_back(frame);
         return 0;
     }


More information about the apitrace mailing list