docs.rs failed to build vex-libunwind-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
vex-libunwind
Idiomatic Rust bindings for LLVM libunwind on VEX V5 robots
Install
cargo add --git https://github.com/vexide/vex-libunwind.git
Usage
To unwind from the current execution point, also known as "local" unwinding, capture the current CPU state with UnwindContext
and then step through each stack frame with an UnwindCursor
.
let context = new.unwrap;
let mut cursor = new;
loop
Prerequisites
Libunwind will not find stack frames unless you add unwind tables to your program and show it where to find them.
Add unwind tables by updating your target file or using the -Cforce-unwind-tables=on
rust flag:
Then update your target file to include the unwind tables and the symbols libunwind uses to find them:
SECTIONS {
/* ... */
.eh_frame : {
__eh_frame_start = .;
*(.eh_frame)
__eh_frame_end = .;
} > RAM
.eh_framehdr : {
__eh_frame_hdr_start = .;
*(.eh_framehdr)
__eh_frame_hdr_end = .;
} > RAM
.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx*)
*(.gnu.linkonce.armexidix.*.*)
__exidx_end = .;
} > RAM
/* ... */
}
Further Reading
Documentation for LLVM-flavored libunwind: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst
Documentation for similar but distinct libunwind/libunwind project: