drcallstack DynamoRIO Callstack Walker provides clients with walking of the application callstack.
drcallstack with your client simply include this line in your client's
That will automatically set up the include path and library dependence.
The initialization routine
drcallstack_init() must be called prior to any of the other routines. Additional calls to drcallstack_init() are allowed (so long as they are paired with corresponding calls to drcallstack_exit()).
To produce a callstack, first a dr_mcontext_t with the PC field and all general-purpose registers filled in with application values (i.e., DR_MC_CONTROL | DR_MC_INTEGER) must be obtained. When using a custom clean call, the PC field must be explicitly set by the client (typically by passing the application address of the next instruction to the clean call) as it is not set in that case by dr_get_mcontext().
Next, call drcallstack_init_walk() to set up for a walk. Then repeatedly call drcallstack_next_frame() to iterate over the frames of the callstack. When DRCALLSTACK_NO_MORE_FRAMES or an error code is returned, clean up with drcallstack_cleanup_walk().
Here is some example code:
drcallstack is only implemented for Linux.