[英]Catch a crash on Windows CE
I would like to achieve the following but after days of trial I still could not figure it out. 我想实现以下目标,但经过数天的尝试,我仍然无法弄清楚。 I am developing an application in C++ for Windows CE 5.0 and I would like to be able to dump a callstack to a file when it crashes (programmatically).
我正在用C ++开发Windows CE 5.0的应用程序,我希望能够在程序崩溃时将调用堆栈转储到文件中。 I already know how to get the callstack itself, the problem is that I don't know how to run my own code when a crash occurs .
我已经知道如何获取调用堆栈本身,问题是发生崩溃时我不知道如何运行自己的代码 。 I tried placing my code into catch blocks but the stack is already unwound there so no luck.
我尝试将代码放入catch块中,但是堆栈已经在其中展开,所以没有运气。 Some exception handler functions are available on the platform but set_terminate() or set_unexpected() do not catch all types of exceptions.
平台上提供了一些异常处理程序功能,但set_terminate()或set_unexpected()不能捕获所有类型的异常。 The application is single threaded and uses Windows Mobile 5.0 SDK R2.
该应用程序是单线程的,并使用Windows Mobile 5.0 SDK R2。
have you tried SEH? 您尝试过SEH吗?
__try {
// stuff
} __except (DecideWhatToDo()) {
}
int DecideWhatToDo(void){
// Stack analysis here, should work with \EHsc and \EHa
// you could return EXCEPTION_CONTINUE_EXECUTION here so stack should not be unwound
return EXCEPTION_EXECUTE_HANDLER
}
Actually I have never tried it. 其实我从来没有尝试过。 How do you interpret your call stack?
您如何解释调用堆栈? So that it is usefull to find bugs?
以便发现错误很有用?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.