Skip to content

Commit 84d66dc

Browse files
committed
[PDB Import] Only adjust sp-relative locals on x86_64
1 parent 4bba210 commit 84d66dc

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

plugins/pdb-ng/src/symbol_parser.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,15 +1721,21 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> {
17211721
is_param,
17221722
..
17231723
})) => {
1724-
// Adjust RSP-relative locations to RSP_entry-relative before param detection
1724+
// Adjust RSP-relative locations to RSP_entry-relative before param detection.
1725+
// Only for x86_64, because REGREL32 RSP offsets are measured after the prolog >:(
1726+
// On x86, offsets are already relative to the entry stack pointer
1727+
let frame_adjustment = if self.arch.address_size() == 8 {
1728+
data.frame_byte_count as i64
1729+
} else {
1730+
0
1731+
};
17251732
let adjusted_storage: Vec<ParsedLocation> = storage
17261733
.iter()
17271734
.map(|loc| {
17281735
if loc.stack_relative {
17291736
ParsedLocation {
17301737
location: Variable {
1731-
storage: loc.location.storage
1732-
- data.frame_byte_count as i64,
1738+
storage: loc.location.storage - frame_adjustment,
17331739
..loc.location
17341740
},
17351741
stack_relative: false,

0 commit comments

Comments
 (0)