堆栈移动已调试的进程 [英] Stack Walking a debugged process

查看:127
本文介绍了堆栈移动已调试的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打开了使用

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

  if(CreateProcessA模块名(使用命令行)
(LPSTR)path,// argv [1],//命令行
NULL,//进程句柄不可继承
NULL,可继承
FALSE,//将句柄继承设置为FALSE
creationFlags,//无创建标志
NULL,//使用父环境块
NULL,//使用父开始目录
& startInfo,//到STARTUPINFO结构的指针
& processInfo)// PROCESS_INFORMATION结构的指针


b $ b

其中

  DWORD creationFlags = DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS; 
/ pre>

,然后我尝试用

$ stack

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

但是stackwalk只是给我顶端地址,下一个是0,

有很多地址在堆叠中。



有人知道有什么问题吗?

谢谢:)

解决方案

oops ...我忘记在从调试进程接收事件后调用ContinueDebugEvent - 所以它保持暂停,StackWalk是正确的。 :)


I'm opened opening a process (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's environment block
    NULL,           // Use parent's 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'm trying to stackwalk 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, while I know there are more addresses in the stack.

Does anybody know what's the problem?
thanks :)

解决方案

oops... I forget to call "ContinueDebugEvent" after receiving events from the debugged process - so it stayed paused and the StackWalk was infact correct. :)

这篇关于堆栈移动已调试的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆