• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/workflows/H03-May-2022-194185

benches/H03-May-2022-9384

ci/H03-May-2022-371279

examples/H03-May-2022-5951

src/H03-May-2022-5,6413,841

tests/H03-May-2022-611493

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D07-Jul-202074 65

.gitignoreH A D13-Jan-202018 32

.gitmodulesH A D24-Mar-2020140 43

Cargo.lockH A D07-Jul-20205.8 KiB225199

Cargo.tomlH A D07-Jul-20203.2 KiB131110

Cargo.toml.orig-cargoH A D07-Jul-20204.2 KiB147126

LICENSE-APACHEH A D13-Jan-202010.6 KiB202169

LICENSE-MITH A D13-Jan-20201 KiB2622

README.mdH A D15-May-20201.8 KiB7453

README.md

1# backtrace-rs
2
3[Documentation](https://docs.rs/backtrace)
4
5A library for acquiring backtraces at runtime for Rust. This library aims to
6enhance the support of the standard library by providing a programmatic
7interface to work with, but it also supports simply easily printing the current
8backtrace like libstd's panics.
9
10## Install
11
12```toml
13[dependencies]
14backtrace = "0.3"
15```
16
17## Usage
18
19To simply capture a backtrace and defer dealing with it until a later time,
20you can use the top-level `Backtrace` type.
21
22```rust
23use backtrace::Backtrace;
24
25fn main() {
26    let bt = Backtrace::new();
27
28    // do_some_work();
29
30    println!("{:?}", bt);
31}
32```
33
34If, however, you'd like more raw access to the actual tracing functionality, you
35can use the `trace` and `resolve` functions directly.
36
37```rust
38fn main() {
39    backtrace::trace(|frame| {
40        let ip = frame.ip();
41        let symbol_address = frame.symbol_address();
42
43        // Resolve this instruction pointer to a symbol name
44        backtrace::resolve_frame(frame, |symbol| {
45            if let Some(name) = symbol.name() {
46                // ...
47            }
48            if let Some(filename) = symbol.filename() {
49                // ...
50            }
51        });
52
53        true // keep going to the next frame
54    });
55}
56```
57
58# License
59
60This project is licensed under either of
61
62 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
63   http://www.apache.org/licenses/LICENSE-2.0)
64 * MIT license ([LICENSE-MIT](LICENSE-MIT) or
65   http://opensource.org/licenses/MIT)
66
67at your option.
68
69### Contribution
70
71Unless you explicitly state otherwise, any contribution intentionally submitted
72for inclusion in backtrace-rs by you, as defined in the Apache-2.0 license, shall be
73dual licensed as above, without any additional terms or conditions.
74