Stack Walk Debugging Process

The process opens (with C ++ / Windows) using

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 environment block NULL, // Use parent starting directory &startInfo, // Pointer to STARTUPINFO structure &processInfo ) // Pointer to PROCESS_INFORMATION structure 

Where

 DWORD creationFlags = DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS; 

and then I try to execute it with

 bool ok = StackWalk64(IMAGE_FILE_MACHINE_I386,m_ps.Handle ,m_th.Handle, &m_stackframe, &m_threadContext, 0, NULL, NULL, 0); 

but stackwalk just gives me the top address and the next one is 0, and I know there are more addresses in the stack.

Does anyone know what the problem is?
thanks:)

+6
c ++ debugging windows callstack
source share
2 answers

oops ... I forgot to call "ContinueDebugEvent" after receiving events from the debugged process - so it remained suspended and StackWalk was right. :)

0
source share

It is impossible to tell based on this fragment. There is so much that needs to be set up correctly for this to work. Check out the logic in this detailed blog post .

Put more code if you can post a larger, but not too large, sample. How do you create STACKFRAME and CONTEXT structures? Are you stuck with StackWalk64 ? Any given call returns only one stack of frames.

0
source share

All Articles