libhal / libhal-exceptions

Exception runtime library for Cortex M series CPUs
Apache License 2.0
5 stars 1 forks source link

Use actual unwind instructions for rethrow & throw #35

Open kammce opened 2 months ago

kammce commented 2 months ago

Within __wrap___cxa_rethrow and __wrap___cxa_throw, we check the build type and unwind the frame based on what we see in the disassembly. This is very fragile and breaks anytime we change those functions. We should, before main is called, scan the index for the location of both of these function's index entry, use those to create unwind instruction for both and cache the unwind information. Now when throw or rethrow are called, simply pass the already made unwind instructions to unwind frame along with the virtual cpu state.

kammce commented 2 months ago

Resolving this will resolve https://github.com/libhal/libhal-exceptions/issues/2 and https://github.com/libhal/libhal-exceptions/issues/1