-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5f0973
commit caaf4a8
Showing
4 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,37 @@ | ||
# vex-libunwind | ||
|
||
> Idiomatic Rust bindings for libunwind on VEX V5 robots | ||
> 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`. | ||
|
||
```rs | ||
let context = UnwindContext::new().unwrap(); | ||
let mut cursor = UnwindCursor::new(&context); | ||
|
||
loop { | ||
// Print instruction pointer (i.e. "program counter") | ||
println!("{:?}", cursor.register(registers::UNW_REG_IP)); | ||
|
||
if !cursor.step().unwrap() { | ||
// End of stack reached | ||
break; | ||
} | ||
} | ||
``` | ||
|
||
### 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: | ||
|
||
- <https://www.nongnu.org/libunwind/man/libunwind(3).html> | ||
- <https://github.com/libunwind/libunwind> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters