Skip to content

Commit

Permalink
docs: add readme and update tagline
Browse files Browse the repository at this point in the history
  • Loading branch information
doinkythederp committed Sep 10, 2024
1 parent e5f0973 commit caaf4a8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
36 changes: 35 additions & 1 deletion README.md
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>
2 changes: 1 addition & 1 deletion packages/vex-libunwind-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "vex-libunwind-sys"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "FFI bindings to libunwind for VEX V5 robots"
description = "FFI bindings to LLVM libunwind for VEX V5 robots"
keywords = ["vex", "v5", "unwind", "libunwind"]
categories = [
"external-ffi-bindings",
Expand Down
2 changes: 1 addition & 1 deletion packages/vex-libunwind/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "vex-libunwind"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "Idiomatic Rust bindings for libunwind on VEX V5 robots"
description = "Idiomatic Rust bindings for LLVM libunwind on VEX V5 robots"
keywords = ["vex", "v5", "unwind", "libunwind", "backtrace"]
categories = ["api-bindings", "embedded", "science::robotics", "no-std"]
authors = [
Expand Down
7 changes: 5 additions & 2 deletions packages/vex-libunwind/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
//! Idiomatic Rust bindings for `libunwind` on VEX V5 robots
//! Idiomatic Rust bindings for LLVM `libunwind` on VEX V5 robots
//!
//! ```no_run
//! # use vex_libunwind::*;
//! let context = UnwindContext::new().unwrap();
//! let mut cursor = UnwindCursor::new();
//! 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;
//! }
//! }
Expand Down

0 comments on commit caaf4a8

Please sign in to comment.