Debug Info

PDB and DWARF shares similar traits which are abstracted by the following classes:

C++

DebugInfo

class DebugInfo

Subclassed by LIEF::dwarf::DebugInfo, LIEF::pdb::DebugInfo

Public Types

enum class FORMAT

Values:

enumerator UNKNOWN = 0
enumerator DWARF
enumerator PDB

Public Functions

DebugInfo(std::unique_ptr<details::DebugInfo> impl)
virtual ~DebugInfo()
inline virtual FORMAT format() const
template<class T>
inline const T *as() const

This function can be used to down cast a DebugInfo instance:

std::unique_ptr<LIEF::Instruction> dbg = bin->debug_info();
if (const auto* dwarf = inst->as<LIEF::dwarf::DebugInfo>()) {
  dwarf->find_function("main");
}

debug_location_t

struct debug_location_t

This structure holds a debug location (source filename & line)

Public Members

std::string file
uint64_t line = 0

Python

DebugInfo

class lief.DebugInfo

Bases: object

class FORMAT(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

DWARF = 1
PDB = 2
UNKNOWN = 0
from_value(arg: int) lief.DebugInfo.FORMAT = <nanobind.nb_func object>
property format lief.DebugInfo.FORMAT

Debug format (PDB/DWARF)

debug_location_t

class lief.debug_location_t

Bases: object

property file str
property line int

Rust