@@ -29,10 +29,7 @@ use binaryninja::debuginfo::{DebugFunctionInfo, DebugInfo};
2929use binaryninja:: platform:: Platform ;
3030use binaryninja:: rc:: Ref ;
3131use binaryninja:: settings:: Settings ;
32- use binaryninja:: types:: {
33- EnumerationBuilder , NamedTypeReference ,
34- NamedTypeReferenceClass , StructureBuilder , StructureType , Type , TypeClass ,
35- } ;
32+ use binaryninja:: types:: { EnumerationBuilder , NamedTypeReference , NamedTypeReferenceClass , QualifiedName , StructureBuilder , StructureType , Type , TypeClass } ;
3633use binaryninja:: variable:: NamedDataVariableWithType ;
3734use crate :: symbol_parser:: { ParsedDataSymbol , ParsedProcedure , ParsedSymbol } ;
3835use crate :: type_parser:: ParsedType ;
@@ -67,13 +64,13 @@ pub struct PDBParserInstance<'a, S: Source<'a> + 'a> {
6764 /// TypeIndex -> ParsedType enum used during parsing
6865 pub ( crate ) indexed_types : BTreeMap < TypeIndex , ParsedType > ,
6966 /// QName -> Binja Type for finished types
70- pub ( crate ) named_types : BTreeMap < String , Ref < Type > > ,
67+ pub ( crate ) named_types : BTreeMap < QualifiedName , Ref < Type > > ,
7168 /// Raw (mangled) name -> TypeIndex for resolving forward references
7269 pub ( crate ) full_type_indices : BTreeMap < String , TypeIndex > ,
7370 /// Stack of types we're currently parsing
7471 pub ( crate ) type_stack : Vec < TypeIndex > ,
7572 /// Stack of parent types we're parsing nested types inside of
76- pub ( crate ) namespace_stack : Vec < String > ,
73+ pub ( crate ) namespace_stack : QualifiedName ,
7774 /// Type Index -> Does it return on the stack
7875 pub ( crate ) type_default_returnable : BTreeMap < TypeIndex , bool > ,
7976
@@ -287,9 +284,9 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> {
287284 fn collect_name (
288285 & self ,
289286 name : & NamedTypeReference ,
290- unknown_names : & mut HashMap < String , NamedTypeReferenceClass > ,
287+ unknown_names : & mut HashMap < QualifiedName , NamedTypeReferenceClass > ,
291288 ) {
292- let used_name = name. name ( ) . to_string ( ) ;
289+ let used_name = name. name ( ) ;
293290 if let Some ( & found) =
294291 unknown_names. get ( & used_name)
295292 {
@@ -312,20 +309,16 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> {
312309 fn collect_names (
313310 & self ,
314311 ty : & Type ,
315- unknown_names : & mut HashMap < String , NamedTypeReferenceClass > ,
312+ unknown_names : & mut HashMap < QualifiedName , NamedTypeReferenceClass > ,
316313 ) {
317314 match ty. type_class ( ) {
318315 TypeClass :: StructureTypeClass => {
319316 if let Some ( structure) = ty. get_structure ( ) {
320- if let Some ( members) = structure. members ( ) {
321- for member in members {
322- self . collect_names ( member. ty . contents . as_ref ( ) , unknown_names) ;
323- }
317+ for member in structure. members ( ) {
318+ self . collect_names ( member. ty . contents . as_ref ( ) , unknown_names) ;
324319 }
325- if let Some ( bases) = structure. base_structures ( ) {
326- for base in bases {
327- self . collect_name ( base. ty . as_ref ( ) , unknown_names) ;
328- }
320+ for base in structure. base_structures ( ) {
321+ self . collect_name ( base. ty . as_ref ( ) , unknown_names) ;
329322 }
330323 }
331324 }
@@ -368,7 +361,7 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> {
368361 . bv
369362 . types ( )
370363 . iter ( )
371- . map ( |qnat| qnat. name ( ) . string ( ) )
364+ . map ( |qnat| qnat. name )
372365 . collect :: < HashSet < _ > > ( ) ;
373366
374367 for ty in & self . named_types {
@@ -409,7 +402,7 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> {
409402 match class {
410403 NamedTypeReferenceClass :: UnknownNamedTypeClass
411404 | NamedTypeReferenceClass :: TypedefNamedTypeClass => {
412- self . debug_info . add_type ( name, Type :: void ( ) . as_ref ( ) , & [ ] ) ; // TODO : Components
405+ self . debug_info . add_type ( & name, Type :: void ( ) . as_ref ( ) , & [ ] ) ; // TODO : Components
413406 }
414407 NamedTypeReferenceClass :: ClassNamedTypeClass
415408 | NamedTypeReferenceClass :: StructNamedTypeClass
@@ -431,15 +424,15 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> {
431424 structure. set_alignment ( 1 ) ;
432425
433426 self . debug_info . add_type (
434- name,
427+ & name,
435428 Type :: structure ( structure. finalize ( ) . as_ref ( ) ) . as_ref ( ) ,
436429 & [ ] , // TODO : Components
437430 ) ;
438431 }
439432 NamedTypeReferenceClass :: EnumNamedTypeClass => {
440433 let enumeration = EnumerationBuilder :: new ( ) ;
441434 self . debug_info . add_type (
442- name,
435+ & name,
443436 Type :: enumeration (
444437 enumeration. finalize ( ) . as_ref ( ) ,
445438 self . arch . default_integer_size ( ) . try_into ( ) ?,
0 commit comments