Debug Modification

LIEF can create, modify, or delete PE debug information entries.

PE Debug Overview
This debug information is located in the IMAGE_DIRECTORY_ENTRY_DEBUG and is represented in LIEF through the class.
These entries can be modified using the API exposed by these structures. For example, the PDB path referenced in a entry can be changed as follows:
import lief

pe: lief.PE.Binary = ...

pe.codeview_pdb.filename = r"C:\A\B\C\path.pdb"

pe.write("out.dll")
import lief

pe: lief.PE.Binary = ...

# Remove a single CodeViewPDB entry
pe.remove_debug(pe.codeview_pdb)

# Remove all entries
pe.clear_debug()

pe.write("out.dll")
import lief

pe: lief.PE.Binary = ...

cv = lief.PE.CodeViewPDB("MyCustom.pdb")

pe.add_debug_info(cv)

pe.write("out.dll")