"Paulo J. Matos" <[EMAIL PROTECTED]> writes: > Is that any reference (paper, guide, whatever,) on how gcc is handling > exceptions in intermediate code? Is it based on a known (published) > method? Is it intuitive and explained somewhere?
I doubt it. But if you pull together some information, it would be good to document it on a wiki page or something like that. > I've looked at internal docs but it is not really explicit how it > works. I'm having a hard time understanding how RESX_PTR, FILTER_EXPR, > EH_FILTER_EXPR work together in gimple and how all of this is then > made to work in assembler. All those codes disappear early in the middle-end, in the lower_eh pass. They are replaced with exception regions, and a hash table mapping statements to exception regions. An exception region basically means a bit of code which is executed when an exception occurs. At the assembler level the mapping from statements to exception regions is represented out-of-line in .eh_frame sections, along with information about where registers and the return address are saved on the stack. The exception unwinder reads that data in order to unwind the stack and restore registers. The interaction is described, rather tersely, at http://codesourcery.com/cxx-abi/ (ignore the comments which suggest that is only used on Itanium). Ian