Slide 31
Slide 31 text
• Let’s try again. Someone throws an exception at PC %pc:
• The runtime creates an exception object e. It encodes the type of the exception and the “domain” the
exception belongs to;
• The runtime calls libunwind which gets the %pc and e and looks at speci
f
ic sections of the object
f
ile* to see if
the function %pc belongs to has a personality function to call;
• The personality function is given %pc, %e and a mechanism to get access to the LSDA, which contains a
mapping between PCs and “catch blocks”.
• The personality function parses the LSDA and check if there is a catch block that can catch exceptions from
that PC.
• If there is one, it checks that type of the exception the catch block can catch matches that of %e.
• If all works out, execution is restored from that catch block by manually “installing the context”.
• If not, returns control to libunwind, which repeats the procedure with the parent function.
EH in a nutshell (-nix)
Take it with a wheelbarrow’s worth of salt! 🧂