I found out the hard way that Microsoft has two sets of ARM compilers for WinCE7, and only one of them generates code that's compatible with the SEH unwinder.
I don't think SEH actually calls destructors when unwinding C++, unlike C++ exceptions. This makes it leaky to use for anything other than fatal exceptions.
How do you come to the conclusion that SEH is a leaky abstraction instead of the behavior of C++ destructors?
I went and looked this up to refresh my memory: https://msdn.microsoft.com/en-us/library/swezty51.aspx
Microsoft recommend you don't mix the use of SEH exceptions with C++, or that you use the flag which turns SEH into C++ exceptions (and therefore calls destructors). In our case we didn't want to do that, because we're doing our own crash reporting and all we want is to log a backtrace while exiting the program, and do not want to call destructors which may themselves crash because the program is in an invalid state.
Here are even more interfaces than the three the author listed (libunwind, __register_frame, GDB):
- oprofile has a JIT interface: http://oprofile.sourceforge.net/doc/devel/jit-interface.html
- perf has a JIT interface: https://github.com/torvalds/linux/blob/master/tools/perf/Doc...
I wrote a blog article about the craziness around unwinding a few years back: http://blog.reverberate.org/2013/05/deep-wizardry-stack-unwi...
One of the questions I answer in my article which isn't addressed as much here is: why do we care about generating backtraces in the first place? It might seem obvious, but I identified four separate reasons which are all important: to support runtime exceptions (a la C++), to offer backtraces in debuggers, to sample the stack for profilers, and to print a backtrace from the program itself. So if you have a JIT and you don't offer proper backtraces, your users are going to be annoyed when they use any of these tools.