Last change
on this file was
2573,
checked in by ymipsl, 10 months ago
|
create new external source lib : cpptrace, for statck trace output
YM
|
File size:
663 bytes
|
Rev | Line | |
---|
[2573] | 1 | #ifdef CPPTRACE_DEMANGLE_WITH_CXXABI |
---|
| 2 | |
---|
| 3 | #include "demangle.hpp" |
---|
| 4 | |
---|
| 5 | #include <cxxabi.h> |
---|
| 6 | |
---|
| 7 | #include <cstdlib> |
---|
| 8 | #include <string> |
---|
| 9 | |
---|
| 10 | namespace cpptrace { |
---|
| 11 | namespace detail { |
---|
| 12 | std::string demangle(const std::string& name) { |
---|
| 13 | int status; |
---|
| 14 | // presumably thread-safe |
---|
| 15 | char* demangled = abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status); |
---|
| 16 | if(demangled) { |
---|
| 17 | std::string str = demangled; |
---|
| 18 | // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) |
---|
| 19 | free(demangled); |
---|
| 20 | return str; |
---|
| 21 | } else { |
---|
| 22 | return name; |
---|
| 23 | } |
---|
| 24 | } |
---|
| 25 | } |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.