How does gcc implement stack unrolling for C++ exceptions on linux?

前端 未结 3 608
后悔当初
后悔当初 2020-12-09 16:43

How does gcc implement stack unrolling for C++ exceptions on linux? In particular, how does it know which destructors to call when unrolling a frame (i.e., what kind of inf

3条回答
  •  旧巷少年郎
    2020-12-09 17:25

    There isn't much documentation currently available, however the basic system is that GCC translates try/catch blocks to function calls and then links in a library with the needed runtime support (documentation about the tree building code includes the statement "throwing an exception is not directly represented in GIMPLE, since it is implemented by calling a function").

    Unfortunately I'm not familiar with these functions and can't tell you what to look at (other than the source for libgcc -- which includes the exception handling runtime).

    There is an "Exception Handling for Newbies" document available.

提交回复
热议问题