Module lief::dwarf

Expand description

Module for processing DWARF debug info

This module exposes an API similar to the crate::pdb module to process DWARF debug info (embedded or not).

One can instantiate a crate::dwarf::DebugInfo using either crate::generic::Binary::debug_info or crate::dwarf::load for external DWARF files.

fn from_binary(elf: &lief::elf::Binary) {
    if let Some(lief::DebugInfo::Dwarf(dwarf)) = elf.debug_info() {
        for complilation_unit in dwarf.compilation_units() {
            println!("{}", complilation_unit.name());
        }
    }
}

fn from_external(dwarf_file: &str) {
    let debug_info = lief::dwarf::load(dwarf_file).unwrap();
    for complilation_unit in debug_info.compilation_units() {
        println!("{}", complilation_unit.name());
    }
}

Modules

Structs

  • A DWARF compilation unit
  • This class represents a DWARF debug information. It can embed different compilation units which can be accessed through DebugInfo::compilation_units.
  • This structure represents a DWARF function which can be associated with either: DW_TAG_subprogram or DW_TAG_inlined_subroutine.
  • This class materializes a scope in which Function, Variable, Type, … can be defined.
  • Return an iterator of the variable DW_TAG_variable defined within the scope of this function. This includes regular stack-based variables as well as static ones.

Enums

Traits

Functions

  • Load a DWARF from its file path