18 releases
Uses new Rust 2024
| new 0.3.14 | Oct 18, 2025 |
|---|---|
| 0.3.13 | Aug 22, 2025 |
| 0.3.9 | Jun 25, 2025 |
| 0.3.5 | May 25, 2025 |
| 0.1.0 | Dec 13, 2024 |
#660 in Parser implementations
1,690 downloads per month
170KB
4K
SLoC
Tasru: Map out dwarf binaries
Tasru allows for easy inspection of Elf binaries using Dwarf debug information.
Example usage
let debug_info = tasru::DebugInfo::new("file.elf")?;
let var_value = debug_info.variable_from_demangled_name("package::GLOBAL_VAR")?.base_type().to_u32()?;
println!("Var value: {}", var_value);
lib.rs:
Tasru: Parse Dwarf information from Elf files
Tasru allows you to easily traverse Dwarf information stored within Elf files. This can be used within a debugger to read complex data structures in a live environment, or to perform forensics on a captured image.
Example:
/// Returns the address as a value, unless `resolve` is `false`
/// in which case it returns `0`. Useful for testing memory operations.
struct FakeReader {
resolve: bool,
}
impl tasru::memory::Read for FakeReader {
type Error = std::io::Error; // Unused in this example
fn read_u8(&mut self, address: u64) -> Result<u8, Self::Error> {
if self.resolve {
Ok(address as u8 + 8)
} else {
Ok(0)
}
}
}
// Read the elf file `example.elf`
let debug_info = tasru::DebugInfo::new(&"example.elf").expect("couldn't open example");
// Extract information on the static variable `example::ENUM`
let example_enum = debug_info.variable_from_demangled_name("example::ENUM").expect("couldn't find variable");
// Turn it into an enum (if it is one)
let example_enum = example_enum.enumeration().expect("variable isn't an enum");
// Get the current variant.
let variant = example_enum.variant(&mut FakeReader { resolve: true }).expect("couldn't determine variant");
println!("Variant is: {}", variant.name());
Most of the functionality in this crate comes from DebugInfo.
Dependencies
~3.5MB
~72K SLoC