Adds a new extension "drcallstack" which provides callstack walking facilities. This initial implementation adds a libunwind-based implementation and targets only Linux for now.
Adds an interface to walk one step at a time over callstack frames. The implementation converts the dr_mcontext_t into libunwind's context structure and invokes the libunwind step API.
Getting libunwind to work requires several steps:
-
Ignore libpthread exports when importing any symbol that does not start with "pthread". Otherwise libunwind crashes using __errno_location from libpthread instead of from libc. We add a warning when a private libpthread is loaded to help diagnose any other potential problems (xref #956).
-
Have dl_iterate_phdr operate on app libraries instead of private libraries. This is done with a new flag and logic in the redirection code, with the flag set for libraries named "libunwind*".
A statically-linked libunwind is not supported.
Updates drwrap to set the mcontext pc field to simplify usage.
Adds a test and documentation.
Adds a sample client showing how to use this library.