Module dwarf

Module 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§

compilation_unit
This module wraps DWARF compilation unit
debug_info
editor
function
parameters
scope
types
variable

Structs§

CompilationUnit
A DWARF compilation unit
DebugInfo
This class represents a DWARF debug information. It can embed different compilation units which can be accessed through DebugInfo::compilation_units.
Editor
This structure exposes the main API to create DWARF information
Function
This structure represents a DWARF function which can be associated with either: DW_TAG_subprogram or DW_TAG_inlined_subroutine.
Scope
This class materializes a scope in which Function, Variable, Type, … can be defined.
Variable
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§

Parameters
Type
This enum represents a DWARF Type which includes:

Traits§

Parameter

Functions§

load
Load a DWARF from its file path