Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(debuginfo): Prefer a PDB's DebugInfo age #150

Merged
merged 1 commit into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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