Send As SMS

2005-03-31

How a C++ compiler implements exception handling

好文章:介绍C++编译器是如何实现异常的。
本地

有时间的话,我应该也研究一下GCC是如何实现异常管理的,Hotspot是如何实现异常处理的?这些底层的技术确实是很有魅力的。

关键词:
SEH:Structure Exception Handle
Functions/Stack Struture, Calling convention, Caller, Callee
C++ Exception

Function's prologue creates EXCEPTION_REGISTRATION structure on its stack frame and registers it with the operating system. The epilogue restores the EXCEPTION_REGISTRATION of the caller.

When VC++ compiles a function, it generates two set of data for the function:

a) Exception callback function.
b) A data structure that contains important information about the function like the catch blocks, their addresses, the type of exception they are interested in catching etc.

在C++异常处理过程中,需要

  1. Unwind stack including destroy local objects

0 Comments:

张贴评论

<< Home