Skip to content

Ghidra is a software reverse engineering (SRE) framework

GT-3112 - PDB Universal - caches for unique symbols at address and primary symbols for performance work-around

ghizard368476097dbc
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DataSymbolApplier.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DataSymbolApplier.java
index c97e17e8b6..9acbb9578a 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DataSymbolApplier.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DataSymbolApplier.java
@@ -77,11 +77,12 @@ public class DataSymbolApplier extends MsSymbolApplier {
Address symbolAddress = applicator.getAddress(symbol);
Address remapAddress = applicator.getRemapAddressByAddress(symbolAddress);
RecordNumber typeRecordNumber = symbol.getTypeRecordNumber();
- boolean forcePrimary = applicator.shouldForcePrimarySymbol(remapAddress, true);
- String name = symbol.getName();
- if (!applicator.createSymbol(remapAddress, name, forcePrimary)) {
- applicator.appendLogMsg("Unable to create symbol " + name + " at " + remapAddress);
- }
+// boolean forcePrimary = applicator.shouldForcePrimarySymbol(symbolAddress, true);
+// String name = symbol.getName();
+// if (!applicator.createSymbol(symbolAddress, name, forcePrimary)) {
+// applicator.appendLogMsg("Unable to create symbol " + name + " at " + symbolAddress);
+// }
+ applicator.createSymbolNew(symbolAddress, symbol.getName(), true);
createData(remapAddress, typeRecordNumber);
}
}
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/FunctionSymbolApplier.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/FunctionSymbolApplier.java
index 8207022f71..d06ce3c71e 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/FunctionSymbolApplier.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/FunctionSymbolApplier.java
@@ -235,8 +235,9 @@ public class FunctionSymbolApplier extends MsSymbolApplier {
private boolean applyFunction(Program program, Address address, TaskMonitor monitor) {
Listing listing = program.getListing();
- boolean forcePrimary = applicator.shouldForcePrimarySymbol(address, true);
- applicator.createSymbol(address, getName(), forcePrimary);
+// boolean forcePrimary = applicator.shouldForcePrimarySymbol(address, true);
+// applicator.createSymbol(address, getName(), forcePrimary);
+ applicator.createSymbolNew(address, getName(), true);
function = listing.getFunctionAt(address);
if (function == null) {
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/LabelSymbolApplier.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/LabelSymbolApplier.java
index e815af5a0d..aeac102d78 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/LabelSymbolApplier.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/LabelSymbolApplier.java
@@ -66,10 +66,11 @@ public class LabelSymbolApplier extends MsSymbolApplier {
name = NamespaceUtils.getNamespaceQualifiedName(f, name, true);
}
}
- boolean forcePrimary = applicator.shouldForcePrimarySymbol(symbolAddress, false);
- if (!applicator.createSymbol(symbolAddress, name, forcePrimary)) {
- applicator.appendLogMsg("Unable to create symbol " + name + " at " + symbolAddress);
- }
+// boolean forcePrimary = applicator.shouldForcePrimarySymbol(symbolAddress, false);
+// if (!applicator.createSymbol(symbolAddress, name, forcePrimary)) {
+// applicator.appendLogMsg("Unable to create symbol " + name + " at " + symbolAddress);
+// }
+ applicator.createSymbolNew(symbolAddress, symbol.getName(), false);
}
@Override
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbAddressManager.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbAddressManager.java
index fec645aea0..b1cca8def3 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbAddressManager.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbAddressManager.java
@@ -23,6 +23,8 @@ import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program;
import ghidra.program.model.mem.Memory;
import ghidra.program.model.mem.MemoryBlock;
+import ghidra.program.model.symbol.Symbol;
+import ghidra.program.model.symbol.SymbolIterator;
import ghidra.util.exception.CancelledException;
/**
@@ -38,6 +40,20 @@ public class PdbAddressManager {
private List<PeCoffGroupMsSymbol> memoryGroupRefinement;
private List<PeCoffSectionMsSymbol> memorySectionRefinement;
private List<SegmentInfo> allSegmentsInfo;
+
+ // Map of Address by symbol name... if a name has appeared more than once, then the Address
+ // is written with Address.NO_ADDRESS to indicate that the name is found at more than one
+ // address (not unique from the perspective we need of being able to map PDB addresses to
+ // possibly different addresses (possibly from an application of another PDB with accurate
+ // public or "unique" symbols). Originally, we were only going to use symbols with mangled
+ // names, but opened this up to a wider field of symbol names.
+ private Map<String, Address> addressByPreExistingSymbolName;
+ // Since we are already visiting all existing symbols, and since it will be quicker to do in
+ // one pass than to continually request the primary symbol at a particular address (as we
+ // are also adding more symbols), we will get an initial snapshot of what symbol is primary
+ // at any particular address before we start adding more.
+ private Map<Address, Symbol> primarySymbolByAddress;
+
private Map<Address, Address> remapAddressByAddress;
private PdbApplicator applicator;
@@ -61,9 +77,12 @@ public class PdbAddressManager {
memoryGroupRefinement = new ArrayList<>();
memorySectionRefinement = new ArrayList<>();
allSegmentsInfo = new ArrayList<>();
+ addressByPreExistingSymbolName = new HashMap<>();
+ primarySymbolByAddress = new HashMap<>();
remapAddressByAddress = new HashMap<>();
determineMemoryBlocks();
+ mapPreExistingSymbols();
}
/**
@@ -101,23 +120,29 @@ public class PdbAddressManager {
}
/**
- * Write the mapped address for a query address, where where the mapping is
- * derived by using a the address of a PDB symbol as the key and finding the address of
- * a symbol in the program of the same "unique" name. This is accomplished using public
- * mangled symbols. If the program symbol came from the PDB, then it maps to itself.
- * @param address the query address
- * @param remapAddress the mapped address
+ * Returns the primary symbol for the address, as determined at the start of PDB processing
+ * before apply any PDB symbols.
+ * @param address the {@link Address}
+ * @return the primary symbol
*/
- void putRemapAddressByAddress(Address address, Address remapAddress) {
- Address lookup = remapAddressByAddress.get(address);
- if (lookup == null) {
- remapAddressByAddress.put(address, remapAddress);
- }
- else if (!lookup.equals(remapAddress) && lookup != badAddress) {
- applicator.appendLogMsg("Trying to map a mapped address to a new address... key: " +
- address + ", currentMap: " + lookup + ", newMap: " + remapAddress);
- remapAddressByAddress.put(address, badAddress);
- }
+ Symbol getPrimarySymbol(Address address) {
+ return primarySymbolByAddress.get(address);
+ }
+
+ /**
+ * Indicate to the {@link PdbAddressManager} that a new symbol with the given name has the
+ * associated address. This allows the PdbAddressManager to create and organize the
+ * re-mapped address and supply them. Also returns the address of the pre-existing symbol
+ * of the same name if the name was unique, otherwise null if it didn't exist or wasn't
+ * unique.
+ * @param name the symbol name
+ * @param address its associated address
+ * @return the {@link Address} of existing symbol or null
+ */
+ Address witnessSymbolNameAtAddress(String name, Address address) {
+ Address existingAddress = getAddressByPreExistingSymbolName(name);
+ putRemapAddressByAddress(address, existingAddress);
+ return existingAddress;
}
/**
@@ -219,6 +244,75 @@ public class PdbAddressManager {
}
}
+ //==============================================================================================
+ //==============================================================================================
+ /**
+ * Filling in the maps as indicated by their descriptions.
+ * @throws PdbException If Program is null;
+ */
+ private void mapPreExistingSymbols() throws PdbException {
+ Program program = applicator.getProgram();
+ if (program == null) {
+ throw new PdbException("Program may not be null");
+ }
+ SymbolIterator iter = program.getSymbolTable().getAllSymbols(false);
+ while (iter.hasNext()) {
+ Symbol symbol = iter.next();
+ String name = symbol.getName();
+ Address address = symbol.getAddress();
+ Address existingAddress = addressByPreExistingSymbolName.get(name);
+ if (existingAddress == null) {
+ addressByPreExistingSymbolName.put(name, address);
+ }
+ else if (!existingAddress.equals(address)) {
+ addressByPreExistingSymbolName.put(name, Address.NO_ADDRESS);
+ }
+ if (symbol.isPrimary()) {
+ primarySymbolByAddress.put(address, symbol);
+ }
+ }
+ }
+
+ /**
+ * Returns the address for the symbol name. If the symbol name did not exist within the
+ * program when the list was being populated or if the name was seen at more than one address,
+ * then null is returned
+ * @param name the name of the symbol
+ * @return the address for that name or null
+ */
+ private Address getAddressByPreExistingSymbolName(String name) {
+ Address address = addressByPreExistingSymbolName.get(name);
+ // Thin the list of map values we no longer need. This method should only be
+ // used after the list has been completely populated, and the NO_ADDRESS marker
+ // was only being used during the method that populated the list to indicate that a
+ // name was not unique for our needs.
+ if (address != null && address.equals(Address.NO_ADDRESS)) {
+ addressByPreExistingSymbolName.remove(name);
+ return null;
+ }
+ return address;
+ }
+
+ /**
+ * Write the mapped address for a query address, where where the mapping is
+ * derived by using a the address of a PDB symbol as the key and finding the address of
+ * a symbol in the program of the same "unique" name. This is accomplished using public
+ * mangled symbols. If the program symbol came from the PDB, then it maps to itself.
+ * @param address the query address
+ * @param remapAddress the mapped address
+ */
+ private void putRemapAddressByAddress(Address address, Address remapAddress) {
+ Address lookup = remapAddressByAddress.get(address);
+ if (lookup == null) {
+ remapAddressByAddress.put(address, remapAddress);
+ }
+ else if (!lookup.equals(remapAddress) && lookup != badAddress) {
+ applicator.appendLogMsg("Trying to map a mapped address to a new address... key: " +
+ address + ", currentMap: " + lookup + ", newMap: " + remapAddress);
+ remapAddressByAddress.put(address, badAddress);
+ }
+ }
+
//==============================================================================================
//==============================================================================================
/**
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbApplicator.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbApplicator.java
index f30b6ea142..dae0ed475d 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbApplicator.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbApplicator.java
@@ -97,6 +97,8 @@ public class PdbApplicator {
}
}
+ long primarySymbolCallCount;
+
//==============================================================================================
private String pdbFilename;
private AbstractPdb pdb;
@@ -177,6 +179,8 @@ public class PdbApplicator {
Address imageBaseParam, PdbApplicatorOptions applicatorOptionsParam,
TaskMonitor monitorParam, MessageLog logParam) throws PdbException, CancelledException {
+ primarySymbolCallCount = 0;
+
initializeApplyTo(programParam, dataTypeManagerParam, imageBaseParam,
applicatorOptionsParam, monitorParam, logParam);
@@ -198,6 +202,7 @@ public class PdbApplicator {
String applicatorMetrics = pdbApplicatorMetrics.getPostProcessingReport();
Msg.info(this, applicatorMetrics);
PdbLog.message(applicatorMetrics);
+ Msg.info(this, "Primary Symbol Call Count: " + primarySymbolCallCount);
Msg.info(this, "PDB Terminated Normally");
}
@@ -798,16 +803,30 @@ public class PdbApplicator {
return pdbAddressManager.getAddress(segment, offset);
}
+// /**
+// * Write the mapped address for a query address, where where the mapping is
+// * derived by using a the address of a PDB symbol as the key and finding the address of
+// * a symbol in the program of the same "unique" name. This is accomplished using public
+// * mangled symbols. If the program symbol came from the PDB, then it maps to itself.
+// * @param address the query address
+// * @param remapAddress the mapped address
+// */
+// void putRemapAddressByAddress(Address address, Address remapAddress) {
+// pdbAddressManager.putRemapAddressByAddress(address, remapAddress);
+// }
+//
/**
- * Write the mapped address for a query address, where where the mapping is
- * derived by using a the address of a PDB symbol as the key and finding the address of
- * a symbol in the program of the same "unique" name. This is accomplished using public
- * mangled symbols. If the program symbol came from the PDB, then it maps to itself.
- * @param address the query address
- * @param remapAddress the mapped address
+ * Indicate to the {@link PdbAddressManager} that a new symbol with the given name has the
+ * associated address. This allows the PdbAddressManager to create and organize the
+ * re-mapped address and supply them. Also returns the address of the pre-existing symbol
+ * of the same name if the name was unique, otherwise null if it didn't exist or wasn't
+ * unique.
+ * @param name the symbol name
+ * @param address its associated address
+ * @return the {@link Address} of existing symbol or null
*/
- void putRemapAddressByAddress(Address address, Address remapAddress) {
- pdbAddressManager.putRemapAddressByAddress(address, remapAddress);
+ Address witnessSymbolNameAtAddress(String name, Address address) {
+ return pdbAddressManager.witnessSymbolNameAtAddress(name, address);
}
/**
@@ -1294,6 +1313,7 @@ public class PdbApplicator {
//==============================================================================================
boolean shouldForcePrimarySymbol(Address address, boolean forceIfMangled) {
Symbol primarySymbol = program.getSymbolTable().getPrimarySymbol(address);
+ primarySymbolCallCount++;
if (primarySymbol != null) {
if (primarySymbol.getName().startsWith("?") && forceIfMangled &&
@@ -1350,4 +1370,140 @@ public class PdbApplicator {
return false;
}
+ //==============================================================================================
+ private static class PrimarySymbolInfo {
+ private Symbol symbol;
+ private boolean isNewSymbol;
+
+ private PrimarySymbolInfo(Symbol symbol, boolean isNewSymbol) {
+ this.symbol = symbol;
+ this.isNewSymbol = isNewSymbol;
+ }
+
+ private Symbol getSymbol() {
+ return symbol;
+ }
+
+ private boolean canBePrimaryForceOverriddenBy(String newName) {
+ if (getSource().isLowerPriorityThan(SourceType.IMPORTED)) {
+ return true;
+ }
+ if (isMangled() && !PdbApplicator.isMangled(newName)) {
+ return true;
+ }
+ if (isNewSymbol()) {
+ return false;
+ }
+ return false;
+ }
+
+ private SourceType getSource() {
+ return symbol.getSource();
+ }
+
+ private boolean isMangled() {
+ return symbol.getName().startsWith("?");
+ }
+
+ private boolean isNewSymbol() {
+ return isNewSymbol;
+ }
+
+// private PrimarySymbolType getPrimaryType() {
+// return primaryType;
+// }
+ }
+
+ private Map<Address, PrimarySymbolInfo> primarySymbolInfoByAddress = new HashMap<>();
+
+ //==============================================================================================
+ Symbol createSymbolNew(Address address, String symbolPathString,
+ boolean forcePrimaryIfExistingIsMangled) {
+
+ // Must get existing info before creating new symbol, as we do not want "existing"
+ // to include the new one
+ PrimarySymbolInfo existingPrimarySymbolInfo = getExistingPrimarySymbolInfo(address);
+ Symbol newSymbol = createSymbol(address, symbolPathString);
+ if (newSymbol == null) {
+ return null;
+ }
+
+ boolean forcePrimary = false;
+ if (existingPrimarySymbolInfo != null) {
+ if (existingPrimarySymbolInfo.canBePrimaryForceOverriddenBy(symbolPathString) &&
+ forcePrimaryIfExistingIsMangled &&
+ applicatorOptions.allowDemotePrimaryMangledSymbol()) {
+ forcePrimary = true;
+ }
+ }
+
+ boolean forcePrimarySucceeded = false;
+ if (forcePrimary) {
+ SetLabelPrimaryCmd cmd = new SetLabelPrimaryCmd(address, newSymbol.getName(),
+ newSymbol.getParentNamespace());
+ if (cmd.applyTo(program)) {
+ forcePrimarySucceeded = true;
+ }
+ }
+
+ if (existingPrimarySymbolInfo == null || forcePrimarySucceeded) {
+ PrimarySymbolInfo primarySymbolInfo = new PrimarySymbolInfo(newSymbol, true);
+ setExistingPrimarySymbolInfo(address, primarySymbolInfo);
+ }
+
+ return newSymbol;
+ }
+
+ private static boolean isMangled(String name) {
+ return name.startsWith("?");
+ }
+
+ private void setExistingPrimarySymbolInfo(Address address, PrimarySymbolInfo info) {
+ primarySymbolInfoByAddress.put(address, info);
+ }
+
+ private PrimarySymbolInfo getExistingPrimarySymbolInfo(Address address) {
+ PrimarySymbolInfo info = primarySymbolInfoByAddress.get(address);
+ if (info != null) {
+ return info;
+ }
+ //Symbol primarySymbol = program.getSymbolTable().getPrimarySymbol(address);
+ Symbol primarySymbol = pdbAddressManager.getPrimarySymbol(address);
+
+ primarySymbolCallCount++;
+ if (primarySymbol == null ||
+ primarySymbol.getSource().isLowerPriorityThan(SourceType.IMPORTED)) {
+ return null;
+ }
+ info = new PrimarySymbolInfo(primarySymbol, false);
+ primarySymbolInfoByAddress.put(address, info);
+ return info;
+ }
+
+ private Symbol createSymbol(Address address, String symbolPathString) {
+ Symbol symbol = null;
+ try {
+ Namespace namespace = program.getGlobalNamespace();
+ if (symbolPathString.startsWith(THUNK_NAME_PREFIX)) {
+ symbolPathString = symbolPathString.substring(THUNK_NAME_PREFIX.length(),
+ symbolPathString.length());
+ }
+ SymbolPath symbolPath = new SymbolPath(symbolPathString);
+ symbolPath = symbolPath.replaceInvalidChars();
+ String name = symbolPath.getName();
+ String namespacePath = symbolPath.getParentPath();
+ if (namespacePath != null) {
+ namespace = NamespaceUtils.createNamespaceHierarchy(namespacePath, namespace,
+ program, address, SourceType.IMPORTED);
+ }
+
+ symbol = SymbolUtilities.createPreferredLabelOrFunctionSymbol(program, address,
+ namespace, name, SourceType.IMPORTED);
+ }
+ catch (InvalidInputException e) {
+ appendLogMsg("Unable to create symbol " + symbolPathString + " at " + address);
+ }
+ return symbol;
+ }
+
}
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PeCoffGroupSymbolApplier.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PeCoffGroupSymbolApplier.java
index 69e2bc01fa..5efc7793a9 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PeCoffGroupSymbolApplier.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PeCoffGroupSymbolApplier.java
@@ -50,13 +50,14 @@ public class PeCoffGroupSymbolApplier extends MsSymbolApplier {
applicator.addMemoryGroupRefinement(symbol);
Address symbolAddress = applicator.getAddress(symbol);
if (!Address.NO_ADDRESS.equals(symbolAddress)) {
- boolean forcePrimary = applicator.shouldForcePrimarySymbol(symbolAddress, false);
- String name = symbol.getName();
- symbol.getLength();
- symbol.getCharacteristics();
- if (!applicator.createSymbol(symbolAddress, name, forcePrimary)) {
- applicator.appendLogMsg("Unable to create symbol " + name + " at " + symbolAddress);
- }
+// boolean forcePrimary = applicator.shouldForcePrimarySymbol(symbolAddress, false);
+// String name = symbol.getName();
+// symbol.getLength();
+// symbol.getCharacteristics();
+// if (!applicator.createSymbol(symbolAddress, name, forcePrimary)) {
+// applicator.appendLogMsg("Unable to create symbol " + name + " at " + symbolAddress);
+// }
+ applicator.createSymbolNew(symbolAddress, symbol.getName(), false);
}
else {
// monitor.setMessage("Skipping NO_ADDRESS symbol " + symb.getName() + "...");
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PublicSymbolApplier.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PublicSymbolApplier.java
index b1a53f5f6c..a38469693e 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PublicSymbolApplier.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PublicSymbolApplier.java
@@ -15,14 +15,11 @@
*/
package ghidra.app.util.pdb.pdbapplicator;
-import java.util.List;
-
import ghidra.app.util.bin.format.pdb2.pdbreader.PdbException;
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractMsSymbol;
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractPublicMsSymbol;
import ghidra.app.util.pdb.pdbapplicator.SymbolGroup.AbstractMsSymbolIterator;
import ghidra.program.model.address.Address;
-import ghidra.program.model.symbol.Symbol;
import ghidra.util.exception.AssertException;
import ghidra.util.exception.CancelledException;
@@ -60,26 +57,50 @@ public class PublicSymbolApplier extends MsSymbolApplier {
symbolAddress = applicator.getAddress(symbol);
if (!Address.NO_ADDRESS.equals(symbolAddress)) {
-
- if (getName().startsWith("?")) { // mangled... should be unique
- List<Symbol> existingSymbols =
- applicator.getProgram().getSymbolTable().getGlobalSymbols(getName());
- if (existingSymbols.size() == 1) {
- existingSymbolAddress = existingSymbols.get(0).getAddress();
- applicator.putRemapAddressByAddress(symbolAddress, existingSymbolAddress);
- }
- else if (existingSymbols.size() == 0) {
- String name = symbol.getName();
- if (!applicator.createSymbol(symbolAddress, name, true)) {
- applicator.appendLogMsg(
- "Unable to create symbol " + name + " at " + symbolAddress);
- }
- }
- else {
- applicator.appendLogMsg(
- "Unexpected multiple mangled symbols of same name: " + getName());
- }
+ String name = symbol.getName();
+ existingSymbolAddress = applicator.witnessSymbolNameAtAddress(getName(), symbolAddress);
+ // TODO: Consider... could add restriction of not putting down symbol if it is mangled,
+ // as this would violate the uniqueness of the symbol... but we would also want to
+ // know that this situation was being presented.
+ if (!symbolAddress.equals(existingSymbolAddress)) {
+// if (!applicator.createSymbol(symbolAddress, name, true)) {
+// applicator.appendLogMsg(
+// "Unable to create symbol " + name + " at " + symbolAddress);
+// }
+ // Note: the following does not work because thunks and thunked functions
+ // end up getting the same name with the way names are currently propagated.
+ // TODO; consider putting this back in if thunks take into account the fact
+ // that mangled names should be unique.
+// if (name.startsWith("?") && existingSymbolAddress != null) {
+// applicator.appendLogMsg("Mangled symbol exists elsewhere. Not placing: " +
+// symbolAddress + " " + name);
+// }
+// else {
+// applicator.createSymbolNew(symbolAddress, symbol.getName(), true);
+// }
+ // Just do this instead of the commented-out code trying to avoid duplicate
+ // mangled names
+ applicator.createSymbolNew(symbolAddress, symbol.getName(), true);
}
+// if (name.startsWith("?")) { // mangled... should be unique
+// List<Symbol> existingSymbols =
+// applicator.getProgram().getSymbolTable().getGlobalSymbols(getName());
+// if (existingSymbols.size() == 1) {
+// existingSymbolAddress = existingSymbols.get(0).getAddress();
+// applicator.putRemapAddressByAddress(symbolAddress, existingSymbolAddress);
+// }
+// else if (existingSymbols.size() == 0) {
+// if (!applicator.createSymbol(symbolAddress, name, true)) {
+// applicator.appendLogMsg(
+// "Unable to create symbol " + name + " at " + symbolAddress);
+// }
+//// applicator.createSymbolNew(symbolAddress, symbol.getName(), true);
+// }
+// else {
+// applicator.appendLogMsg(
+// "Unexpected multiple mangled symbols of same name: " + getName());
+// }
+// }
}
else {
pdbLogAndInfoMessage(this, "Could not apply symbol at NO_ADDRESS: " + symbol.getName());