| 1 |
# `gimli` |
| 2 |
|
| 3 |
[ ](https://crates.io/crates/gimli) |
| 4 |
[](https://docs.rs/gimli/) |
| 5 |
[](https://github.com/gimli-rs/gimli/actions) |
| 6 |
[](https://coveralls.io/github/gimli-rs/gimli?branch=master) |
| 7 |
|
| 8 |
`gimli` is a library for reading and writing the |
| 9 |
[DWARF debugging format](https://dwarfstd.org/). |
| 10 |
|
| 11 |
* **Zero copy:** everything is just a reference to the original input buffer. No |
| 12 |
copies of the input data get made. |
| 13 |
|
| 14 |
* **Lazy:** you can iterate compilation units without parsing their |
| 15 |
contents. Parse only as many debugging information entry (DIE) trees as you |
| 16 |
iterate over. `gimli` also uses `DW_AT_sibling` references to avoid parsing a |
| 17 |
DIE's children to find its next sibling, when possible. |
| 18 |
|
| 19 |
* **Cross-platform:** `gimli` makes no assumptions about what kind of object |
| 20 |
file you're working with. The flipside to that is that it's up to you to |
| 21 |
provide an ELF loader on Linux or Mach-O loader on macOS. |
| 22 |
|
| 23 |
* Unsure which object file parser to use? Try the cross-platform |
| 24 |
[`object`](https://github.com/gimli-rs/object) crate. See the |
| 25 |
[`gimli-examples`](./crates/examples/src/bin) crate for usage with `gimli`. |
| 26 |
|
| 27 |
## Install |
| 28 |
|
| 29 |
Add this to your `Cargo.toml`: |
| 30 |
|
| 31 |
```toml |
| 32 |
[dependencies] |
| 33 |
gimli = "0.31.0" |
| 34 |
``` |
| 35 |
|
| 36 |
The minimum supported Rust version is: |
| 37 |
|
| 38 |
* 1.60.0 for the `read` feature and its dependencies. |
| 39 |
* 1.65.0 for other features. |
| 40 |
|
| 41 |
## Documentation |
| 42 |
|
| 43 |
* [Documentation on docs.rs](https://docs.rs/gimli/) |
| 44 |
|
| 45 |
* Example programs: |
| 46 |
|
| 47 |
* [A simple `.debug_info` parser](./crates/examples/src/bin/simple.rs) |
| 48 |
|
| 49 |
* [A simple `.debug_line` parser](./crates/examples/src/bin/simple_line.rs) |
| 50 |
|
| 51 |
* [A `dwarfdump` clone](./crates/examples/src/bin/dwarfdump.rs) |
| 52 |
|
| 53 |
* [An `addr2line` clone](https://github.com/gimli-rs/addr2line) |
| 54 |
|
| 55 |
* [`ddbug`](https://github.com/gimli-rs/ddbug), a utility giving insight into |
| 56 |
code generation by making debugging information readable. |
| 57 |
|
| 58 |
* [`dwprod`](https://github.com/fitzgen/dwprod), a tiny utility to list the |
| 59 |
compilers used to create each compilation unit within a shared library or |
| 60 |
executable (via `DW_AT_producer`). |
| 61 |
|
| 62 |
* [`dwarf-validate`](./crates/examples/src/bin/dwarf-validate.rs), a program to validate the |
| 63 |
integrity of some DWARF and its references between sections and compilation |
| 64 |
units. |
| 65 |
|
| 66 |
## License |
| 67 |
|
| 68 |
Licensed under either of |
| 69 |
|
| 70 |
* Apache License, Version 2.0 ([`LICENSE-APACHE`](./LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0) |
| 71 |
* MIT license ([`LICENSE-MIT`](./LICENSE-MIT) or https://opensource.org/licenses/MIT) |
| 72 |
|
| 73 |
at your option. |
| 74 |
|
| 75 |
## Contribution |
| 76 |
|
| 77 |
See [CONTRIBUTING.md](./CONTRIBUTING.md) for hacking. |
| 78 |
|
| 79 |
Unless you explicitly state otherwise, any contribution intentionally submitted |
| 80 |
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be |
| 81 |
dual licensed as above, without any additional terms or conditions. |