#information #binaries #enums #false

tasru

A method to map and understand dwarf symbol information

6 releases

0.3.1 Mar 13, 2025
0.3.0 Mar 13, 2025
0.2.2 Mar 6, 2025
0.2.0 Feb 7, 2025
0.1.0 Dec 13, 2024

#489 in Debugging

Download history 1/week @ 2024-12-21 1/week @ 2025-01-04 83/week @ 2025-02-01 278/week @ 2025-02-08 232/week @ 2025-02-15 56/week @ 2025-02-22 272/week @ 2025-03-01 295/week @ 2025-03-08 129/week @ 2025-03-15 44/week @ 2025-03-22 23/week @ 2025-03-29 43/week @ 2025-04-05

281 downloads per month

Apache-2.0

150KB
3.5K 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

~2–2.9MB
~59K SLoC