tags:

views:

751

answers:

2

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 information is stored and where is it stored)?

+1  A: 

Although this looks to be for Itanium, presumably the implementation is similar for x86: exception handling ABI

GCC follows the Itanium ABI wherever possible when there isn't an already-existing ABI for that platform. This includes x86 and x86-64.
Branan
+1  A: 

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).

Max Lybbert