-
Derek Bruening authored
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. Installs libunwind for cross-compiling and for 32-bit x86 using manual download and unpack steps, as there are no ready-made packages (GA CI uses a microsoft.com repository which has only 64-bit libunwind, and file conflicts are hit when trying to add a new repository for 32-bit only). Issue: #2414, #956
9f8d170f