bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.73k stars 471 forks source link

Feature request: Public API for demangler #197

Open arthurp opened 3 years ago

arthurp commented 3 years ago

It would be useful to provide a public API for demangler::demangle. It can demangle typeid names, so it would be handy for debugging and logging even without a stack trace. And it's already portable unlike directly using other demangling APIs.

Ideally the API would be a simple function: std::string backward::demangle(const char *name) (with the returned std::string owning it's char buffer). However that may not work due to memory management issues. So just providing a public name for demangler so that users could construct one would be fine.

ArekPiekarz commented 3 years ago

For what it's worth, Boost already provides a portable demangling utility in Boost.Core - https://www.boost.org/doc/libs/1_75_0/libs/core/doc/html/core/demangle.html