Python

lief.pdb.load(path: str) lief.pdb.DebugInfo | None

Load the PDB from the given path

DebugInfo

class lief.pdb.DebugInfo

Bases: DebugInfo

This class provides an interface for PDB files.

One can instantiate this class using lief.pdb.load() or lief.pdb.DebugInfo.from_file()

property age int

The number of times the PDB file has been written.

property compilation_units Iterator[lief.pdb.CompilationUnit | None]

Iterator over the CompilationUnit from the PDB’s DBI stream. CompilationUnit are also named “Module” in the PDB’s official documentation

find_public_symbol(self, name: str) lief.pdb.PublicSymbol | None

Try to find the PublicSymbol from the given name (based on the public symbol stream) The function returns None if the symbol can’t be found.

debug_info: lief.pdb.DebugInfo = ...
if sym := debug_info.find_public_symbol("MiSyncSystemPdes"):
    print("found")
find_type(self, name: str) lief.pdb.Type | None

Find the type with the given name

from_file(filepath: str) lief.pdb.DebugInfo | None = <nanobind.nb_func object>
property guid str

Unique identifier of the PDB file.

property public_symbols Iterator[lief.pdb.PublicSymbol | None]

Return an iterator over the public symbol stream.

property types Iterator[lief.pdb.Type | None]

Return an iterator over the different types registered in this PDB file


CompilationUnit

class lief.pdb.CompilationUnit

Bases: object

This class represents a Compilation Unit (or Module) in a PDB file

property functions Iterator[lief.pdb.Function | None]

Return an iterator over the function defined in this compilation unit. If the PDB does not contain or has an empty DBI stream, it returns an empty iterator.

property module_name str

Name (or path) to the COFF object (.obj) associated with this compilation unit (e.g. e:\obj.amd64fre\minkernel\ntos\hvl\mp\objfre\amd64\hvlp.obj)

property object_filename str

Name of path to the original binary object (COFF, Archive) in which the compilation unit was located before being linked. e.g. e:\obj.amd64fre\minkernel\ntos\hvl\mp\objfre\amd64\hvl.lib

property sources Iterator[str]

Iterator over the sources files that compose this compilation unit. These files include headers (.h, .hpp, …).


PublicSymbol

class lief.pdb.PublicSymbol

Bases: object

This class provides general information (RVA, name) about a symbol from the PDB’s public symbol stream (or Public symbol hash stream)

property RVA int

Relative Virtual Address of this symbol.

This function returns 0 if the RVA can’t be computed.

property demangled_name str

Demangled representation of the symbol

property name str

Name of the symbol

property section_name str

Name of the section in which this symbol is defined (e.g. .text). This function returns an empty string if the section’s name can’t be found


Function

class lief.pdb.Function

Bases: object

property RVA int

The Relative Virtual Address of the function

property code_size int

The size of the function

property debug_location lief.debug_location_t

Original source code location.

property name str

Name of the function

property section_name str

The name of the section in which this function is defined


Type

Inheritance diagram of lief._lief.pdb.types.Enum, lief._lief.pdb.Type, lief._lief.pdb.types.ClassLike, lief._lief.pdb.types.Union, lief._lief.pdb.types.BitField, lief._lief.pdb.types.Function, lief._lief.pdb.types.Simple, lief._lief.pdb.types.Interface, lief._lief.pdb.types.Structure, lief._lief.pdb.types.Pointer, lief._lief.pdb.types.Array, lief._lief.pdb.types.Class, lief._lief.pdb.types.Modifier
class lief.pdb.Type

Bases: object

class KIND

Bases: object

ARRAY = lief._lief.pdb.KIND.ARRAY
BITFIELD = lief._lief.pdb.KIND.BITFIELD
CLASS = lief._lief.pdb.KIND.CLASS
ENUM = lief._lief.pdb.KIND.ENUM
FUNCTION = lief._lief.pdb.KIND.FUNCTION
INTERFACE = lief._lief.pdb.KIND.INTERFACE
MODIFIER = lief._lief.pdb.KIND.MODIFIER
POINTER = lief._lief.pdb.KIND.POINTER
SIMPLE = lief._lief.pdb.KIND.SIMPLE
STRUCTURE = lief._lief.pdb.KIND.STRUCTURE
UNION = lief._lief.pdb.KIND.UNION
UNKNOWN = lief._lief.pdb.KIND.UNKNOWN
property kind lief.pdb.Type.KIND

Discriminator for the type’s subclasses


Array

Inheritance diagram of lief._lief.pdb.types.Array
class lief.pdb.types.Array

Bases: Type

This class represents a LF_ARRAY PDB type.


Attribute (type)

Inheritance diagram of lief._lief.pdb.types.Attribute
class lief.pdb.types.Attribute

Bases: object

This class represents an attribute (LF_MEMBER) in an aggregate (class, struct, union, …)

property field_offset int

Offset of this attribute in the aggregate

property name str

Name of this attribute.

property type lief.pdb.Type | None

Type of this attribute


BitField

Inheritance diagram of lief._lief.pdb.types.BitField
class lief.pdb.types.BitField

Bases: Type

This class represents a LF_BITFIELD PDB type


ClassLike

Inheritance diagram of lief._lief.pdb.types.ClassLike, lief._lief.pdb.types.Union, lief._lief.pdb.types.Structure, lief._lief.pdb.types.Interface, lief._lief.pdb.types.Class
class lief.pdb.types.ClassLike

Bases: Type

This class abstracts the following PDB types: LF_STRUCTURE, LF_INTERFACE, LF_CLASS or LF_UNION.

property attributes Iterator[lief.pdb.types.Attribute | None]

Return an iterator over the different attributes defined in this class-like type

property methods Iterator[lief.pdb.types.Method | None]

Return an iterator over the different methods implemented in this class-like type

property name str

Demangled type name

property size int

Size of the type including all its attributes. This size should match the sizeof(...) this type.

property unique_name str

Mangled type name.


Structure

Inheritance diagram of lief._lief.pdb.types.Structure
class lief.pdb.types.Structure

Bases: ClassLike

Interface for the LF_STRUCTURE PDB type


Class

Inheritance diagram of lief._lief.pdb.types.Class
class lief.pdb.types.Class

Bases: ClassLike

Interface for the LF_CLASS PDB type


Interface

Inheritance diagram of lief._lief.pdb.types.Interface
class lief.pdb.types.Interface

Bases: ClassLike

Interface for the LF_INTERFACE PDB type


Enum

Inheritance diagram of lief._lief.pdb.types.Enum
class lief.pdb.types.Enum

Bases: Type

This class represents a LF_ENUM PDB type


Function (type)

Inheritance diagram of lief._lief.pdb.types.Function
class lief.pdb.types.Function

Bases: Type

This class represents a LF_PROCEDURE PDB type


Method (type)

Inheritance diagram of lief._lief.pdb.types.Method
class lief.pdb.types.Method

Bases: object

This class represents a Method (LF_ONEMETHOD) that can be defined in ClassLike PDB type

property name str

Name of the method


Modifier

Inheritance diagram of lief._lief.pdb.types.Modifier
class lief.pdb.types.Modifier

Bases: Type

This class represents a LF_MODIFIER PDB type

property underlying_type lief.pdb.Type | None

Underlying type targeted by this modifier


Pointer

Inheritance diagram of lief._lief.pdb.types.Pointer
class lief.pdb.types.Pointer

Bases: Type

This class represents a LF_POINTER PDB type

property underlying_type lief.pdb.Type | None

The underlying type pointed by this pointer


Simple

Inheritance diagram of lief._lief.pdb.types.Simple
class lief.pdb.types.Simple

Bases: Type

This class represents a primitive types (int, float, …) which are also named simple types in the PDB format.


Union

Inheritance diagram of lief._lief.pdb.types.Union
class lief.pdb.types.Union

Bases: ClassLike

This class represents a LF_UNION PDB type