LIEF can create, modify, or delete PE debug information entries.
IMAGE_DIRECTORY_ENTRY_DEBUG and is represented in LIEF through the class.pe: lief.PE.Binary
assert isinstance(pe.codeview_pdb, lief.PE.CodeViewPDB)
pe.codeview_pdb.filename = r"C:\A\B\C\path.pdb"
pe.write("out.dll")
std::unique_ptr<LIEF::PE::Binary> pe;
pe->codeview_pdb()->filename(R"(C:\A\B\C\path.pdb)");
pe->write("out.dll");
let pe: &mut lief::pe::Binary = some_pe;
pe.codeview_pdb()
.unwrap()
.set_filename(r#"C:\A\B\C\path.pdb"#);
pe.write("out.exe");
# Remove a single CodeViewPDB entry
assert pe.codeview_pdb is not None
pe.remove_debug(pe.codeview_pdb)
# Remove all entries
pe.clear_debug()
pe.write("out.dll")
std::unique_ptr<LIEF::PE::Binary> pe;
// Remove a single CodeViewPDB entry
pe->remove_debug(*pe->codeview_pdb());
// Remove all entries
pe->clear_debug();
pe->write("out.dll");
let pe: &mut lief::pe::Binary = some_pe;
// Remove a single CodeViewPDB entry
if let Some(cv_pdb) = pe.codeview_pdb() {
todo!("Not Implemented yet");
//pe.remove_debug(cv_pdb);
}
// Remove all entries
pe.clear_debug();
pe.write("out.exe");
cv = lief.PE.CodeViewPDB("MyCustom.pdb")
pe.add_debug_info(cv)
pe.write("out.dll")
std::unique_ptr<LIEF::PE::Binary> pe;
LIEF::PE::CodeViewPDB cv("MyCustom.pdb");
pe->add_debug_info(cv);
pe->write("out.dll");
let pe: &mut lief::pe::Binary = some_pe;
let cv = lief::pe::debug::CodeViewPDB::with_filename("MyCustom.pdb");
pe.add_debug_info(&cv);
pe.write("out.exe");