Ghidra is a software reverse engineering (SRE) framework
GP-4975 - PDB - allow VxTable mangled symbol to be primary for Demangler
ghizardb776df4c7cd3
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DefaultPdbApplicator.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DefaultPdbApplicator.javaindex 93772aeb30..990dc5c7ec 100644--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DefaultPdbApplicator.java+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DefaultPdbApplicator.java@@ -2335,8 +2335,10 @@ public class DefaultPdbApplicator implements PdbApplicator {}if (!existingSymbol.getParentNamespace().equals(program.getGlobalNamespace())) {- // existing symbol has a non-global namespace- return doCreateSymbol(address, symbolPath, false, plateAddition);+ // Existing symbol has a non-global namespace+ if (!preferNewSymbolOverExistingNamespacedSymbol(symbolPath)) {+ return doCreateSymbol(address, symbolPath, false, plateAddition);+ }}if (symbolPath.getParent() != null) {@@ -2353,6 +2355,22 @@ public class DefaultPdbApplicator implements PdbApplicator {return doCreateSymbol(address, symbolPath, false, plateAddition);}+ // We've found that a mangled version of vxtables can present more detailed information+ // than a non-mangled vxtable symbol that has a namespace (the information is not+ // as descriptive regarding vxtables owned by the child for a parent). So do not+ // accept these existing symbol with namespace to maintain their primary status.+ //+ // Kludge... this mechanism might go away later if/when instead we evaluate all symbols at+ // an address to do the right thing or if/when we process the tables in some place other+ // than or besides the Demangler.+ private boolean preferNewSymbolOverExistingNamespacedSymbol(SymbolPath symbolPath) {+ String name = symbolPath.getName();+ if (name.startsWith("??_7") || name.startsWith("??_8")) {+ return true;+ }+ return false;+ }+private Symbol doCreateSymbol(Address address, SymbolPath symbolPath, boolean makePrimary,String plateAddition) {Symbol symbol = null;