Skip to content

Commit

Permalink
Emit a MODULE record for PE files
Browse files Browse the repository at this point in the history
PE files reference their corresponding debug file via name and DebugId.
We can put these in a CfiCache `MODULE` entry to be able to backfill a missing DebugFile/DebugId in
a minidump.
  • Loading branch information
Swatinem committed Sep 22, 2023
1 parent 480e680 commit f9fcf15
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 21 deletions.
51 changes: 30 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions symbolic-cfi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,19 @@ impl CfiCache<'static> {
pub fn from_object(object: &Object<'_>) -> Result<Self, CfiError> {
let mut buffer = vec![];
write_preamble(&mut buffer, CFICACHE_LATEST_VERSION)?;

if let Object::Pe(pe) = object {
let debug_file = pe.debug_file_name();
if let Some(debug_file) = debug_file {
write!(
buffer,
"MODULE windows {} {} {debug_file}",
object.arch().name(),
object.debug_id().breakpad(),
)?;
}
}

AsciiCfiWriter::new(&mut buffer).process(object)?;

let byteview = ByteView::from_vec(buffer);
Expand Down

0 comments on commit f9fcf15

Please sign in to comment.