Re: DebugBreak continue issue
George schrieb:
Hi Norbert,
Your sample never reaches step 4, so why do you think we are in step 4?
You are correct. The original code will not go to step 4, but goes to step
2. If I comment exception handler code, it will go to step 4. Here is the
code.
My question is, when it goes to step 4, it will let user select
break/continue/ignore. I think continue means let the code to execute into
exception handler, right?
No.
"Continue" means the application continues, as the button says. The execution of
the application is resumed.
If you hit an exception while the program is running in the debugger and the
debugger shows you the dialog, then continue will pass the control back to the
applicatin which will then given the chance to handle the exception.
If yes, I am confused because if we are in step 4, it means there is no
exception handler (or else we will go to step 2), why here is an option
(continue button) to let us go to execute exception handler? (I have tried
when click continue, program will terminate.) Any ideas?
DebugBreak() by default allows the application to continue after the debugger
handled the breakpoint. So your application does not quit after hitting
Continue, it just continues. But since your application exits right after the
"a=400;" it just looks as if it was terminated. It just ended normally.
Norbert
[Code]
#include "Windows.h"
int main()
{
int a;
int b;
int c;
/*
__try
{
*/
a = 100;
b = 200;
c = 300;
DebugBreak();
a = 400;
/*
}
__except(GetExceptionCode() == EXCEPTION_BREAKPOINT ?
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// No debugger is attached, so return FALSE
// and continue.
return FALSE;
}
*/
return TRUE;
}
[/Code]
regards,
George