Reputation: 1341
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.
Upvotes: 2
Views: 1818
Reputation: 49976
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?
Upvotes: 1