Introduction to resolving addresses to function and source locations and demangled names.
Libcwd reads the symbol table of the application and of each of the linked object files upon initialization. It then allows you to translate program counter addresses to function names, source file names and line numbers. You can also print demangled names of any symbol or type, making the debug output better human readable.
Example 1: printing the location that a function was called from:
Example 2: Printing the demangled name of the current (template) function:
Note that calling libcwd::demangle_symbol costs cpu every time you call it, but using libcwd::type_info_of<> does not cost any cpu: the demangling is done once, during the initialization of libcwd; libcwd::type_info_of<> merely returns a static pointer.