[LLVMdev] How to code catch-all in the new exception handling scheme?

Duncan Sands baldrick at free.fr
Wed Sep 28 00:33:13 PDT 2011


Hi Garrison,

>>    The unwinder delegates the decision of whether to stop in a call frame to
>>    that call frame's language-specific personality function. Not all personality
>>    functions guarantee that they will stop to perform cleanups.
>>
>> This is incorrect: it is not the personality function that makes the decision,
>> it is who-ever is doing the unwinding.  For example if you use the Ada "throw"
>> method it will always run all C++ cleanups, even if that's all there is to do.
>> While if you use the C++ throw method it won't bother running Ada cleanups if
>> that is all there is to do.  All personality functions that I am familiar with
>> treat cleanups in the same way.
>
> How does one incorporate their own LLVM backend unwinding mechanism?
> I'm assuming that you have an Ada backend. Does your backend not call
> _Unwind_RaiseException for example?

it does, and follows that call with a call to _Unwind_ForcedUnwind.  If only
cleanups are seen up the call stack then the call to _Unwind_RaiseException
returns.  The call to _Unwind_ForcedUnwind then runs the cleanups.  When (if)
it returns then the program is terminated.  C++ skips the call to
_Unwind_ForcedUnwind and just terminates the program at once if
_Unwind_RaiseException returns.

Ciao, Duncan.



More information about the llvm-dev mailing list