更新时间:2022-02-15 03:36:52
在 MinGW-w64 维基:
为什么 mingw-w64 gcc 不支持 Dwarf-2 异常处理?
Windows 的 Dwarf-2 EH 实现根本不是为了在 64 位 Windows 应用程序下工作.在win32模式下,异常展开处理程序不能通过非 dw2 感知代码传播,这意味着任何通过任何非 dw2 感知的外部框架"的异常代码将失败,包括 Windows 系统 DLL 和使用构建的 DLL视觉工作室.gcc 中的 Dwarf-2 展开代码检查 x86展开组装,没有其他 dwarf-2 就无法进行放松信息.
The Dwarf-2 EH implementation for Windows is not designed at all to work under 64-bit Windows applications. In win32 mode, the exception unwind handler cannot propagate through non-dw2 aware code, this means that any exception going through any non-dw2 aware "foreign frames" code will fail, including Windows system DLLs and DLLs built with Visual Studio. Dwarf-2 unwinding code in gcc inspects the x86 unwinding assembly and is unable to proceed without other dwarf-2 unwind information.
SetJump LongJump 异常处理方法适用于大多数情况win32 和 win64 上的情况,一般保护故障除外.gcc 中的结构化异常处理支持正在开发中克服了dw2和sjlj的弱点.在 win64 上,展开信息被放置在 xdata-section 并且有 .pdata(函数描述符表)而不是堆栈.对于win32,链的处理程序在堆栈上,需要由 real 保存/恢复执行代码.
The SetJump LongJump method of exception handling works for most cases on both win32 and win64, except for general protection faults. Structured exception handling support in gcc is being developed to overcome the weaknesses of dw2 and sjlj. On win64, the unwind-information are placed in xdata-section and there is the .pdata (function descriptor table) instead of the stack. For win32, the chain of handlers are on stack and need to be saved/restored by real executed code.
GCC GNU 关于异常处理:
GCC 支持两种异常处理方法 (EH):
GCC supports two methods for exception handling (EH):
[...]
结构化异常处理 (SEH)
Windows 使用自己的异常处理机制,称为结构化异常处理 (SEH).[...]不幸的是,GCC 还不支持 SEH.[...]
Windows uses its own exception handling mechanism known as Structured Exception Handling (SEH). [...] Unfortunately, GCC does not support SEH yet. [...]
另见: