summaryrefslogtreecommitdiff
path: root/rust/examples
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2024-04-29 19:15:33 -0400
committerGlenn Smith <glenn@vector35.com>2024-06-04 14:37:43 -0400
commit4585954404982498919160349545491853828464 (patch)
treef9d9863550b35d75efc8dbb5efe143bdfe51a7ef /rust/examples
parent2961527337029178466940210708261849510430 (diff)
PDB: Prefer private symbols to public
Diffstat (limited to 'rust/examples')
-rw-r--r--rust/examples/pdb-ng/src/symbol_parser.rs60
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<_>>(),