mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-08 18:36:17 +01:00
gwin32: Do not ignore exceptions when running under a debugger
We're supposed to return `EXCEPTION_CONTINUE_SEARCH` here to tell the vectored exception handler (VEH) to move on to the next exception handler instead of skipping them all and trying to continue execution. Swallowing exceptions messes up CLR exception processing and breaks C# code. For more details, see: https://blogs.msdn.microsoft.com/jmstall/2006/05/24/beware-of-the-vectored-exception-handler-and-managed-code/ Fixes https://gitlab.gnome.org/GNOME/glib/issues/2025
This commit is contained in:
parent
b947efb021
commit
6919a719c1
@ -1071,7 +1071,8 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
|
||||
if (ExceptionInfo == NULL ||
|
||||
ExceptionInfo->ExceptionRecord == NULL)
|
||||
ExceptionInfo->ExceptionRecord == NULL ||
|
||||
IsDebuggerPresent ())
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
|
||||
er = ExceptionInfo->ExceptionRecord;
|
||||
@ -1081,7 +1082,6 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||
case EXCEPTION_BREAKPOINT: /* DebugBreak() raises this */
|
||||
break;
|
||||
default:
|
||||
catch_list = getenv ("G_VEH_CATCH");
|
||||
@ -1109,17 +1109,6 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
if (IsDebuggerPresent ())
|
||||
{
|
||||
/* This shouldn't happen, but still try to
|
||||
* avoid recursion with EXCEPTION_BREAKPOINT and
|
||||
* DebugBreak().
|
||||
*/
|
||||
if (er->ExceptionCode != EXCEPTION_BREAKPOINT)
|
||||
DebugBreak ();
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
|
||||
fprintf_s (stderr,
|
||||
"Exception code=0x%lx flags=0x%lx at 0x%p",
|
||||
er->ExceptionCode,
|
||||
|
Loading…
Reference in New Issue
Block a user