summaryrefslogtreecommitdiff
path: root/plugins/pdb-ng/src/parser.rs
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2026-04-21 16:15:20 -0400
committerJosh Ferrell <josh@vector35.com>2026-04-21 17:04:41 -0400
commit8e7535e92fbb4305232eb19405f1d738437dcf4b (patch)
tree479697d0168b40ec05e0a7422b3f597fc60e8ff5 /plugins/pdb-ng/src/parser.rs
parent4e6453c7609bbea86c172f4df2f3aa3a3429677f (diff)
[PDB Import] Initial support for loading locals
Diffstat (limited to 'plugins/pdb-ng/src/parser.rs')
-rw-r--r--plugins/pdb-ng/src/parser.rs28
1 files changed, 25 insertions, 3 deletions
diff --git a/plugins/pdb-ng/src/parser.rs b/plugins/pdb-ng/src/parser.rs
index 82a2bd75..9db635e8 100644
--- a/plugins/pdb-ng/src/parser.rs
+++ b/plugins/pdb-ng/src/parser.rs
@@ -34,7 +34,7 @@ use binaryninja::types::{
EnumerationBuilder, NamedTypeReference, NamedTypeReferenceClass, StructureBuilder,
StructureType, Type, TypeClass,
};
-use binaryninja::variable::NamedDataVariableWithType;
+use binaryninja::variable::{NamedDataVariableWithType, NamedVariableWithType};
/// Megastruct for all the parsing
/// Certain fields are only used by specific files, as marked below.
@@ -252,7 +252,7 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> {
address,
name,
type_,
- locals: _,
+ locals,
..
}) => {
self.log(|| {
@@ -276,7 +276,29 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> {
Some(address),
Some(self.platform.clone()),
vec![], // TODO : Components
- vec![], //TODO: local variables
+ locals
+ .iter()
+ .filter_map(|v| {
+ let Some(var_type) = &v.type_ else {
+ return None;
+ };
+ if v.storage.len() != 1 {
+ // TODO: how should we handle variables with multiple storage locations?
+ return None;
+ }
+
+ let mut var_loc = v.storage[0].location;
+ if v.storage[0].base_relative {
+ var_loc.storage -= self.arch.address_size() as i64;
+ }
+ Some(NamedVariableWithType {
+ variable: var_loc,
+ ty: var_type.clone(),
+ name: v.name.clone(),
+ auto_defined: false,
+ })
+ })
+ .collect::<Vec<_>>(),
));
}
_ => {}