我想使用IDebugXXX interfaces
获取我的local process
(没有远程附加)中的某些功能的堆栈跟踪。Stacktrace/Stackwalk为当前进程和当前线程与IDebug接口
使用此代码附加到当前进程的作品,但当前线程的堆栈跟踪送花儿给人包含only one frame
,如: ntdll!ZwGetContextThread+0x00000012
{
IDebugClient* debugClient;
IDebugControl4 *control4;
...
int flags = DEBUG_ATTACH_NONINVASIVE | DEBUG_ATTACH_NONINVASIVE_NO_SUSPEND;
debugClient->AttachProcess(0, myProcessId, flags);
control4->SetExecutionStatus(DEBUG_STATUS_GO);
...
// get the stack trace for the current thread
control4->GetStackTrace(0, 0, 0, _stackFrames, ARRAYSIZE((_stackFrames)), &_uFramesFilled)
// _uFramesFilled is always '1' for the current thread
}
编辑: 该应用程序是用C++/CLI而其他线程的结果至少包含更多的帧。
托管调试器无法获取非托管代码的堆栈跟踪。 –
这是一个C++/CLI应用程序 – boboes
然后,使这个复杂没有意义,只需使用StackTrace类。 –