杀死调试过程 [英] Killing a debugged process

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

问题描述



我一直致力于"碰撞监控"。应用程序(WM 6.0)的工作方式如下:

1.主应用程序线程启动线程B,等待事件对象(完成任务后从线程B发出信号)
2.线程B创建一个新进程(受监控的应用程序),参数为DEBUG_ONLY_THIS_PROCESS
3.线程B启动线程C,它将一些输入参数发送到受监控的应用程序.4。线程B调用WaitForDebugEvent

有没有好的方法无论情况如何,确保被监控的应用程序被杀死?如果受监视的应用程序因异常而挂起,则TerminateProcess似乎总是失败。

提前致谢

Hi,

I've been working on a "crash monitoring" application (WM 6.0) which works something like this:

1. Main application thread launches Thread B, and waits for an event object (to be signalled from Thread B upon completion of task)
2. Thread B creates a new process (the monitored app), with parameters DEBUG_ONLY_THIS_PROCESS
3. Thread B launches Thread C, which sends some input parameters to the monitored app
4. Thread B calls WaitForDebugEvent
5. If an EXCEPTION_DEBUG_EVENT is caught, Thread B should terminate the monitored app and go back to step 2 (until we have exhausted all of the input parameters to be tested)

Is there a good way to ensure that the monitored app is killed, regardless of the circumstances? TerminateProcess always seems to fail if the monitored app hangs as a result of the exception.

Thanks in advance

推荐答案

您可以通过创建"命名事件"来与其他进程通信。例如,表示进程退出。
You can communicate with the other process by creating a "Named Event" for example to signal the process to exit. 
在线程B中执行:CreateEvent(..,..,..,L" MyEvent");
In thread B do a: CreateEvent(.., .., .., L"MyEvent");


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

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