Debug Modification

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

PE Debug Overview
These debug information are located in the IMAGE_DIRECTORY_ENTRY_DEBUG and are represented in LIEF through the class.
We can modify these entries by using the API exposed from these structures. For instance, we can change the PDB path referenced in a entry 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")