A call stack includes at least one frame of managed code and at least one
frame of unmanaged code. In a multithreaded environment, a request from a
diagnostic tool to a tracing function for the call stack is made on a
thread that is not associated with the call stack. The tracing function
preserves a context for a thread associated with the call stack until the
call stack tracing function ends. In a particular embodiment, a method
grants access to a stackwalking function, such that when a point on the
call stack is designated in a request for the stackwalking function, the
stackwalking function commences at the point on the call stack. When no
point on the call stack is designated in the request for the stackwalking
function, a default position on the call stack is determined based on a
last managed frame pushed onto the call stack and the stackwalking
function commences at the default position on the call stack.