MCPcopy Create free account
hub / github.com/bloomberg/pystack / demangleSymbol

Method demangleSymbol

src/pystack/_pystack/unwinder.cpp:400–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400std::string
401AbstractUnwinder::demangleSymbol(const std::string& symbol)
402{
403 // Require GNU v3 ABI by the "_Z" prefix.
404 if (symbol[0] != '_' || symbol[1] != 'Z') {
405 LOG(DEBUG) << "Symbol " << symbol << " cannot be demangled";
406 return symbol;
407 }
408 int status = -1;
409 char* dsymname = abi::__cxa_demangle(symbol.c_str(), nullptr, nullptr, &status);
410 if (status != 0) {
411 LOG(DEBUG) << "Failed to demangle symbol " << symbol << " with error: " << status;
412 return symbol;
413 }
414 LOG(DEBUG) << "Successfully demangled symbol " << symbol << " to: " << dsymname;
415 std::string new_symbol(dsymname);
416 free(dsymname);
417 return new_symbol;
418}
419
420Unwinder::Unwinder(std::shared_ptr<ProcessAnalyzer> analyzer)
421: d_analyzer(std::move(analyzer))

Callers

nothing calls this directly

Calls 1

LOGClass · 0.85

Tested by

no test coverage detected