Ghidra is a software reverse engineering (SRE) framework
GP-1775 - Fix PDB calculation of number of module contributing files
ghizard5ccf77b48fda
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractModuleInformation.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractModuleInformation.javaindex 5ed8f34c08..01003f15b8 100644--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractModuleInformation.java+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractModuleInformation.java@@ -53,8 +53,6 @@ public abstract class AbstractModuleInformation {protected long nameIndexSourceFile; // unsigned 32-bitprotected long nameIndexCompilerPdbPath; // unsigned 32-bit- protected boolean adjustedNumbFilesContributing;-//==============================================================================================private Map<Integer, String> filenameByOffset = new HashMap<>();@@ -72,24 +70,6 @@ public abstract class AbstractModuleInformation {return numFilesContributing;}- /**- * Back-door method to set an adjusted {@code numFilesContributing}.- * @param numFilesContributing the value to be set.- */- void setNumFilesContributing(int numFilesContributing) {- this.numFilesContributing = numFilesContributing;- adjustedNumbFilesContributing = true;- }-- /**- * Returns {@code true} if we adjusted the {@link #numFilesContributing} value from {@code 0}- * to {@code 1}. Suspect this is an issue with a particular non-MSFT compiler tool chain.- * @return {@code true} if we changed the {@link #numFilesContributing} value.- */- public boolean isAdjustedNumFilesContributing() {- return adjustedNumbFilesContributing;- }-/*** Returns list of offsets for the module.* @return Offsets.@@ -186,7 +166,7 @@ public abstract class AbstractModuleInformation {//==============================================================================================/*** Deserializes the Additionals. Abstract method filled in by instances to parse additional- * data pertinent to themselves.+ * data pertinent to themselves.* @param reader {@link PdbByteReader} from which to deserialize the data.* @throws PdbException upon error parsing a string name.*/diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbDebugInfo.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbDebugInfo.javaindex 8d3c46877b..bad6fe6ec2 100644--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbDebugInfo.java+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbDebugInfo.java@@ -100,7 +100,7 @@ public abstract class PdbDebugInfo {/*** Deserializes the {@link PdbDebugInfo}-based instance.- * The pdb is updated with dbiAge and targetProcessor during deserialization+ * The pdb is updated with dbiAge and targetProcessor during deserialization* of new DBI header.* @param headerOnly if true only the DBI header fields will be parsed* @param monitor {@link TaskMonitor} used for checking cancellation.@@ -187,7 +187,7 @@ public abstract class PdbDebugInfo {}/**- * Returns the {@link AbstractMsSymbol} from the main symbols for the+ * Returns the {@link AbstractMsSymbol} from the main symbols for the* actual symbol record offset (which is past the length and symbol type fields).* @param offset the offset of the symbol (beyond length and symbol type fields); this is the* offset value specified by many symbol type records.@@ -481,14 +481,6 @@ public abstract class PdbDebugInfo {if (totalCount != numRefs) {PdbLog.message("totalRefs != numRefs, using totalRefs");}- int previousIndex = totalCount;- for (int moduleIndex = numInformationModules - 1; moduleIndex >= 0; moduleIndex--) {- monitor.checkCanceled();- int numFilesContributing = previousIndex - index[moduleIndex];- previousIndex = index[moduleIndex];- AbstractModuleInformation module = moduleInformationList.get(moduleIndex);- module.setNumFilesContributing(numFilesContributing);- }PdbByteReader offsetReader = fileInfoReader.getSubPdbByteReader(totalCount * 4);int[] offset = new int[totalCount];diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbDebugInfoParser.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbDebugInfoParser.javaindex b0644a9321..f7579e7175 100644--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbDebugInfoParser.java+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbDebugInfoParser.java@@ -27,7 +27,7 @@ import ghidra.util.task.TaskMonitor;*/public class PdbDebugInfoParser {- private static final int DATABASE_INTERFACE_STREAM_NUMBER = 3;+ private static final int DEBUG_INFO_STREAM_NUMBER = 3;//==============================================================================================public static final int DBIHDR700_SIG = 0xffffffff;@@ -106,7 +106,7 @@ public class PdbDebugInfoParser {* @return Stream number that contains the Database Interface.*/protected int getStreamNumber() {- return DATABASE_INTERFACE_STREAM_NUMBER;+ return DEBUG_INFO_STREAM_NUMBER;}}