diff options
Diffstat (limited to 'rust/examples')
| -rw-r--r-- | rust/examples/pdb-ng/src/symbol_parser.rs | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/rust/examples/pdb-ng/src/symbol_parser.rs b/rust/examples/pdb-ng/src/symbol_parser.rs index 7193da7d..5a1d8761 100644 --- a/rust/examples/pdb-ng/src/symbol_parser.rs +++ b/rust/examples/pdb-ng/src/symbol_parser.rs @@ -330,12 +330,30 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> { .into_iter() .map(|(_, sym)| sym.clone()) .sorted_by_key(|sym| match sym { - ParsedSymbol::Data(ParsedDataSymbol { type_, .. }) => { - type_.as_ref().map(|ty| ty.confidence).unwrap_or(0) - } - ParsedSymbol::Procedure(ParsedProcedure { type_, .. }) => { - type_.as_ref().map(|ty| ty.confidence).unwrap_or(0) - } + ParsedSymbol::Data(ParsedDataSymbol { + type_, is_public, .. + }) => type_ + .as_ref() + .map(|ty| { + if *is_public { + ty.confidence / 2 + } else { + ty.confidence + } + }) + .unwrap_or(0), + ParsedSymbol::Procedure(ParsedProcedure { + type_, is_public, .. + }) => type_ + .as_ref() + .map(|ty| { + if *is_public { + ty.confidence / 2 + } else { + ty.confidence + } + }) + .unwrap_or(0), _ => 0, }) .collect::<Vec<_>>(), @@ -343,12 +361,30 @@ impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> { .into_iter() .map(|(_, func)| func.clone()) .sorted_by_key(|sym| match sym { - ParsedSymbol::Data(ParsedDataSymbol { type_, .. }) => { - type_.as_ref().map(|ty| ty.confidence).unwrap_or(0) - } - ParsedSymbol::Procedure(ParsedProcedure { type_, .. }) => { - type_.as_ref().map(|ty| ty.confidence).unwrap_or(0) - } + ParsedSymbol::Data(ParsedDataSymbol { + type_, is_public, .. + }) => type_ + .as_ref() + .map(|ty| { + if *is_public { + ty.confidence / 2 + } else { + ty.confidence + } + }) + .unwrap_or(0), + ParsedSymbol::Procedure(ParsedProcedure { + type_, is_public, .. + }) => type_ + .as_ref() + .map(|ty| { + if *is_public { + ty.confidence / 2 + } else { + ty.confidence + } + }) + .unwrap_or(0), _ => 0, }) .collect::<Vec<_>>(), |
