From 84d66dc7e6244e6ef78ebb3a2aa24b57a6ed4345 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Wed, 22 Apr 2026 17:10:53 -0400 Subject: [PDB Import] Only adjust sp-relative locals on x86_64 --- plugins/pdb-ng/src/symbol_parser.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/pdb-ng/src/symbol_parser.rs b/plugins/pdb-ng/src/symbol_parser.rs index 5e3cb166..a4ee4a6c 100644 --- a/plugins/pdb-ng/src/symbol_parser.rs +++ b/plugins/pdb-ng/src/symbol_parser.rs @@ -1721,15 +1721,21 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> { is_param, .. })) => { - // Adjust RSP-relative locations to RSP_entry-relative before param detection + // Adjust RSP-relative locations to RSP_entry-relative before param detection. + // Only for x86_64, because REGREL32 RSP offsets are measured after the prolog >:( + // On x86, offsets are already relative to the entry stack pointer + let frame_adjustment = if self.arch.address_size() == 8 { + data.frame_byte_count as i64 + } else { + 0 + }; let adjusted_storage: Vec = storage .iter() .map(|loc| { if loc.stack_relative { ParsedLocation { location: Variable { - storage: loc.location.storage - - data.frame_byte_count as i64, + storage: loc.location.storage - frame_adjustment, ..loc.location }, stack_relative: false, -- cgit v1.3.1