堆栈调试已调试的进程

Ido*_*dov 6 c++ windows debugging callstack

我打开了一个进程(使用C++/Windows)

if( CreateProcessA( NULL,   // No module name (use command line)
   (LPSTR)path, //argv[1],        // Command line
    NULL,           // Process handle not inheritable
    NULL,           // Thread handle not inheritable
    FALSE,          // Set handle inheritance to FALSE
    creationFlags,              // No creation flags
    NULL,           // Use parent's environment block
    NULL,           // Use parent's starting directory 
    &startInfo,            // Pointer to STARTUPINFO structure
    &processInfo )           // Pointer to PROCESS_INFORMATION structure
Run Code Online (Sandbox Code Playgroud)

哪里

DWORD creationFlags = DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS;  
Run Code Online (Sandbox Code Playgroud)

然后我试着用它来堆积它

bool ok = StackWalk64(IMAGE_FILE_MACHINE_I386,m_ps.Handle ,m_th.Handle, 
    &m_stackframe, &m_threadContext,
    0, NULL, NULL, 0); 
Run Code Online (Sandbox Code Playgroud)

但是stackwalk只给我顶部地址,下一个是0,而我知道堆栈中有更多的地址.

有人知道这是什么问题吗?
谢谢 :)

Ido*_*dov 0

哎呀...我忘记在收到来自调试进程的事件后调用“ContinueDebugEvent” - 所以它保持暂停状态并且 StackWalk 实际上是正确的。:)