C++ Exception Support: Difference between revisions

Intro to rolling your own C++ exception handling
[unchecked revision][unchecked revision]
(Always use a compiler that targets your operating-system)
(Intro to rolling your own C++ exception handling)
Line 25:
 
Some of the compiler flags that affect code generation may cause stack unwinding to fail. In particular, flags like "-fomit-stack-pointer" and "-mregparms={n}" could break things. When debugging the ported code, try compiling without these flags first.
 
=Rolling your own=
If you're adverse to including external code in your OS (or just want the challenge), you should be able to write your own C++ library, which handles the dispatching and allocation of exceptions (stack backtracing is handed by libgcc, which you should already be including with your build). If you choose this route, make sure to run _init upon loading each module (library or executable) to properly register the exception handling frames with the unwind code.
 
The functions you'll need to implement all start with `__cxa_` and are documented in the Itanium C++ ABI (which is also used for x86 by GCC)
 
=Function stubs=
Anonymous user