Open japaric opened 6 years ago
The "Writing an OS in Rust" blog has a short example. Redox OS also has a more thorough implementation. Not sure about embedded Rust projects, though.
On a related note: has anyone considered writing an unwinder in Rust? Now that compiler-builtins is largely finished, this seems one of the last pieces of C dependencies for many platforms.
Just curious: What's the use case for unwinding in embedded scenarios?
@therealprof running unit tests on the device. Even with a CTF (Custom Test Framework) that uses Result::Err
to signal errors panics can still occur during any unit test (e.g. debug_assert!
) and that would cause the test runner to stop (e.g. panic-halt). With catch_unwind
functionality it would be possible to catch the panic, mark the unit test as failed and continue to run the unit tests.
Makes sense, thanks for the explanation.
it's super cursed but i think it'd be useful to document the implications of unwinding across ffi boundaries for c/rust interop and supporting the piecewise approach to moving to rust.
ideally they never happen, but, when they do on a desktop the errors are incomprehensible, and i haven't been bold enough to see what happens in an embedded context.
We should add a topic about implementing your own
panic_unwind
crate. I know this involves the "eh_personality" lang item but I have never done this myself. If someone has a working example that would be very useful!As unwinding depends on an unstable feature this topic is not a blocker for the edition release.