Hello,

I'm looking at how SEH exception handling is working and I found in
mingw-w64 crtexe.c code that _gnu_exception_handler for processing of
signals is installed for non-i386 builds two times.

Once it is installed as SEH handler for mainCRTStartup() function (hence
which covers whole program as the mainCRTStartup entry point) and then
it is installed also as UnhandledExceptionFilter in __tmainCRTStartup()
as top level filter, which is called when no other SEH handler takes the
exception.

In my opinion it is redundant to have registered the
_gnu_exception_handler two times as a top level handler.

On i386 code, the mainCRTStartup function does not install SEH handler,
so for i386 code it makes sense to have UnhandledExceptionFilter. But it
is needed to have UnhandledExceptionFilter also for non-i386 code?

Anyway, is there any particular reason why we do not register SEH
handler in mainCRTStartup() also for i386 builds? I know that gnu
assembler does not provide .seh_handler directive for 32-bit x86 so
different approach and ifdef for it is needed. But I think that for
consistency between i386 and non-i386 builds we could have same code
paths. And then usage of UnhandledExceptionFilter would not be needed.

Pali


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to