Commit b5872de8 authored by Eric Cano's avatar Eric Cano
Browse files

Fixed (and simplified) backtrace that went wrong when demangling a function...

Fixed (and simplified) backtrace that went wrong when demangling a function name longer than 200 characters.
parent 3ae7aace
......@@ -46,9 +46,7 @@ castor::exception::Backtrace::Backtrace(): m_trace() {
theFunc = line.substr(line.find("(")+1, line.find("+") - (line.find("(") + 1));
after = line.substr(line.find("+"), std::string::npos);
int status(-1);
char demangled[200];
size_t length(sizeof(demangled));
abi::__cxa_demangle(theFunc.c_str(), demangled, &length, &status);
char * demangled = abi::__cxa_demangle(theFunc.c_str(), NULL, NULL, &status);
if (0 == status) {
m_trace += before;
m_trace += demangled;
......@@ -58,6 +56,7 @@ castor::exception::Backtrace::Backtrace(): m_trace() {
m_trace += strings[i];
m_trace += "\n";
}
free(demangled);
} else {
m_trace += strings[i];
m_trace += "\n";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment