Skip to content

Commit

Permalink
Add a simple README
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jun 10, 2015
1 parent 15a28b9 commit f897487
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ script:
- cargo test --no-default-features --features 'unix-backtrace'
- cargo test --no-default-features --features 'unix-backtrace dladdr'
- cargo test --no-default-features --features 'unix-backtrace libbacktrace'
- rustdoc --test README.md -L target/debug/deps -L target/debug
notifications:
email:
on_success: never
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# backtrace-rs

A library for acquiring backtraces at runtime for Rust. This library aims to
enhance the support given by the standard library at `std::rt` by providing a
more stable and programmatic interface.

## Install

```toml
[dependencies]
backtrace = "0.1"
```

```rust
extern crate backtrace;
```

## Usage

```rust
extern crate backtrace;

fn main() {
backtrace::trace(&mut |frame| {
let ip = frame.ip();
let symbol_address = frame.symbol_address();

// Resolve this instruction pointer to a symbol name
backtrace::resolve(ip, &mut |symbol| {
if let Some(name) = symbol.name() {
// ...
}
if let Some(filename) = symbol.filename() {
// ...
}
});

true // keep going to the next frame
});
}
```

0 comments on commit f897487

Please sign in to comment.