[PATCH 9/9] Use BFD demangler
Alexander Monakov
amonakov at ispras.ru
Sun May 19 07:39:55 PDT 2013
---
CMakeLists.txt | 2 +-
common/trace_backtrace.cpp | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index db03031..6836553 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -262,7 +262,7 @@ endif ()
if (CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
add_subdirectory (thirdparty/libbacktrace)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libbacktrace)
- set (LIBBACKTRACE_LIBRARIES backtrace)
+ set (LIBBACKTRACE_LIBRARIES backtrace bfd)
endif ()
# Always use bundled QJSon.
diff --git a/common/trace_backtrace.cpp b/common/trace_backtrace.cpp
index 83c9d46..9b13f6d 100644
--- a/common/trace_backtrace.cpp
+++ b/common/trace_backtrace.cpp
@@ -274,6 +274,8 @@ std::vector<RawStackFrame> get_backtrace() {
#include <stdint.h>
#include <dlfcn.h>
+#define HAVE_DECL_BASENAME 1
+#include <demangle.h>
#include <map>
#include <vector>
@@ -330,6 +332,9 @@ class libbacktraceProvider {
frame.linenumber = line;
if (func)
frame.function = func;
+ int dem_style = DMGL_PARAMS|DMGL_ANSI|DMGL_VERBOSE|DMGL_AUTO;
+ if (func && (func = cplus_demangle_v3(func, dem_style)))
+ frame.function = func;
this_->current_frames->push_back(frame);
return 0;
}
--
1.8.1.2
More information about the apitrace
mailing list