简体   繁体   中英

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). 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. Some exception handler functions are available on the platform but set_terminate() or set_unexpected() do not catch all types of exceptions. The application is single threaded and uses Windows Mobile 5.0 SDK R2.

have you tried 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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM