Skip to content

Commit

Permalink
fix(debuginfo): Prefer a PDB's DebugInfo age (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-auer authored and mitsuhiko committed Jun 14, 2019
1 parent 0171d42 commit 5a898df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion debuginfo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ flate2 = { version = "1.0.7", features = ["rust_backend"], default-features = fa
gimli = { version = "0.18.0", features = ["read", "std"], default-features = false }
goblin = { git = "https://github.com/jan-auer/goblin", rev = "dd199e4b9027c9ca4389d5b066f5e264ef507e43" }
lazycell = "1.2.1"
pdb = "0.4.0"
pdb = { git = "https://github.com/jan-auer/pdb", rev = "da040f145d98c1d86da7cda3894fbc4dae1ba796" }
parking_lot = "0.8.0"
pest = "2.1.1"
pest_derive = "2.1.0"
Expand Down
7 changes: 6 additions & 1 deletion debuginfo/src/pdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ impl<'d> PdbObject<'d> {
/// The same information is also stored in a header in the corresponding PE file, which can be
/// used to locate a PDB from a PE.
pub fn debug_id(&self) -> DebugId {
// Prefer the age from the debug information stream, as it is more likely to correspond to
// the executable than the PDB info header. The latter is often bumped independently when
// the PDB is processed or optimized, which causes it to go out of sync with the original
// image.
let age = self.debug_info.age().unwrap_or(self.pdb_info.age);
match Uuid::from_slice(&self.pdb_info.guid.as_bytes()[..]) {
Ok(uuid) => DebugId::from_parts(uuid, self.pdb_info.age),
Ok(uuid) => DebugId::from_parts(uuid, age),
Err(_) => DebugId::default(),
}
}
Expand Down

0 comments on commit 5a898df

Please sign in to comment.