diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/dump/pagedump/Pagedump.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/dump/pagedump/Pagedump.java
index 7c36344d55..d3af56676c 100644
--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/dump/pagedump/Pagedump.java
+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/dump/pagedump/Pagedump.java
@@ -201,11 +201,10 @@ public class Pagedump extends DumpFile {
applicatorOptions.setProcessingControl(PdbApplicatorControl.DATA_TYPES_ONLY);
try (AbstractPdb pdb = PdbParser.parse(pdbFile.getPath(), readerOptions, monitor)) {
monitor.setMessage("PDB: Parsing " + pdbFile + "...");
- pdb.deserialize(monitor);
- DefaultPdbApplicator applicator = new DefaultPdbApplicator(pdbFile.getPath(), pdb);
+ pdb.deserialize();
+ DefaultPdbApplicator applicator = new DefaultPdbApplicator(pdb);
applicator.applyTo(program, dtm, program.getImageBase(),
- applicatorOptions, monitor,
- (MessageLog) null);
+ applicatorOptions, (MessageLog) null);
}
catch (PdbException | IOException | CancelledException e) {
Msg.error(this, e.getMessage());
diff --git a/Ghidra/Features/PDB/developer_scripts/PdbDeveloperDumpScript.java b/Ghidra/Features/PDB/developer_scripts/PdbDeveloperDumpScript.java
index 614c218d4a..7788966362 100644
--- a/Ghidra/Features/PDB/developer_scripts/PdbDeveloperDumpScript.java
+++ b/Ghidra/Features/PDB/developer_scripts/PdbDeveloperDumpScript.java
@@ -63,7 +63,7 @@ public class PdbDeveloperDumpScript extends GhidraScript {
monitor.setMessage(message);
Msg.info(this, message);
try (AbstractPdb pdb = PdbParser.parse(pdbFileName, new PdbReaderOptions(), monitor)) {
- pdb.deserialize(monitor);
+ pdb.deserialize();
FileWriter fileWriter = new FileWriter(dumpFile);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
outputHeaderMessage(bufferedWriter, pdbFileName);
diff --git a/Ghidra/Features/PDB/developer_scripts/PdbDeveloperDumpSetScript.java b/Ghidra/Features/PDB/developer_scripts/PdbDeveloperDumpSetScript.java
index c202248c7c..668e12999d 100644
--- a/Ghidra/Features/PDB/developer_scripts/PdbDeveloperDumpSetScript.java
+++ b/Ghidra/Features/PDB/developer_scripts/PdbDeveloperDumpSetScript.java
@@ -86,7 +86,7 @@ public class PdbDeveloperDumpSetScript extends GhidraScript {
println("Processing PDB Dump of: " + entry.input());
try (AbstractPdb pdb =
PdbParser.parse(entry.input(), new PdbReaderOptions(), monitor)) {
- pdb.deserialize(monitor);
+ pdb.deserialize();
try (BufferedWriter bufferedWriter =
new BufferedWriter(new FileWriter(new File(entry.output())))) {
outputHeaderMessage(bufferedWriter, entry.input());
diff --git a/Ghidra/Features/PDB/developer_scripts/pdbquery/PdbFactory.java b/Ghidra/Features/PDB/developer_scripts/pdbquery/PdbFactory.java
index 8c922c8516..ab8d6a694f 100644
--- a/Ghidra/Features/PDB/developer_scripts/pdbquery/PdbFactory.java
+++ b/Ghidra/Features/PDB/developer_scripts/pdbquery/PdbFactory.java
@@ -61,7 +61,7 @@ public class PdbFactory {
try {
AbstractPdb pdb = PdbParser.parse(filename, new PdbReaderOptions(), monitor);
PdbIdentifiers identifiers = pdb.getIdentifiers();
- pdb.deserialize(monitor);
+ pdb.deserialize();
PdbReaderMetrics metrics = pdb.getPdbReaderMetrics();
pdbInfo = new PdbInfo(filename, identifiers, pdb, metrics);
pdbInfoByFile.put(filename, pdbInfo);
diff --git a/Ghidra/Features/PDB/developer_scripts/pdbquery/PdbQuery.java b/Ghidra/Features/PDB/developer_scripts/pdbquery/PdbQuery.java
index b5358adac4..ce102aec7f 100644
--- a/Ghidra/Features/PDB/developer_scripts/pdbquery/PdbQuery.java
+++ b/Ghidra/Features/PDB/developer_scripts/pdbquery/PdbQuery.java
@@ -41,7 +41,7 @@ public class PdbQuery {
*/
public static AbstractMsType getDataTypeRecord(GhidraScript script, AbstractPdb pdb,
int number) {
- AbstractTypeProgramInterface tpi = pdb.getTypeProgramInterface();
+ TypeProgramInterface tpi = pdb.getTypeProgramInterface();
if (tpi == null) {
println(script, "PDB does not contain a TPI... aborting search.");
return null;
@@ -75,7 +75,7 @@ public class PdbQuery {
*/
public static AbstractMsType getItemTypeRecord(GhidraScript script, AbstractPdb pdb,
int number) {
- AbstractTypeProgramInterface ipi = pdb.getItemProgramInterface();
+ TypeProgramInterface ipi = pdb.getItemProgramInterface();
if (ipi == null) {
println(script, "PDB does not contain an IPI... aborting search.");
return null;
@@ -102,7 +102,7 @@ public class PdbQuery {
/**
* Searches PDB data type records that contain the search string. Outputs results to the
- * console.
+ * console
* @param script the script for which we are working
* @param pdb the PDB to search
* @param searchString the search string
@@ -110,7 +110,7 @@ public class PdbQuery {
*/
public static void searchDataTypes(GhidraScript script, AbstractPdb pdb, String searchString)
throws CancelledException {
- AbstractTypeProgramInterface tpi = pdb.getTypeProgramInterface();
+ TypeProgramInterface tpi = pdb.getTypeProgramInterface();
if (tpi == null) {
println(script, "PDB does not contain a TPI... aborting search.");
}
@@ -140,7 +140,7 @@ public class PdbQuery {
/**
* Searches PDB item records that contain the search string. Outputs results to the
- * console.
+ * console
* @param script the script for which we are working
* @param pdb the PDB to search
* @param searchString the search string
@@ -148,7 +148,7 @@ public class PdbQuery {
*/
public static void searchItemTypes(GhidraScript script, AbstractPdb pdb, String searchString)
throws CancelledException {
- AbstractTypeProgramInterface ipi = pdb.getItemProgramInterface();
+ TypeProgramInterface ipi = pdb.getItemProgramInterface();
if (ipi == null) {
println(script, "PDB does not contain an IPI... aborting search.");
return;
@@ -179,7 +179,7 @@ public class PdbQuery {
/**
* Searches PDB symbol records that contain the search string. Outputs results to the
- * console.
+ * console
* @param script the script for which we are working
* @param pdb the PDB to search
* @param searchString the search string
@@ -238,7 +238,7 @@ public class PdbQuery {
/**
* Method for outputting a message to the console (if script is not null); otherwise outputs
- * the message to Msg.info().
+ * the message to Msg.info()
* @param script the script
* @param message the message to output to the console
*/
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/plugin/core/analysis/PdbUniversalAnalyzer.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/plugin/core/analysis/PdbUniversalAnalyzer.java
index 54abd0f22b..eefa95407e 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/plugin/core/analysis/PdbUniversalAnalyzer.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/plugin/core/analysis/PdbUniversalAnalyzer.java
@@ -180,10 +180,10 @@ public class PdbUniversalAnalyzer extends AbstractAnalyzer {
try (AbstractPdb pdb = PdbParser.parse(pdbFile.getPath(), pdbReaderOptions, monitor)) {
monitor.setMessage("PDB: Parsing " + pdbFile + "...");
- pdb.deserialize(monitor);
- DefaultPdbApplicator applicator = new DefaultPdbApplicator(pdbFile.getPath(), pdb);
+ pdb.deserialize();
+ DefaultPdbApplicator applicator = new DefaultPdbApplicator(pdb);
applicator.applyTo(program, program.getDataTypeManager(), program.getImageBase(),
- pdbApplicatorOptions, monitor, log);
+ pdbApplicatorOptions, log);
}
catch (PdbException | IOException e) {
@@ -249,11 +249,11 @@ public class PdbUniversalAnalyzer extends AbstractAnalyzer {
* on the specified program.
*
* Normally the analyzer would locate the PDB file on its own, but if a
- * headless script wishes to override the analyzer's behaivor, it can
+ * headless script wishes to override the analyzer's behavior, it can
* use this method to specify a file.
*
- * @param program {@link Program}
- * @param pdbFile the pdb file
+ * @param program the program
+ * @param pdbFile the PDB file
*/
public static void setPdbFileOption(Program program, File pdbFile) {
PdbAnalyzerCommon.setPdbFileOption(NAME, program, pdbFile);
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractPdb.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractPdb.java
index bec4339a9e..a41619bb0b 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractPdb.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractPdb.java
@@ -20,7 +20,7 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
-import ghidra.app.util.bin.format.pdb2.pdbreader.msf.AbstractMsf;
+import ghidra.app.util.bin.format.pdb2.pdbreader.msf.Msf;
import ghidra.app.util.bin.format.pdb2.pdbreader.msf.MsfStream;
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractMsSymbol;
import ghidra.app.util.bin.format.pdb2.pdbreader.type.AbstractMsType;
@@ -52,7 +52,7 @@ public abstract class AbstractPdb implements AutoCloseable {
//==============================================================================================
// Internals
//==============================================================================================
- protected AbstractMsf msf;
+ protected Msf msf;
protected PdbReaderOptions readerOptions;
@@ -63,7 +63,7 @@ public abstract class AbstractPdb implements AutoCloseable {
protected int pdbAge = 0;
protected int dbiAge = 0;
- protected AbstractTypeProgramInterface typeProgramInterface;
+ protected TypeProgramInterface typeProgramInterface;
protected PdbDebugInfo debugInfo;
protected Processor targetProcessor = Processor.UNKNOWN;
@@ -77,7 +77,7 @@ public abstract class AbstractPdb implements AutoCloseable {
protected List parameters;
protected NameTable nameTable;
- protected AbstractTypeProgramInterface itemProgramInterface; //IPI seems to be a TPI.
+ protected TypeProgramInterface itemProgramInterface; //IPI seems to be a TPI.
// Items below begin in Pdb700
protected GUID guid; // We can return null by not initializing the guid.
@@ -104,10 +104,10 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Parses an address segment typically used by some {@link AbstractMsSymbol} type. In addition,
- * {@link PdbReaderMetrics} may be updated for segment information.
- * @param reader The reader from which to parse the segment.
- * @return The segment.
- * @throws PdbException Upon not enough data left to parse.
+ * {@link PdbReaderMetrics} may be updated for segment information
+ * @param reader the reader from which to parse the segment
+ * @return the segment
+ * @throws PdbException upon not enough data left to parse
*/
public int parseSegment(PdbByteReader reader) throws PdbException {
int segment = reader.parseUnsignedShortVal();
@@ -119,8 +119,8 @@ public abstract class AbstractPdb implements AutoCloseable {
// API
//==============================================================================================
/**
- * Closes the {@link AbstractPdb} and resources that it uses.
- * @throws IOException for file I/O reasons.
+ * Closes the {@link AbstractPdb} and resources that it uses
+ * @throws IOException for file I/O reasons
*/
@Override
public void close() throws IOException {
@@ -130,26 +130,26 @@ public abstract class AbstractPdb implements AutoCloseable {
}
/**
- * Returns the {@link PdbReaderOptions} for this PDB.
- * @return the {@link PdbReaderOptions} for this PDB.
+ * Returns the {@link PdbReaderOptions} for this PDB
+ * @return the {@link PdbReaderOptions} for this PDB
*/
public PdbReaderOptions getPdbReaderOptions() {
return readerOptions;
}
/**
- * Returns the main {@link PdbIdentifiers} found in the PDB Directory.
- * @return {@link PdbIdentifiers} of information.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException Upon error in processing components.
+ * Returns the main {@link PdbIdentifiers} found in the PDB Directory
+ * @return {@link PdbIdentifiers} of information
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error in processing components
*/
public PdbIdentifiers getIdentifiers() throws IOException, PdbException {
parseDBI();
if (debugInfo != null) {
try {
// dbiAge and targetProcessor set during deserialization of new DBI header
- debugInfo.deserialize(true, TaskMonitor.DUMMY);
+ debugInfo.deserialize(true);
}
catch (CancelledException e) {
throw new AssertException(e); // unexpected
@@ -163,20 +163,19 @@ public abstract class AbstractPdb implements AutoCloseable {
}
/**
- * Deserializes this PDB from the underlying {@link AbstractMsf}.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException Upon error in processing components.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes this PDB from the underlying {@link Msf}
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error in processing components
+ * @throws CancelledException upon user cancellation
*/
- public void deserialize(TaskMonitor monitor)
+ public void deserialize()
throws IOException, PdbException, CancelledException {
// msf should only be null for testing versions of PDB.
if (msf == null) {
return;
}
- deserializeDirectory(monitor);
+ deserializeDirectory();
//directoryStream.dump(Integer.MAX_VALUE);
//System.out.println(pdb.dumpDirectory());
@@ -186,7 +185,7 @@ public abstract class AbstractPdb implements AutoCloseable {
// pdb.dumpStream(3, 0x400);
// pdb.dumpStream(4, 0x400);
- deserializeSubstreams(monitor);
+ deserializeSubstreams();
// pdb.dumpSubStreams();
// pdb.dumpGlobalSymbols(); //TODO: evaluate where/who calls.
@@ -196,48 +195,48 @@ public abstract class AbstractPdb implements AutoCloseable {
}
/**
- * Returns the Version Number of the PDB.
- * @return Version Number of the PDB.
+ * Returns the Version Number of the PDB
+ * @return Version Number of the PDB
*/
public int getVersionNumber() {
return versionNumber;
}
/**
- * Returns the Signature of the PDB.
- * @return Signature of the PDB.
+ * Returns the Signature of the PDB
+ * @return Signature of the PDB
*/
public int getSignature() {
return signature;
}
/**
- * Returns the Age of the PDB.
- * @return Age of the PDB.
+ * Returns the Age of the PDB
+ * @return Age of the PDB
*/
public int getAge() {
return pdbAge;
}
/**
- * Returns the GUID for the PDB.
- * @return {@link GUID} for the PDB.
+ * Returns the GUID for the PDB
+ * @return {@link GUID} for the PDB
*/
public GUID getGuid() {
return guid;
}
/**
- * Tells whether the PDB file has been completely deserialized yet.
- * @return True if has been deserialized.
+ * Tells whether the PDB file has been completely deserialized yet
+ * @return {@code true} if has been deserialized
*/
public boolean isDeserialized() {
return substreamsDeserialized;
}
/**
- * Get the index number of the target processor used for compilation.
- * @return Index number of the target processor used for compilation.
+ * Get the index number of the target processor used for compilation
+ * @return Index number of the target processor used for compilation
* @see Processor
* @see RegisterName
*/
@@ -246,8 +245,8 @@ public abstract class AbstractPdb implements AutoCloseable {
}
/**
- * Returns whether there is minimal debug information.
- * @return {@code true} if there is minimal debug information.
+ * Returns whether there is minimal debug information
+ * @return {@code true} if there is minimal debug information
*/
public boolean hasMinimalDebugInfo() {
return minimalDebugInfo;
@@ -275,7 +274,7 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Set the age as specified by the new DBI header. A value of 0 corresponds
- * to the old DBI header.
+ * to the old DBI header
* @param dbiAge age as specified by the new DBI header
*/
void setDbiAge(int dbiAge) {
@@ -283,26 +282,26 @@ public abstract class AbstractPdb implements AutoCloseable {
}
/**
- * Returns the {@link AbstractTypeProgramInterface} component.
- * @return {@link AbstractTypeProgramInterface} component or null if not available.
+ * Returns the {@link TypeProgramInterface} component
+ * @return {@link TypeProgramInterface} component or null if not available
*/
- public AbstractTypeProgramInterface getTypeProgramInterface() {
+ public TypeProgramInterface getTypeProgramInterface() {
return typeProgramInterface;
}
/**
- * Returns the ItemProgramInterface (of type {@link AbstractTypeProgramInterface})
- * component.
- * @return ItemProgramInterface (of type {@link AbstractTypeProgramInterface}) component
- * or null if not available.
+ * Returns the ItemProgramInterface (of type {@link TypeProgramInterface})
+ * component
+ * @return ItemProgramInterface (of type {@link TypeProgramInterface}) component
+ * or null if not available
*/
- public AbstractTypeProgramInterface getItemProgramInterface() {
+ public TypeProgramInterface getItemProgramInterface() {
return itemProgramInterface;
}
/**
- * Returns the {@link PdbDebugInfo} component.
- * @return {@link PdbDebugInfo} component or null if not available.
+ * Returns the {@link PdbDebugInfo} component
+ * @return {@link PdbDebugInfo} component or null if not available
*/
public PdbDebugInfo getDebugInfo() {
return debugInfo;
@@ -311,8 +310,8 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Returns the record for the associated record number, which is expected to match the
* desired class
- * @param recordNumber the record number.
- * @return the record.
+ * @param recordNumber the record number
+ * @return the record
*/
public AbstractMsType getTypeRecord(RecordNumber recordNumber) {
return getTypeRecord(recordNumber, AbstractMsType.class);
@@ -320,11 +319,11 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Returns the record for the associated record number, which is expected to match the
- * desired class.
- * @param class return type.
- * @param recordNumber record number.
- * @param typeClass desired class type for return.
- * @return the record.
+ * desired class
+ * @param class return type
+ * @param recordNumber record number
+ * @param typeClass desired class type for return
+ * @return the record
*/
public T getTypeRecord(RecordNumber recordNumber,
Class typeClass) {
@@ -369,18 +368,18 @@ public abstract class AbstractPdb implements AutoCloseable {
}
/**
- * Returns a name from the {@link NameTable} pertaining to the index argument.
- * @param index Index of the name.
- * @return Name.
+ * Returns a name from the {@link NameTable} pertaining to the index argument
+ * @param index index of the name
+ * @return name
*/
public String getNameFromNameIndex(int index) {
return nameTable.getNameFromStreamNumber(index);
}
/**
- * Returns an index of the {@link String} name argument in the {@link NameTable}.
- * @param name Name for which to find the index.
- * @return Index of the name argument.
+ * Returns an index of the {@link String} name argument in the {@link NameTable}
+ * @param name name for which to find the index
+ * @return index of the name argument
*/
public int getNameIndexFromName(String name) {
return nameTable.getStreamNumberFromName(name);
@@ -388,9 +387,9 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Returns a name from the {@link NameTable} pertaining to the byte-offset in the block of
- * names for the table.
- * @param offset Byte-offset of the name in the {@link NameTable} block.
- * @return Name at the byte offset in the Name Table.
+ * names for the table
+ * @param offset byte offset of the name in the {@link NameTable} block
+ * @return name at the byte offset in the Name Table
*/
public String getNameStringFromOffset(int offset) {
return nameTable.getNameStringFromOffset(offset);
@@ -400,43 +399,42 @@ public abstract class AbstractPdb implements AutoCloseable {
// Package-Protected Internals
//==============================================================================================
/**
- * Returns the number of bytes needed to store a PDB version number.
- * location.
- * @return Number of bytes needed to store a PDV version number.
+ * Returns the number of bytes needed to store a PDB version number
+ * @return number of bytes needed to store a PDV version number
*/
static int getVersionNumberSize() {
return VERSION_NUMBER_SIZE;
}
/**
- * Deserializes PDB Version Number from the PDB Directory Stream in the {@link AbstractMsf}.
- * @param msf {@link AbstractMsf} underlying the PDB of which to probe.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @return Version number.
- * @throws IOException on file I/O issues.
- * @throws PdbException on parsing issues.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes PDB Version Number from the PDB Directory Stream in the {@link Msf}
+ * @param msf {@link Msf} underlying the PDB of which to probe
+ * @param monitor {@link TaskMonitor} used for checking cancellation
+ * @return version number
+ * @throws IOException on file I/O issues
+ * @throws PdbException on parsing issues
+ * @throws CancelledException upon user cancellation
*/
- static int deserializeVersionNumber(AbstractMsf msf, TaskMonitor monitor)
+ static int deserializeVersionNumber(Msf msf, TaskMonitor monitor)
throws IOException, PdbException, CancelledException {
MsfStream directoryStream = msf.getStream(PDB_DIRECTORY_STREAM_NUMBER);
if (directoryStream.getLength() < AbstractPdb.getVersionNumberSize()) {
throw new PdbException("Directory Stream too short");
}
- byte[] bytes = directoryStream.read(0, AbstractPdb.getVersionNumberSize(), monitor);
+ byte[] bytes = directoryStream.read(0, AbstractPdb.getVersionNumberSize());
PdbByteReader pdbDirectoryReader = new PdbByteReader(bytes);
return pdbDirectoryReader.parseInt();
}
/**
- * Constructor.
- * @param msf {@link AbstractMsf} foundation for the PDB.
- * @param readerOptions {@link PdbReaderOptions} used for processing the PDB.
- * @throws IOException Upon file IO seek/read issues.
- * @throws PdbException Upon unknown value for configuration or error in processing components.
+ * Constructor
+ * @param msf {@link Msf} foundation for the PDB
+ * @param readerOptions {@link PdbReaderOptions} used for processing the PDB
+ * @throws IOException upon file IO seek/read issues
+ * @throws PdbException upon unknown value for configuration or error in processing components
*/
- AbstractPdb(AbstractMsf msf, PdbReaderOptions readerOptions) throws IOException, PdbException {
+ AbstractPdb(Msf msf, PdbReaderOptions readerOptions) throws IOException, PdbException {
this.msf = msf;
this.readerOptions = readerOptions;
strings = new ArrayList<>();
@@ -446,34 +444,57 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Deserializes the main {@link PdbIdentifiers} found in the PDB Directory from the
- * {@link PdbByteReader}.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException upon error parsing a field.
- * @throws CancelledException Upon user cancellation.
+ * {@link PdbByteReader}
+ * @param monitor {@link TaskMonitor} used for checking cancellation
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error parsing a field
+ * @throws CancelledException upon user cancellation
*/
abstract void deserializeIdentifiersOnly(TaskMonitor monitor)
throws IOException, PdbException, CancelledException;
/**
- * Returns the {@link AbstractMsf} foundation for the PDB.
- * @return {@link AbstractMsf} foundation of the PDB.
+ * Returns the filename
+ * @return the filename
*/
- AbstractMsf getMsf() {
+ public String getFilename() {
+ return msf.getFilename();
+ }
+
+ /**
+ * Returns the TaskMonitor
+ * @return the monitor
+ */
+ public TaskMonitor getMonitor() {
+ return msf.getMonitor();
+ }
+
+ /**
+ * Check to see if this monitor has been canceled
+ * @throws CancelledException if monitor has been cancelled
+ */
+ public void checkCanceled() throws CancelledException {
+ getMonitor().checkCanceled();
+ }
+
+ /**
+ * Returns the {@link Msf} foundation for the PDB
+ * @return {@link Msf} foundation of the PDB
+ */
+ Msf getMsf() {
return msf;
}
//TODO Not sure if we will keep this method or if more gets added to it.
/**
- * Deserializes the sub-streams for this {@link AbstractPdb} object.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException Upon error in processing components.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the sub-streams for this {@link AbstractPdb} object
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error in processing components
+ * @throws CancelledException upon user cancellation
*/
- void deserializeSubstreams(TaskMonitor monitor)
+ void deserializeSubstreams()
throws IOException, PdbException, CancelledException {
if (substreamsDeserialized) {
@@ -482,18 +503,18 @@ public abstract class AbstractPdb implements AutoCloseable {
TypeProgramInterfaceParser tpiParser = new TypeProgramInterfaceParser();
- typeProgramInterface = tpiParser.parse(this, monitor);
+ typeProgramInterface = tpiParser.parse(this);
if (typeProgramInterface != null) {
- typeProgramInterface.deserialize(monitor);
+ typeProgramInterface.deserialize();
}
boolean ipiStreamHasNoName = ItemProgramInterfaceParser.hackCheckNoNameForStream(nameTable);
pdbReaderMetrics.witnessIpiDetection(ipiStreamHasNoName, hasIdStream);
if (hasIdStream || ipiStreamHasNoName) {
ItemProgramInterfaceParser ipiParser = new ItemProgramInterfaceParser();
- itemProgramInterface = ipiParser.parse(this, monitor);
+ itemProgramInterface = ipiParser.parse(this);
if (itemProgramInterface != null) {
- itemProgramInterface.deserialize(monitor);
+ itemProgramInterface.deserialize();
}
//processDependencyIndexPairList();
//dumpDependencyGraph();
@@ -501,7 +522,7 @@ public abstract class AbstractPdb implements AutoCloseable {
parseDBI();
if (debugInfo != null) {
- debugInfo.deserialize(false, monitor);
+ debugInfo.deserialize(false);
}
substreamsDeserialized = true;
@@ -517,47 +538,45 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Returns a {@link PdbByteReader} initialized with the complete contents of the
- * {@link MsfStream} referenced by {@code streamNumber}.
- * @param streamNumber The stream number of the {@link MsfStream} from which to load the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @return The {@link PdbByteReader}.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws CancelledException Upon user cancellation.
+ * {@link MsfStream} referenced by {@code streamNumber}
+ * @param streamNumber the stream number of the {@link MsfStream} from which to load the data
+ * @return the {@link PdbByteReader}
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws CancelledException upon user cancellation
*/
- PdbByteReader getReaderForStreamNumber(int streamNumber, TaskMonitor monitor)
+ PdbByteReader getReaderForStreamNumber(int streamNumber)
throws IOException, CancelledException {
- return getReaderForStreamNumber(streamNumber, 0, MsfStream.MAX_STREAM_LENGTH, monitor);
+ return getReaderForStreamNumber(streamNumber, 0, MsfStream.MAX_STREAM_LENGTH);
}
/**
* Returns a {@link PdbByteReader} initialized with up to {@code numToRead} byte of content
* (less if not available) from the {@link MsfStream} referenced by {@code streamNumber}
- * starting at {@code streamOffset}.
- * @param streamNumber The stream number of the {@link MsfStream} from which to load the data.
- * @param streamOffset Starting location within the {@link MsfStream} from which to get the
- * data.
- * @param numToRead Number of bytes used to initialize the {@link PdbByteReader}.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @return The {@link PdbByteReader}.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws CancelledException Upon user cancellation.
+ * starting at {@code streamOffset}
+ * @param streamNumber the stream number of the {@link MsfStream} from which to load the data
+ * @param streamOffset starting location within the {@link MsfStream} from which to get the
+ * data
+ * @param numToRead number of bytes used to initialize the {@link PdbByteReader}
+ * @return the {@link PdbByteReader}
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws CancelledException upon user cancellation
*/
- PdbByteReader getReaderForStreamNumber(int streamNumber, int streamOffset, int numToRead,
- TaskMonitor monitor) throws IOException, CancelledException {
+ PdbByteReader getReaderForStreamNumber(int streamNumber, int streamOffset, int numToRead)
+ throws IOException, CancelledException {
MsfStream stream = msf.getStream(streamNumber);
numToRead = Math.min(numToRead, stream.getLength() - streamOffset);
- byte[] bytes = stream.read(streamOffset, numToRead, monitor);
+ byte[] bytes = stream.read(streamOffset, numToRead);
PdbByteReader reader = new PdbByteReader(bytes);
return reader;
}
/**
- * Debug method to dump the number of bytes for the specified stream to a {@link String}.
- * @param streamNumber The stream number to dump.
- * @param maxOut The maximum number of bytes to dump.
- * @return {@link String} of pretty output.
+ * Debug method to dump the number of bytes for the specified stream to a {@link String}
+ * @param streamNumber the stream number to dump
+ * @param maxOut the maximum number of bytes to dump
+ * @return {@link String} of pretty output
*/
String dumpStream(int streamNumber, int maxOut) {
StringBuilder builder = new StringBuilder();
@@ -569,21 +588,20 @@ public abstract class AbstractPdb implements AutoCloseable {
// Abstract Methods
//==============================================================================================
/**
- * Deserializes PDB Directory from the {@link PdbByteReader}.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException upon error parsing a field.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes PDB Directory from the {@link PdbByteReader}
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error parsing a field
+ * @throws CancelledException upon user cancellation
*/
- abstract void deserializeDirectory(TaskMonitor monitor)
+ abstract void deserializeDirectory()
throws IOException, PdbException, CancelledException;
/**
* Dumps the PDB Directory to {@link Writer}. This package-protected method is for
* debugging only.
* @param writer {@link Writer}.
- * @throws IOException On issue writing to the {@link Writer}.
+ * @throws IOException on issue writing to the {@link Writer}.
*/
public abstract void dumpDirectory(Writer writer) throws IOException;
@@ -592,23 +610,22 @@ public abstract class AbstractPdb implements AutoCloseable {
//==============================================================================================
/**
- * Reads the Directory stream and returns a {@link PdbByteReader} of its contents.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @return {@link PdbByteReader} requested.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws CancelledException Upon user cancellation.
+ * Reads the Directory stream and returns a {@link PdbByteReader} of its contents
+ * @return {@link PdbByteReader} requested
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws CancelledException upon user cancellation
*/
- protected PdbByteReader getDirectoryReader(TaskMonitor monitor)
+ protected PdbByteReader getDirectoryReader()
throws IOException, CancelledException {
- return getReaderForStreamNumber(PDB_DIRECTORY_STREAM_NUMBER, 0, MsfStream.MAX_STREAM_LENGTH,
- monitor);
+ return getReaderForStreamNumber(PDB_DIRECTORY_STREAM_NUMBER, 0,
+ MsfStream.MAX_STREAM_LENGTH);
}
/**
- * Deserializes the Version, Signature, and Age.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @throws PdbException Upon not enough data left to parse.
+ * Deserializes the Version, Signature, and Age
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @throws PdbException upon not enough data left to parse
*/
protected void deserializeVersionSignatureAge(PdbByteReader reader) throws PdbException {
versionNumber = reader.parseInt();
@@ -617,8 +634,8 @@ public abstract class AbstractPdb implements AutoCloseable {
}
/**
- * Dumps the Version Signature and Age. This package-protected method is for debugging only.
- * @return {@link String} of pretty output.
+ * Dumps the Version Signature and Age. This package-protected method is for debugging only
+ * @return {@link String} of pretty output
*/
protected String dumpVersionSignatureAge() {
StringBuilder builder = new StringBuilder();
@@ -633,26 +650,25 @@ public abstract class AbstractPdb implements AutoCloseable {
}
/**
- * Deserializes the Parameters.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException upon error parsing a string.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the Parameters
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error parsing a string
+ * @throws CancelledException upon user cancellation
*/
- protected void deserializeParameters(PdbByteReader reader, TaskMonitor monitor)
+ protected void deserializeParameters(PdbByteReader reader)
throws IOException, PdbException, CancelledException {
- nameTable.deserializeDirectory(reader, monitor);
+ nameTable.deserializeDirectory(reader);
// Read the parameters.
while (reader.hasMore()) {
- monitor.checkCanceled();
+ getMonitor().checkCanceled();
int val = reader.parseInt();
parameters.add(val);
}
// Check the parameters for IDs
for (int param : parameters) {
- monitor.checkCanceled();
+ getMonitor().checkCanceled();
if (param == MINIMAL_DEBUG_INFO_PARAM) {
minimalDebugInfo = true;
}
@@ -670,8 +686,8 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Dumps the Parameters to a {@link String}. This package-protected method is for
- * debugging only.
- * @return {@link String} of pretty output.
+ * debugging only
+ * @return {@link String} of pretty output
*/
protected String dumpParameters() {
StringBuilder builder = new StringBuilder();
@@ -694,11 +710,11 @@ public abstract class AbstractPdb implements AutoCloseable {
/**
* Dumps the Sub-Streams to a {@link Writer}. This package-protected method is for
- * debugging only.
- * @param writer {@link Writer}.
- * @throws IOException On issue writing to the {@link Writer}.
- * @throws CancelledException Upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * debugging only
+ * @param writer {@link Writer}
+ * @throws IOException on issue writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
+ * @throws PdbException upon not enough data left to parse
*/
public void dumpSubStreams(Writer writer) throws IOException, CancelledException, PdbException {
writer.write("SubStreams--------------------------------------------------\n");
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractSymbolInformation.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractSymbolInformation.java
index 4c442b1328..13d7fbd57e 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractSymbolInformation.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractSymbolInformation.java
@@ -21,7 +21,6 @@ import java.util.*;
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractMsSymbol;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* This class represents Global Symbol Information or Public Symbol Information component of a
@@ -62,16 +61,16 @@ public abstract class AbstractSymbolInformation {
// API
//==============================================================================================
/**
- * Constructor.
- * @param pdbIn {@link AbstractPdb} that owns the Abstract Symbol Information to process.
+ * Constructor
+ * @param pdbIn {@link AbstractPdb} that owns the Abstract Symbol Information to process
*/
public AbstractSymbolInformation(AbstractPdb pdbIn) {
pdb = pdbIn;
}
/**
- * Returns the list of symbols for this {@link AbstractSymbolInformation}.
- * @return the symbols.
+ * Returns the list of symbols for this {@link AbstractSymbolInformation}
+ * @return the symbols
*/
public List getSymbols() {
return symbols;
@@ -79,7 +78,7 @@ public abstract class AbstractSymbolInformation {
/**
* Returns the Offsets of symbols within the symbol table; these are gotten from the
- * HashRecords and modified to point to the size field of the symbols in the symbol table.
+ * HashRecords and modified to point to the size field of the symbols in the symbol table
* @return offsets
*/
public List getModifiedHashRecordSymbolOffsets() {
@@ -90,15 +89,14 @@ public abstract class AbstractSymbolInformation {
// Package-Protected Internals
//==============================================================================================
/**
- * Deserialize the {@link AbstractSymbolInformation} from the appropriate stream in the Pdb.
- * @param streamNumber the stream number containing the information to deserialize.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserialize the {@link AbstractSymbolInformation} from the appropriate stream in the Pdb
+ * @param streamNumber the stream number containing the information to deserialize
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
- void deserialize(int streamNumber, TaskMonitor monitor)
+ void deserialize(int streamNumber)
throws IOException, PdbException, CancelledException {
if (pdb.hasMinimalDebugInfo()) {
hashRecordsBitMapLength = 0x8000;
@@ -113,11 +111,12 @@ public abstract class AbstractSymbolInformation {
}
/**
- * Debug method for dumping information from this {@link AbstractSymbolInformation}.
- * @param writer {@link Writer} to which to dump the information.
- * @throws IOException Upon IOException writing to the {@link Writer}.
+ * Debug method for dumping information from this {@link AbstractSymbolInformation}
+ * @param writer {@link Writer} to which to dump the information
+ * @throws IOException upon IOException writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
- void dump(Writer writer) throws IOException {
+ void dump(Writer writer) throws IOException, CancelledException {
StringBuilder builder = new StringBuilder();
builder.append("AbstractSymbolInformation-----------------------------------\n");
dumpHashHeader(builder);
@@ -128,8 +127,8 @@ public abstract class AbstractSymbolInformation {
}
/**
- * Debug method for dumping basic information from this {@link AbstractSymbolInformation}.
- * @param builder {@link StringBuilder} to which to dump the information.
+ * Debug method for dumping basic information from this {@link AbstractSymbolInformation}
+ * @param builder {@link StringBuilder} to which to dump the information
*/
protected void dumpHashBasics(StringBuilder builder) {
builder.append("HashBasics--------------------------------------------------\n");
@@ -143,8 +142,8 @@ public abstract class AbstractSymbolInformation {
}
/**
- * Debug method for dumping information from this {@link AbstractSymbolInformation} header.
- * @param builder {@link StringBuilder} to which to dump the information.
+ * Debug method for dumping information from this {@link AbstractSymbolInformation} header
+ * @param builder {@link StringBuilder} to which to dump the information
*/
protected void dumpHashHeader(StringBuilder builder) {
builder.append("HashHeader--------------------------------------------------\n");
@@ -160,12 +159,11 @@ public abstract class AbstractSymbolInformation {
}
/**
- * Generates a list of symbols from the information that we have.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon PDB corruption.
- * @throws CancelledException Upon user cancellation.
+ * Generates a list of symbols from the information that we have
+ * @throws PdbException upon PDB corruption
+ * @throws CancelledException upon user cancellation
*/
- protected void generateSymbolsList(TaskMonitor monitor)
+ protected void generateSymbolsList()
throws PdbException, CancelledException {
symbols = new ArrayList<>();
PdbDebugInfo debugInfo = pdb.getDebugInfo();
@@ -174,7 +172,7 @@ public abstract class AbstractSymbolInformation {
}
Map symbolsByOffset = debugInfo.getSymbolsByOffset();
for (SymbolHashRecord record : hashRecords) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
long offset = record.getOffset() - 2; // Modified offset
AbstractMsSymbol symbol = symbolsByOffset.get(offset);
modifiedHashRecordSymbolOffsets.add(offset);
@@ -186,13 +184,15 @@ public abstract class AbstractSymbolInformation {
}
/**
- * Debug method for dumping hash records from this {@link AbstractSymbolInformation}.
- * @param builder {@link StringBuilder} to which to dump the information.
+ * Debug method for dumping hash records from this {@link AbstractSymbolInformation}
+ * @param builder {@link StringBuilder} to which to dump the information
+ * @throws CancelledException upon user cancellation
*/
- protected void dumpHashRecords(StringBuilder builder) {
+ protected void dumpHashRecords(StringBuilder builder) throws CancelledException {
builder.append("HashRecords-------------------------------------------------\n");
builder.append("numHashRecords: " + hashRecords.size() + "\n");
for (SymbolHashRecord record : hashRecords) {
+ pdb.checkCanceled();
builder.append(
String.format("0X%08X 0X%04X\n", record.getOffset(), record.getReferenceCount()));
}
@@ -200,13 +200,12 @@ public abstract class AbstractSymbolInformation {
}
/**
- * Deserializes the hash table for the symbols.
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the hash table for the symbols
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
- protected void deserializeHashTable(PdbByteReader reader, TaskMonitor monitor)
+ protected void deserializeHashTable(PdbByteReader reader)
throws PdbException, CancelledException {
deserializeHashHeader(reader);
@@ -214,7 +213,7 @@ public abstract class AbstractSymbolInformation {
if (headerSignature == HEADER_SIGNATURE) {
switch (versionNumber) {
case GSI70:
- deserializeGsi70HashTable(reader, monitor);
+ deserializeGsi70HashTable(reader);
break;
default:
throw new PdbException("Unknown GSI Version Number");
@@ -222,15 +221,15 @@ public abstract class AbstractSymbolInformation {
}
else {
reader.reset(); // There was no header
- deserializeGsiPre70HashTable(reader, monitor);
+ deserializeGsiPre70HashTable(reader);
}
}
/**
- * Deserialize the header of the Hash from the {@link PdbByteReader} provided.
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @throws PdbException Upon not enough data left to parse.
+ * Deserialize the header of the Hash from the {@link PdbByteReader} provided
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon not enough data left to parse
*/
private void deserializeHashHeader(PdbByteReader reader) throws PdbException {
headerSignature = reader.parseInt();
@@ -241,13 +240,12 @@ public abstract class AbstractSymbolInformation {
/**
* Deserialize the body of the {@link AbstractSymbolInformation} according to the GSI versions
- * prior to 7.00 specification.
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon unexpected fields.
- * @throws CancelledException Upon user cancellation.
+ * prior to 7.00 specification
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon unexpected fields
+ * @throws CancelledException upon user cancellation
*/
- private void deserializeGsiPre70HashTable(PdbByteReader reader, TaskMonitor monitor)
+ private void deserializeGsiPre70HashTable(PdbByteReader reader)
throws PdbException, CancelledException {
int numBucketsBytes = 4 * (numHashRecords + 1);
@@ -264,7 +262,7 @@ public abstract class AbstractSymbolInformation {
hashBucketOffsets = new ArrayList<>();
while (bucketsReader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
hashBucketOffsets.add(bucketsReader.parseInt());
}
@@ -273,18 +271,17 @@ public abstract class AbstractSymbolInformation {
// take the offset and multiple by 2/3 to get the byte offset into the reader for the
// actual record. Still need to deal with the collision logic after that.
- deserializeHashRecords(hashRecordsReader, monitor);
+ deserializeHashRecords(hashRecordsReader);
}
/**
* Deserialize the body of the {@link AbstractSymbolInformation} according to the GSI 7.00
- * specification.
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon unexpected fields.
- * @throws CancelledException Upon user cancellation.
+ * specification
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon unexpected fields
+ * @throws CancelledException upon user cancellation
*/
- private void deserializeGsi70HashTable(PdbByteReader reader, TaskMonitor monitor)
+ private void deserializeGsi70HashTable(PdbByteReader reader)
throws PdbException, CancelledException {
if (reader.numRemaining() != hashRecordsLength + bucketsLength) {
@@ -297,7 +294,7 @@ public abstract class AbstractSymbolInformation {
PdbByteReader hashRecordsReader = reader.getSubPdbByteReader(hashRecordsLength);
PdbByteReader bucketsReader = reader.getSubPdbByteReader(bucketsLength);
- deserializedCompressedHashBuckets(bucketsReader, monitor);
+ deserializedCompressedHashBuckets(bucketsReader);
// int i = 0;
// for (int x : hashBucketOffsets) {
@@ -308,30 +305,29 @@ public abstract class AbstractSymbolInformation {
// take the offset and multiple by 2/3 to get the byte offset into the reader for the
// actual record. Still need to deal with the collision logic after that.
- deserializeHashRecords(hashRecordsReader, monitor);
+ deserializeHashRecords(hashRecordsReader);
}
/**
* Deserializes a compressed set of hash buckets from the {@link PdbByteReader} provided. The
* data comes as a bit-mapped representation of which indices should contain the data followed
- * by a flat set of hash buckets that will be set at those indices in the order provided.
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * by a flat set of hash buckets that will be set at those indices in the order provided
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
- private void deserializedCompressedHashBuckets(PdbByteReader reader, TaskMonitor monitor)
+ private void deserializedCompressedHashBuckets(PdbByteReader reader)
throws PdbException, CancelledException {
PdbByteReader bitEncoderReader = reader.getSubPdbByteReader(hashRecordsBitMapLength);
// Throw away extra bytes between bit map and buckets.
reader.getSubPdbByteReader(numExtraBytes);
while (bitEncoderReader.hasMore() && reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
long val = bitEncoderReader.parseUnsignedIntVal();
//bitEncoded[index++] = val;
for (int bit = 0; bit < 32 && reader.hasMore(); bit++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
if ((val & 0x01L) == 0x01L) {
hashBucketOffsets.add(reader.parseInt());
}
@@ -348,7 +344,7 @@ public abstract class AbstractSymbolInformation {
throw new PdbException("Compressed GSI Hash Buckets corrupt");
}
while (bitEncoderReader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
if (bitEncoderReader.parseUnsignedIntVal() != 0) {
throw new PdbException("Compressed GSI Hash Buckets corrupt");
}
@@ -357,17 +353,16 @@ public abstract class AbstractSymbolInformation {
}
/**
- *
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the hash records
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
- private void deserializeHashRecords(PdbByteReader reader, TaskMonitor monitor)
+ private void deserializeHashRecords(PdbByteReader reader)
throws PdbException, CancelledException {
hashRecords = new TreeSet<>();
while (reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
SymbolHashRecord record = new SymbolHashRecord();
record.parse(reader);
hashRecords.add(record);
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/C11Lines.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/C11Lines.java
index d503ef9cbf..e465e1f182 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/C11Lines.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/C11Lines.java
@@ -19,7 +19,6 @@ import java.util.ArrayList;
import java.util.List;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* C11Lines information. As best as we know, only one of C11Lines or C13Lines can be found after
@@ -48,12 +47,12 @@ public class C11Lines {
private List>> offsets; // unsigned int
private List>> lineNumbers; // unsigned short
- public static C11Lines parse(AbstractPdb pdb, PdbByteReader reader, TaskMonitor monitor)
+ public static C11Lines parse(AbstractPdb pdb, PdbByteReader reader)
throws PdbException, CancelledException {
- return new C11Lines(pdb, reader, monitor);
+ return new C11Lines(pdb, reader);
}
- private C11Lines(AbstractPdb pdb, PdbByteReader reader, TaskMonitor monitor)
+ private C11Lines(AbstractPdb pdb, PdbByteReader reader)
throws PdbException, CancelledException {
if (reader.numRemaining() < 4) {
return;
@@ -64,7 +63,7 @@ public class C11Lines {
startEnd = new ArrayList<>();
seg = new ArrayList<>();
for (int i = 0; i < cFile; i++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
int val = reader.parseInt();
if (val < 0) {
throw new PdbException("beyond our max integer limitation");
@@ -72,13 +71,13 @@ public class C11Lines {
baseSrcFile.add(val);
}
for (int i = 0; i < cSeg; i++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
StartEnd se = new StartEnd();
se.parse(reader);
startEnd.add(se);
}
for (int i = 0; i < cSeg; i++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
seg.add(reader.parseUnsignedShortVal());
}
ccSegs = new ArrayList<>();
@@ -89,14 +88,14 @@ public class C11Lines {
offsets = new ArrayList<>();
lineNumbers = new ArrayList<>();
for (int i = 0; i < cFile; i++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
reader.setIndex(baseSrcFile.get(i));
int ccSeg = reader.parseUnsignedShortVal();
ccSegs.add(ccSeg);
reader.skip(2); // padding
List baseSrcLn = new ArrayList<>();
for (int j = 0; j < ccSeg; j++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
baseSrcLn.add(reader.parseInt());
}
baseSrcLines.add(baseSrcLn);
@@ -113,20 +112,20 @@ public class C11Lines {
List> fileSegOffsets = new ArrayList<>(); // unsigned int
List> fileSegLineNums = new ArrayList<>(); // unsigned short
for (int j = 0; j < ccSeg; j++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
reader.setIndex(baseSrcLn.get(j));
int segNum = reader.parseUnsignedShortVal();
segNums.add(segNum);
int cPair = reader.parseUnsignedShortVal();
List segOffsets = new ArrayList<>(); // unsigned ints
for (int k = 0; k < cPair; k++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
segOffsets.add(reader.parseUnsignedIntVal());
}
fileSegOffsets.add(segOffsets);
List segLineNums = new ArrayList<>(); // unsigned shorts
for (int k = 0; k < cPair; k++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
segLineNums.add(reader.parseUnsignedShortVal());
}
fileSegLineNums.add(segLineNums);
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/C13Section.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/C13Section.java
index cb5f176370..f3173d24db 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/C13Section.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/C13Section.java
@@ -50,8 +50,8 @@ abstract class C13Section {
* @param reader reader to parse from
* @param monitor {@link TaskMonitor} used for checking cancellation
* @return the parsed data
- * @throws PdbException Upon not enough data left to parse
- * @throws CancelledException Upon user cancellation
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
static C13Section parse(PdbByteReader reader, TaskMonitor monitor)
throws CancelledException, PdbException {
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/DebugData.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/DebugData.java
index 5c61ac46ea..deaa4cbcc0 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/DebugData.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/DebugData.java
@@ -20,7 +20,6 @@ import java.io.Writer;
import java.util.*;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* Debug Data structures for PDB files. There are a number of debug streams that can be processed.
@@ -81,8 +80,8 @@ public class DebugData {
// API
//==============================================================================================
/**
- * Constructor.
- * @param pdb {@link AbstractPdb} that owns this {@link DebugData}.
+ * Constructor
+ * @param pdb {@link AbstractPdb} that owns this {@link DebugData}
*/
public DebugData(AbstractPdb pdb) {
Objects.requireNonNull(pdb, "pdb cannot be null");
@@ -91,7 +90,7 @@ public class DebugData {
/**
* Returns the Frame Pointer Omission data
- * @return the framePointerOmissionData or null if does not exist.
+ * @return the framePointerOmissionData or null if does not exist
*/
public List getFramePointerOmissionData() {
return framePointerOmissionData;
@@ -114,8 +113,8 @@ public class DebugData {
}
/**
- * Returns the {@link List}<{@link ImageSectionHeader}>.
- * @return the imageSectionHeaders or null if does not exist.
+ * Returns the {@link List}<{@link ImageSectionHeader}>
+ * @return the imageSectionHeaders or null if does not exist
*/
public List getImageSectionHeaders() {
return imageSectionHeaders;
@@ -123,9 +122,9 @@ public class DebugData {
/**
* Returns the {@link List}<{@link ImageSectionHeader}>.
- * When this return a non-null list the OMAP_FROM_SRC should be
- * used for remapping global symbols.
- * @return the imageSectionHeadersOrig or null if does not exist.
+ * When this returns a non-null list the OMAP_FROM_SRC should be
+ * used for remapping global symbols
+ * @return the imageSectionHeadersOrig or null if does not exist
*/
public List getImageSectionHeadersOrig() {
return imageSectionHeadersOrig;
@@ -138,17 +137,16 @@ public class DebugData {
* Frame Pointer Omission debug data). A stream number of 0XFFFF says that there is no data
* for that debug type; else the stream number represents the stream that should
* be deserialized to retrieve the debug data of that type. The
- * {@link #deserialize(TaskMonitor)} method deserializes each of these streams
- * that are valid to the corresponding debug data type.
- * @param reader {@link PdbByteReader} from which to parse the header.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon error in processing components.
- * @throws CancelledException Upon user cancellation.
+ * {@link #deserialize()} method deserializes each of these streams
+ * that are valid to the corresponding debug data type
+ * @param reader {@link PdbByteReader} from which to parse the header
+ * @throws PdbException upon error in processing components
+ * @throws CancelledException upon user cancellation
*/
- public void deserializeHeader(PdbByteReader reader, TaskMonitor monitor)
+ public void deserializeHeader(PdbByteReader reader)
throws PdbException, CancelledException {
while (reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
int debugStreamNumber = reader.parseUnsignedShortVal();
debugStreams.add(debugStreamNumber);
}
@@ -160,14 +158,13 @@ public class DebugData {
/**
* Deserialize each valid {@link DebugData} stream, based upon valid stream numbers found while
- * parsing the {@link DebugData} header.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException PdbException Upon error in processing components.
- * @throws CancelledException Upon user cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
+ * parsing the {@link DebugData} header
+ * @throws PdbException PdbException upon error in processing components
+ * @throws CancelledException upon user cancellation
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
*/
- public void deserialize(TaskMonitor monitor)
+ public void deserialize()
throws PdbException, CancelledException, IOException {
if (debugStreams.isEmpty()) {
throw new PdbException(
@@ -180,7 +177,7 @@ public class DebugData {
}
switch (dbg) {
case FRAME_POINTER_OMISSION:
- deserializeFramePointerOmissionData(streamNum, monitor);
+ deserializeFramePointerOmissionData(streamNum);
break;
case EXCEPTION:
// TODO: implement.
@@ -189,40 +186,40 @@ public class DebugData {
// TODO: implement.
break;
case OMAP_TO_SOURCE:
- // omapToSource = deserializeOMap(streamNum, monitor);
+ // omapToSource = deserializeOMap(streamNum);
break;
case OMAP_FROM_SOURCE:
- omapFromSource = deserializeOMap(streamNum, monitor);
+ omapFromSource = deserializeOMap(streamNum);
break;
case SECTION_HEADER:
- imageSectionHeaders = deserializeSectionHeaders(streamNum, monitor);
+ imageSectionHeaders = deserializeSectionHeaders(streamNum);
break;
case TOKEN_RID_MAP:
// TODO: implement.
break;
case X_DATA:
- deserializeXData(streamNum, monitor);
+ deserializeXData(streamNum);
break;
case P_DATA:
- deserializePData(streamNum, monitor);
+ deserializePData(streamNum);
break;
case NEW_FRAME_POINTER_OMISSION:
// TODO: implement.
break;
case SECTION_HEADER_ORIG:
- imageSectionHeadersOrig = deserializeSectionHeaders(streamNum, monitor);
+ imageSectionHeadersOrig = deserializeSectionHeaders(streamNum);
break;
}
}
}
- private void deserializeFramePointerOmissionData(int streamNum, TaskMonitor monitor)
+ private void deserializeFramePointerOmissionData(int streamNum)
throws PdbException, CancelledException, IOException {
// TODO: check implementation for completeness.
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum);
framePointerOmissionData = new ArrayList<>();
while (reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
FramePointerOmissionRecord framePointerOmissionRecord =
new FramePointerOmissionRecord();
framePointerOmissionRecord.parse(reader);
@@ -230,12 +227,12 @@ public class DebugData {
}
}
- private SortedMap deserializeOMap(int streamNum, TaskMonitor monitor)
+ private SortedMap deserializeOMap(int streamNum)
throws PdbException, CancelledException, IOException {
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum);
SortedMap omap = new TreeMap<>();
while (reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
long v1 = reader.parseUnsignedIntVal();
long v2 = reader.parseUnsignedIntVal();
omap.put(v1, v2);
@@ -243,12 +240,12 @@ public class DebugData {
return omap;
}
- private List deserializeSectionHeaders(int streamNum, TaskMonitor monitor)
+ private List deserializeSectionHeaders(int streamNum)
throws PdbException, CancelledException, IOException {
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum);
List sectionHeaders = new ArrayList<>();
while (reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
ImageSectionHeader imageSectionHeader = new ImageSectionHeader(pdb);
imageSectionHeader.parse(reader);
sectionHeaders.add(imageSectionHeader);
@@ -259,11 +256,11 @@ public class DebugData {
// TODO: This is incomplete.
/**
* See the {@link LinkerUnwindInfo} class that was built for and is pertinent to
- * processing XData.
+ * processing XData
*/
- private void deserializeXData(int streamNum, TaskMonitor monitor)
+ private void deserializeXData(int streamNum)
throws PdbException, CancelledException, IOException {
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum);
int streamLength = reader.getLimit();
//System.out.println(reader.dump(0x20));
RvaVaDebugHeader header = new RvaVaDebugHeader();
@@ -289,9 +286,9 @@ public class DebugData {
}
// TODO: This is incomplete.
- private void deserializePData(int streamNum, TaskMonitor monitor)
+ private void deserializePData(int streamNum)
throws PdbException, CancelledException, IOException {
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum);
pData = new ArrayList<>();
int streamLength = reader.getLimit();
RvaVaDebugHeader header = new RvaVaDebugHeader();
@@ -310,7 +307,7 @@ public class DebugData {
// TODO: current partial implementation does not work (throws exception)
// for ucrtbase.dll arm64. Need to look at this closer.
// while (reader.hasMore()) {
-// monitor.checkCanceled();
+// pdb.checkCanceled();
// ImageFunctionEntry entry = new ImageFunctionEntry();
// entry.deserialize(reader);
// pData.add(entry);
@@ -340,17 +337,19 @@ public class DebugData {
}
/**
- * Dumps the {@link DebugData}. This package-protected method is for debugging only.
- * @param writer {@link Writer} to which to write the debug dump.
- * @throws IOException On issue writing to the {@link Writer}.
+ * Dumps the {@link DebugData}. This package-protected method is for debugging only
+ * @param writer {@link Writer} to which to write the debug dump
+ * @throws IOException on issue writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
- void dump(Writer writer) throws IOException {
+ void dump(Writer writer) throws IOException, CancelledException {
writer.write("DebugData---------------------------------------------------\n");
dumpDebugStreamList(writer);
writer.write("FramePointerOmissionData------------------------------------\n");
if (framePointerOmissionData != null) {
for (FramePointerOmissionRecord framePointerOmissionRecord : framePointerOmissionData) {
+ pdb.checkCanceled();
framePointerOmissionRecord.dump(writer);
}
}
@@ -360,16 +359,18 @@ public class DebugData {
// if (omapToSource != null) {
// int num = 0;
// for (Map.Entry entry : omapToSource.entrySet()) {
+// pdb.checkCanceled();
// writer.write(String.format("0X%08X: 0X%012X, 0X%012X\n", num++, entry.getKey(),
// entry.getValue()));
// }
// }
// writer.write("End OmapToSource--------------------------------------------\n");
-
+//
writer.write("OmapFromSource----------------------------------------------\n");
if (omapFromSource != null) {
int num = 0;
for (Map.Entry entry : omapFromSource.entrySet()) {
+ pdb.checkCanceled();
writer.write(String.format("0X%08X: 0X%012X, 0X%012X\n", num++, entry.getKey(),
entry.getValue()));
}
@@ -380,6 +381,7 @@ public class DebugData {
if (imageSectionHeaders != null) {
int sectionNum = 0;
for (ImageSectionHeader imageSectionHeader : imageSectionHeaders) {
+ pdb.checkCanceled();
imageSectionHeader.dump(writer, sectionNum++);
}
}
@@ -389,6 +391,7 @@ public class DebugData {
if (imageSectionHeadersOrig != null) {
int sectionNum = 0;
for (ImageSectionHeader imageSectionHeader : imageSectionHeadersOrig) {
+ pdb.checkCanceled();
imageSectionHeader.dump(writer, sectionNum++);
}
}
@@ -397,6 +400,7 @@ public class DebugData {
writer.write("PData-------------------------------------------------------\n");
if (pData != null) {
for (ImageFunctionEntry entry : pData) {
+ pdb.checkCanceled();
// TODO: need to output more if/when more PData is available (e.g., interpretation
// of XData.
writer.append(entry.toString());
@@ -408,14 +412,16 @@ public class DebugData {
}
/**
- * Dumps the DebugStreamList. This package-protected method is for debugging only.
- * @param writer {@link Writer} to which to write the debug dump.
- * @throws IOException On issue writing to the {@link Writer}.
+ * Dumps the DebugStreamList. This package-protected method is for debugging only
+ * @param writer {@link Writer} to which to write the debug dump
+ * @throws IOException on issue writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
- private void dumpDebugStreamList(Writer writer) throws IOException {
+ private void dumpDebugStreamList(Writer writer) throws IOException, CancelledException {
writer.write("StreamList--------------------------------------------------\n");
int i = 0;
for (int strmNumber : debugStreams) {
+ pdb.checkCanceled();
writer.write(String.format("StrmNumber[%02d]: %04x\n", i++, strmNumber));
}
writer.write("End StreamList----------------------------------------------\n");
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/EmptyTPI.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/EmptyTPI.java
index 50747c127c..037eea4ee7 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/EmptyTPI.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/EmptyTPI.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pdb2.pdbreader;
import java.io.IOException;
import java.io.Writer;
-public class EmptyTPI extends AbstractTypeProgramInterface {
+public class EmptyTPI extends TypeProgramInterface {
EmptyTPI(AbstractPdb pdb) {
super(pdb, RecordCategory.TYPE, -1);
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalReferenceIterator.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalReferenceIterator.java
index 58efe8f281..3dac26f484 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalReferenceIterator.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalReferenceIterator.java
@@ -22,7 +22,6 @@ import ghidra.app.util.bin.format.pdb2.pdbreader.msf.MsfStream;
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractMsSymbol;
import ghidra.util.Msg;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* Iterator for Global Reference Offsets section of module stream. This iterator returns
@@ -34,25 +33,21 @@ class GlobalReferenceIterator implements ParsingIterator {
private AbstractPdb pdb;
private int symbolsStreamNumber;
- private TaskMonitor monitor;
-
private GlobalReferenceOffsetIterator offsetIterator = null;
private MsSymbolIterator currentGlobalSymbolIterator = null;
/**
- * An Iterator of Global Reference Symbol Iterators (iterator of iterators).
+ * An Iterator of Global Reference Symbol Iterators (iterator of iterators)
* @param pdb {@link AbstractPdb} that owns the Symbols to be parsed
* @param reader PdbByteReader containing only Global Reference Offsets information and in
* newly constructed state
- * @param monitor {@link TaskMonitor} used for checking user cancellation
* @throws CancelledException upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * @throws PdbException upon not enough data left to parse
*/
- public GlobalReferenceIterator(AbstractPdb pdb, PdbByteReader reader, TaskMonitor monitor)
+ public GlobalReferenceIterator(AbstractPdb pdb, PdbByteReader reader)
throws CancelledException, PdbException {
this.pdb = pdb;
- this.monitor = monitor;
PdbDebugInfo debugInfo = pdb.getDebugInfo();
if (debugInfo == null) {
throw new PdbException(
@@ -102,7 +97,7 @@ class GlobalReferenceIterator implements ParsingIterator {
Long offset = offsetIterator.next();
PdbByteReader reader =
pdb.getReaderForStreamNumber(symbolsStreamNumber, offset.intValue(),
- MsfStream.MAX_STREAM_LENGTH, monitor);
+ MsfStream.MAX_STREAM_LENGTH);
currentGlobalSymbolIterator = new MsSymbolIterator(pdb, reader);
}
catch (IOException e) {
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalReferenceOffsetIterator.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalReferenceOffsetIterator.java
index 81c35b9895..cf216b7069 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalReferenceOffsetIterator.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalReferenceOffsetIterator.java
@@ -34,7 +34,7 @@ class GlobalReferenceOffsetIterator implements ParsingIterator {
* @param reader PdbByteReader containing only Global Reference Offsets information and in
* newly constructed state
* @throws CancelledException upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * @throws PdbException upon not enough data left to parse
*/
public GlobalReferenceOffsetIterator(PdbByteReader reader)
throws CancelledException, PdbException {
@@ -80,7 +80,7 @@ class GlobalReferenceOffsetIterator implements ParsingIterator {
/**
* Reads and validates size field; leaves reader pointing at first record.
- * @throws PdbException Upon not enough data left to parse
+ * @throws PdbException upon not enough data left to parse
*/
private void processHeader() throws PdbException {
int sizeField = reader.parseInt();
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalSymbolInformation.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalSymbolInformation.java
index 89e4cbaaf4..1b198078f9 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalSymbolInformation.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/GlobalSymbolInformation.java
@@ -19,7 +19,6 @@ import java.io.IOException;
import java.io.Writer;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* This class represents Global Symbol Information component of a PDB file. This class is only
@@ -41,32 +40,32 @@ public class GlobalSymbolInformation extends AbstractSymbolInformation {
}
/**
- * Deserialize the {@link GlobalSymbolInformation} from the appropriate stream in the Pdb.
- * @param streamNumber the stream number containing the information to deserialize.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserialize the {@link GlobalSymbolInformation} from the appropriate stream in the Pdb
+ * @param streamNumber the stream number containing the information to deserialize
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
@Override
- void deserialize(int streamNumber, TaskMonitor monitor)
+ void deserialize(int streamNumber)
throws IOException, PdbException, CancelledException {
- super.deserialize(streamNumber, monitor);
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber, monitor);
- deserializeHashTable(reader, monitor);
+ super.deserialize(streamNumber);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber);
+ deserializeHashTable(reader);
// Organize the information
- generateSymbolsList(monitor);
+ generateSymbolsList();
}
/**
- * Debug method for dumping information from this {@link GlobalSymbolInformation}.
- * @param writer {@link Writer} to which to dump the information.
- * @throws IOException Upon IOException writing to the {@link Writer}.
+ * Debug method for dumping information from this {@link GlobalSymbolInformation}
+ * @param writer {@link Writer} to which to dump the information
+ * @throws IOException upon IOException writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
@Override
- void dump(Writer writer) throws IOException {
+ void dump(Writer writer) throws IOException, CancelledException {
StringBuilder builder = new StringBuilder();
builder.append("GlobalSymbolInformation-------------------------------------\n");
dumpHashHeader(builder);
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ItemProgramInterfaceParser.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ItemProgramInterfaceParser.java
index f382e840a4..828d8930b0 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ItemProgramInterfaceParser.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ItemProgramInterfaceParser.java
@@ -19,7 +19,7 @@ import org.apache.commons.lang3.StringUtils;
/**
* Parser, extending {@link TypeProgramInterfaceParser}, for detecting and returning the
- * appropriate {@link AbstractTypeProgramInterface} format to be used as the Item Program
+ * appropriate {@link TypeProgramInterface} format to be used as the Item Program
* Interface for the filename given.
*/
public class ItemProgramInterfaceParser extends TypeProgramInterfaceParser {
@@ -27,8 +27,8 @@ public class ItemProgramInterfaceParser extends TypeProgramInterfaceParser {
private static final int ITEM_PROGRAM_INTERFACE_STREAM_NUMBER = 4;
/**
- * Returns the standard stream number that contains the serialized Item Program Interface.
- * @return The standard stream number that contains the Item Program Interface.
+ * Returns the standard stream number that contains the serialized Item Program Interface
+ * @return the standard stream number that contains the Item Program Interface
*/
@Override
protected int getStreamNumber() {
@@ -38,8 +38,8 @@ public class ItemProgramInterfaceParser extends TypeProgramInterfaceParser {
/**
* Returns the appropriate {@link RecordCategory} needed while processing
- * the Type Program Interface} (vs. Item Program Interface).
- * @return {@link RecordCategory#ITEM}.
+ * the Type Program Interface} (vs. Item Program Interface)
+ * @return {@link RecordCategory#ITEM}
*/
@Override
protected RecordCategory getCategory() {
@@ -48,10 +48,10 @@ public class ItemProgramInterfaceParser extends TypeProgramInterfaceParser {
}
/**
- * Returns true if there is not a name in the name table assigned to the stream number for
- * the IPI.
- * @param nameTable the nametable that contains the stream/name map
- * @return {@code true} if no name associated with the IPI stream number.
+ * Returns {@code true} if there is not a name in the name table assigned to the stream number
+ * for the IPI
+ * @param nameTable the name table that contains the stream/name map
+ * @return {@code true} if no name associated with the IPI stream number
*/
public static boolean hackCheckNoNameForStream(NameTable nameTable) {
String name = nameTable.getNameFromStreamNumber(ITEM_PROGRAM_INTERFACE_STREAM_NUMBER);
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Module.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Module.java
index 5886f1e50b..31178b221f 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Module.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Module.java
@@ -22,16 +22,15 @@ import java.util.*;
import ghidra.app.util.bin.format.pdb2.pdbreader.msf.MsfStream;
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractMsSymbol;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* Note that this class is new, in-progress creation, being designed as a better interface for
* getting information for any particular module (stream) in a more random-access manner.
*
* This class represents Module Stream data of a PDB file. This is different from the
- * {@link AbstractModuleInformation} and children classes that are parsed from the DBI stream,
+ * {@link ModuleInformation} and children classes that are parsed from the DBI stream,
* which describes (or is control information for) what is the stream from which this
- * {@link Module} is parsed. Note that we use the {@link AbstractModuleInformation} as one of
+ * {@link Module} is parsed. Note that we use the {@link ModuleInformation} as one of
* the construction parameter to this class.
*
* This class is only suitable for reading; not for writing or modifying a PDB.
@@ -42,8 +41,7 @@ import ghidra.util.task.TaskMonitor;
public class Module {
private AbstractPdb pdb;
- private AbstractModuleInformation moduleInformation;
- private TaskMonitor monitor;
+ private ModuleInformation moduleInformation;
private int streamNumber;
private MsfStream stream = null;
@@ -61,17 +59,15 @@ public class Module {
private boolean doDumpGlobalRefererenceInfo = false;
//==============================================================================================
- public Module(AbstractPdb pdb, AbstractModuleInformation moduleInformation,
- TaskMonitor monitor) {
+ public Module(AbstractPdb pdb, ModuleInformation moduleInformation) {
Objects.requireNonNull(pdb, "pdb cannot be null");
Objects.requireNonNull(moduleInformation, "moduleInformation cannot be null");
this.pdb = pdb;
this.moduleInformation = moduleInformation;
- this.monitor = monitor;
precalculateStreamLocations();
}
- public AbstractModuleInformation getModuleInformation() {
+ public ModuleInformation getModuleInformation() {
return moduleInformation;
}
@@ -115,10 +111,9 @@ public class Module {
}
try {
PdbByteReader reader =
- pdb.getReaderForStreamNumber(streamNumber, offsetLines, sizeLines,
- monitor);
+ pdb.getReaderForStreamNumber(streamNumber, offsetLines, sizeLines);
// This parser has not been tested with real data
- C11Lines c11Lines = C11Lines.parse(pdb, reader, monitor);
+ C11Lines c11Lines = C11Lines.parse(pdb, reader);
return c11Lines;
}
catch (IOException e) {
@@ -193,7 +188,7 @@ public class Module {
* Returns a C13SectionIterator that iterators over all C13Sections of this module
* @return the iterator
* @throws CancelledException upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * @throws PdbException upon not enough data left to parse
*/
public C13SectionIterator getC13SectionIterator()
throws CancelledException, PdbException {
@@ -206,13 +201,13 @@ public class Module {
* @param clazz The class of the filter type
* @return the iterator
* @throws CancelledException upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * @throws PdbException upon not enough data left to parse
*/
public C13SectionIterator getC13SectionFilteredIterator(
Class clazz) throws CancelledException, PdbException {
PdbByteReader c13SectionReader = getC13LinesReader();
C13SectionIterator iterator =
- new C13SectionIterator<>(c13SectionReader, clazz, true, monitor);
+ new C13SectionIterator<>(c13SectionReader, clazz, true, pdb.getMonitor());
return iterator;
}
@@ -225,7 +220,7 @@ public class Module {
* nested blocks until the closing END is found for the GPROC32
* @return the iterator
* @throws CancelledException upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * @throws PdbException upon not enough data left to parse
*/
public GlobalReferenceOffsetIterator getGlobalReferenceOffsetIterator()
throws CancelledException, PdbException {
@@ -245,13 +240,13 @@ public class Module {
* nested blocks until the closing END is found for the GPROC32
* @return the iterator
* @throws CancelledException upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * @throws PdbException upon not enough data left to parse
*/
public GlobalReferenceIterator getGlobalReferenceIterator()
throws CancelledException, PdbException {
PdbByteReader globalRefsReader = getGlobalRefsReader();
GlobalReferenceIterator iterator =
- new GlobalReferenceIterator(pdb, globalRefsReader, monitor);
+ new GlobalReferenceIterator(pdb, globalRefsReader);
return iterator;
}
@@ -282,7 +277,7 @@ public class Module {
}
try {
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber);
reader.skip(offset);
try {
if (size == -1) {
@@ -312,11 +307,11 @@ public class Module {
// is loaded into the class (note that as of this writing, the PdbByteReader still contains
// full byte array of data, consuming memory at the time of use).
/**
- * Dumps this class to a Writer.
+ * Dumps this class to a Writer
* @param writer {@link Writer} to which to dump the information
- * @throws PdbException Upon not enough data left to parse
- * @throws CancelledException Upon user cancellation
- * @throws IOException Upon IOException writing to the {@link Writer}
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
+ * @throws IOException upon IOException writing to the {@link Writer}
*/
void dump(Writer writer)
throws CancelledException, PdbException, IOException {
@@ -341,6 +336,7 @@ public class Module {
writer.write("Symbols-----------------------------------------------------\n");
MsSymbolIterator symbolIterator = getSymbolIterator();
while (symbolIterator.hasNext()) {
+ pdb.checkCanceled();
AbstractMsSymbol symbol = symbolIterator.next();
writer.append(symbol.toString());
}
@@ -365,6 +361,7 @@ public class Module {
C13SectionIterator c13Iterator =
getC13SectionFilteredIterator(C13Section.class);
while (c13Iterator.hasNext()) {
+ pdb.checkCanceled();
C13Section c13Section = c13Iterator.next();
c13Section.dump(writer);
}
@@ -375,6 +372,7 @@ public class Module {
// C13SectionIterator c13SymbolsIterator =
// getC13SectionFilteredIterator(DummyC13Symbols.class);
// while (c13SymbolsIterator.hasNext()) {
+// pdb.checkCanceled();
// DummyC13Symbols dummyC13Symbols = c13SymbolsIterator.next();
// dummyC13Symbols.dump(writer);
// }
@@ -382,6 +380,7 @@ public class Module {
// C13SectionIterator c13LinesIterator =
// getC13SectionFilteredIterator(C13Lines.class);
// while (c13LinesIterator.hasNext()) {
+// pdb.checkCanceled();
// C13Lines myC13Lines = c13LinesIterator.next();
// myC13Lines.dump(writer);
// }
@@ -395,6 +394,7 @@ public class Module {
GlobalReferenceOffsetIterator globalRefsOffsetIterator =
getGlobalReferenceOffsetIterator();
while (globalRefsOffsetIterator.hasNext()) {
+ pdb.checkCanceled();
Long val = globalRefsOffsetIterator.next();
writer.append(String.format("0x%08x\n", val));
tmp.add(val);
@@ -420,6 +420,7 @@ public class Module {
GlobalReferenceIterator globalReferenceIterator =
getGlobalReferenceIterator();
while (globalReferenceIterator.hasNext()) {
+ pdb.checkCanceled();
MsSymbolIterator symIter = globalReferenceIterator.next();
if (symIter.hasNext()) {
AbstractMsSymbol sym = symIter.next();
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/ModuleInformation.java
similarity index 84%
rename from Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractModuleInformation.java
rename to Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation.java
index 22a4061fee..06042fe93e 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/ModuleInformation.java
@@ -24,13 +24,13 @@ import java.util.*;
* We have intended to implement according to the Microsoft PDB API (source); see the API for
* truth.
*/
-public abstract class AbstractModuleInformation {
+public abstract class ModuleInformation {
//==============================================================================================
// Internals
//==============================================================================================
protected long modulePointer;
- protected AbstractSectionContribution sectionContribution;
+ protected SectionContribution sectionContribution;
protected boolean writtenSinceOpen;
// TODO: consider what to do (gets parsed for 600 between 500 items. Want only in 600,
// but would have to break up the deserialize and dumpInternal methods. Issue might be,
@@ -61,46 +61,46 @@ public abstract class AbstractModuleInformation {
//==============================================================================================
// API
//==============================================================================================
- public AbstractModuleInformation(AbstractPdb pdb) {
+ public ModuleInformation(AbstractPdb pdb) {
Objects.requireNonNull(pdb, "pdb cannot be null");
this.pdb = pdb;
}
/**
- * Returns the number of files contributing to the module.
- * @return Number of files.
+ * Returns the number of files contributing to the module
+ * @return number of files
*/
public int getNumFilesContributing() {
return numFilesContributing;
}
/**
- * Returns list of offsets for the module.
- * @return Offsets.
+ * Returns list of offsets for the module
+ * @return offsets
*/
public List getOffsetsArray() {
return offsetsArray;
}
/**
- * Returns list of file names for the module.
- * @return File names.
+ * Returns list of file names for the module
+ * @return file names
*/
public List getFilenamesArray() {
return filenamesArray;
}
/**
- * Returns the stream number containing debug information.
- * @return Stream number.
+ * Returns the stream number containing debug information
+ * @return stream number
*/
public int getStreamNumberDebugInformation() {
return streamNumberDebugInformation;
}
/**
- * Returns the size of the local symbols debug information.
- * @return Size of the local symbols debug information.
+ * Returns the size of the local symbols debug information
+ * @return size of the local symbols debug information
*/
public int getSizeLocalSymbolsDebugInformation() {
return sizeLocalSymbolsDebugInformation;
@@ -108,7 +108,7 @@ public abstract class AbstractModuleInformation {
/**
* Returns the size of the older-style line number information
- * @return Size of the older-style line number information
+ * @return size of the older-style line number information
*/
public int getSizeLineNumberDebugInformation() {
return sizeLineNumberDebugInformation;
@@ -116,25 +116,25 @@ public abstract class AbstractModuleInformation {
/**
* Returns the size of the C13-style line number information
- * @return Size of the C13-style line number information
+ * @return size of the C13-style line number information
*/
public int getSizeC13StyleLineNumberInformation() {
return sizeC13StyleLineNumberInformation;
}
/**
- * Returns the name of the module.
- * @return Name of the module.
+ * Returns the name of the module
+ * @return name of the module
*/
public String getModuleName() {
return moduleName;
}
/**
- * Returns {@link AbstractSectionContribution} of the module.
- * @return {@link AbstractSectionContribution} of the module.
+ * Returns {@link SectionContribution} of the module
+ * @return {@link SectionContribution} of the module
*/
- public AbstractSectionContribution getSectionContribution() {
+ public SectionContribution getSectionContribution() {
return sectionContribution;
}
@@ -151,9 +151,9 @@ public abstract class AbstractModuleInformation {
// Internal Data Methods
//==============================================================================================
/**
- * Deserializes the module.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @throws PdbException upon error parsing a string name.
+ * Deserializes the module
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @throws PdbException upon error parsing a string name
*/
protected void deserialize(PdbByteReader reader) throws PdbException {
modulePointer = reader.parseUnsignedIntVal();
@@ -186,15 +186,15 @@ public abstract class AbstractModuleInformation {
//==============================================================================================
/**
* Deserializes the Additionals. Abstract method filled in by instances to parse additional
- * data pertinent to themselves.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @throws PdbException upon error parsing a string name.
+ * data pertinent to themselves
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @throws PdbException upon error parsing a string name
*/
protected abstract void parseAdditionals(PdbByteReader reader) throws PdbException;
/**
- * Dumps the Additionals. This method is for debugging only.
- * @return {@link String} of pretty output.
+ * Dumps the Additionals. This method is for debugging only
+ * @return {@link String} of pretty output
*/
protected abstract String dumpAdditionals();
@@ -211,8 +211,8 @@ public abstract class AbstractModuleInformation {
}
/**
- * Dumps this module. This method is for debugging only.
- * @return {@link String} of pretty output.
+ * Dumps this module. This method is for debugging only
+ * @return {@link String} of pretty output
*/
String dump() {
StringBuilder builder = new StringBuilder();
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation500.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation500.java
index 1db3e1bdfd..206bde5824 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation500.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation500.java
@@ -16,9 +16,9 @@
package ghidra.app.util.bin.format.pdb2.pdbreader;
/**
- * This class is the version of {@link AbstractModuleInformation} for Microsoft v5.00 PDB.
+ * This class is the version of {@link ModuleInformation} for Microsoft v5.00 PDB.
*/
-public class ModuleInformation500 extends AbstractModuleInformation {
+public class ModuleInformation500 extends ModuleInformation {
//==============================================================================================
// API
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation600.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation600.java
index 1214278b9d..973f88dab8 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation600.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/ModuleInformation600.java
@@ -16,9 +16,9 @@
package ghidra.app.util.bin.format.pdb2.pdbreader;
/**
- * This class is the version of {@link AbstractModuleInformation} for Microsoft v6.00 PDB.
+ * This class is the version of {@link ModuleInformation} for Microsoft v6.00 PDB.
*/
-public class ModuleInformation600 extends AbstractModuleInformation {
+public class ModuleInformation600 extends ModuleInformation {
//==============================================================================================
// API
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/NameTable.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/NameTable.java
index 2086ee63ab..8591403ddd 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/NameTable.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/NameTable.java
@@ -19,7 +19,6 @@ import java.io.IOException;
import java.util.*;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* This class represents Name Table component of a PDB file. This class is only
@@ -54,8 +53,8 @@ public class NameTable {
// API
//==============================================================================================
/**
- * Constructor.
- * @param pdb {@link AbstractPdb} that owns this Name Table.
+ * Constructor
+ * @param pdb {@link AbstractPdb} that owns this Name Table
*/
public NameTable(AbstractPdb pdb) {
Objects.requireNonNull(pdb, "pdb cannot be null");
@@ -63,18 +62,18 @@ public class NameTable {
}
/**
- * Returns a name from the Name Table pertaining to the index argument.
- * @param index Index of the name to retrieve.
- * @return Name retrieved for the index.
+ * Returns a name from the Name Table pertaining to the index argument
+ * @param index index of the name to retrieve
+ * @return name retrieved for the index
*/
public String getNameFromStreamNumber(int index) {
return namesByStreamNumber.get(index);
}
/**
- * Returns an index of the name argument in the {@link NameTable}.
- * @param name Name to look up.
- * @return Index of the name.
+ * Returns an index of the name argument in the {@link NameTable}
+ * @param name name to look up
+ * @return index of the name
*/
public int getStreamNumberFromName(String name) {
Integer x = streamNumbersByName.getOrDefault(name, -1);
@@ -83,9 +82,9 @@ public class NameTable {
/**
* Returns a name from the Name Table pertaining to the byte-offset in the block of names for
- * the table.
- * @param offset Byte-offset of the name in the {@link NameTable} block.
- * @return Name found at offset.
+ * the table
+ * @param offset byte-offset of the name in the {@link NameTable} block
+ * @return name found at offset
*/
public String getNameStringFromOffset(int offset) {
if (namesByOffset == null) {
@@ -96,9 +95,9 @@ public class NameTable {
/**
* IMPORTANT: This method is for testing only. It allows us to set a basic object.
- * Note: not all values are initialized. Add a paired offset and {@link String} name.
- * @param offset Offset part of pair.
- * @param name Name part of pair.
+ * Note: not all values are initialized. Add a paired offset and {@link String} name
+ * @param offset offset part of pair
+ * @param name name part of pair
*/
public void forTestingOnlyAddOffsetNamePair(int offset, String name) {
if (namesByOffset == null) {
@@ -113,21 +112,20 @@ public class NameTable {
//==============================================================================================
// TODO: Regarding String conversions... We expect that US_ASCII could be a problem, but it
// is probably better than creating the String without any code set chosen at all. Do we
- // need to change all processing of Strings within the PDB so that we are only creating byte
+ // need to change all processing of Strings within the PDB so that we are only creating byte
// arrays with some notional idea (1 byte, 2 byte, possibly utf-8, utf-16, wchar_t, or
// "unknown" and defer true interpretation/conversion to String until we know or until
// Ghidra user can ad-hoc apply interpretations to those fields? Needs investigation, but
// not critical at this time.
/**
- * Deserializes the Directory.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException upon error parsing a string.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the Directory
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error parsing a string
+ * @throws CancelledException upon user cancellation
*/
- void deserializeDirectory(PdbByteReader reader, TaskMonitor monitor)
+ void deserializeDirectory(PdbByteReader reader)
throws IOException, PdbException, CancelledException {
// Get the buffer of strings
@@ -152,10 +150,10 @@ public class NameTable {
streamNumbers = new int[numPairs];
// Read Present Set. Not really needed by us, as we use the java HashMap.
- presentList.parse(reader, monitor);
+ presentList.parse(reader, pdb.getMonitor());
// Read Deleted Set. Not really needed by us, as we use the java HashMap.
- deletedList.parse(reader, monitor);
+ deletedList.parse(reader, pdb.getMonitor());
// Read values of index into buffer and name index. Load the HashMaps.
// Since we are using the java HashMap, we do not need to mimic the
@@ -163,7 +161,7 @@ public class NameTable {
// of domainSize) and do not need to store the domain and range items
// in a list indexed by i.
for (int i = 0; i < numPairs; i++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
int bufOffset = reader.parseInt();
int streamNumber = reader.parseInt();
nameBufferReader.setIndex(bufOffset);
@@ -174,7 +172,7 @@ public class NameTable {
namesByStreamNumber.put(streamNumber, name);
streamNumbersByName.put(name, streamNumber);
}
- deserializeNameTableStreams(monitor);
+ deserializeNameTableStreams();
}
// TODO: Reduce code complexity once we know the details for the various cases. Probably
@@ -182,19 +180,18 @@ public class NameTable {
// find here.
/**
* Deserializes Name Table Streams. An offset-to-string map is created for each stream; each
- * map is placed into a stream-number-to-map map.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException upon error parsing a string.
- * @throws CancelledException Upon user cancellation.
+ * map is placed into a stream-number-to-map map
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error parsing a string
+ * @throws CancelledException upon user cancellation
*/
- void deserializeNameTableStreams(TaskMonitor monitor)
+ void deserializeNameTableStreams()
throws IOException, PdbException, CancelledException {
for (int streamNumber : streamNumbers) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
Map stringsByOffset = new HashMap<>();
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber);
if (reader.getLimit() >= 12) {
long hdrMagic = reader.parseUnsignedIntVal();
int hdrVer = reader.parseInt();
@@ -205,7 +202,7 @@ public class NameTable {
int length = reader.parseInt();
PdbByteReader stringReader = reader.getSubPdbByteReader(length);
while (stringReader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
int offset = stringReader.getIndex();
String string = stringReader.parseNullTerminatedUtf8String();
stringsByOffset.put(offset, string);
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb200.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb200.java
index 8c2b1e9559..597e84ab90 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb200.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb200.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pdb2.pdbreader;
import java.io.IOException;
import java.io.Writer;
-import ghidra.app.util.bin.format.pdb2.pdbreader.msf.AbstractMsf;
+import ghidra.app.util.bin.format.pdb2.pdbreader.msf.Msf;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -31,20 +31,20 @@ public class Pdb200 extends AbstractPdb {
// Package-Protected Internals
//==============================================================================================
/**
- * Constructor.
- * @param msf {@link AbstractMsf} foundation for the PDB.
- * @param pdbOptions {@link PdbReaderOptions} used for processing the PDB.
- * @throws IOException Upon file IO seek/read issues.
- * @throws PdbException Upon unknown value for configuration or error in processing components.
+ * Constructor
+ * @param msf {@link Msf} foundation for the PDB
+ * @param pdbOptions {@link PdbReaderOptions} used for processing the PDB
+ * @throws IOException upon file IO seek/read issues
+ * @throws PdbException upon unknown value for configuration or error in processing components
*/
- Pdb200(AbstractMsf msf, PdbReaderOptions pdbOptions) throws IOException, PdbException {
+ Pdb200(Msf msf, PdbReaderOptions pdbOptions) throws IOException, PdbException {
super(msf, pdbOptions);
}
@Override
void deserializeIdentifiersOnly(TaskMonitor monitor)
throws IOException, PdbException, CancelledException {
- PdbByteReader reader = getDirectoryReader(monitor);
+ PdbByteReader reader = getDirectoryReader();
deserializeVersionSignatureAge(reader);
}
@@ -52,9 +52,9 @@ public class Pdb200 extends AbstractPdb {
// Abstract Methods
//==============================================================================================
@Override
- void deserializeDirectory(TaskMonitor monitor)
+ void deserializeDirectory()
throws IOException, PdbException, CancelledException {
- PdbByteReader reader = getDirectoryReader(monitor);
+ PdbByteReader reader = getDirectoryReader();
deserializeVersionSignatureAge(reader);
}
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb400.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb400.java
index c5f10a50a5..b975d608bf 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb400.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb400.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pdb2.pdbreader;
import java.io.IOException;
import java.io.Writer;
-import ghidra.app.util.bin.format.pdb2.pdbreader.msf.AbstractMsf;
+import ghidra.app.util.bin.format.pdb2.pdbreader.msf.Msf;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -31,20 +31,20 @@ public class Pdb400 extends AbstractPdb {
// Package-Protected Internals
//==============================================================================================
/**
- * Constructor.
- * @param msf {@link AbstractMsf} foundation for the PDB.
- * @param pdbOptions {@link PdbReaderOptions} used for processing the PDB.
- * @throws IOException Upon file IO seek/read issues.
- * @throws PdbException Upon unknown value for configuration or error in processing components.
+ * Constructor
+ * @param msf {@link Msf} foundation for the PDB
+ * @param pdbOptions {@link PdbReaderOptions} used for processing the PDB
+ * @throws IOException upon file IO seek/read issues
+ * @throws PdbException upon unknown value for configuration or error in processing components
*/
- Pdb400(AbstractMsf msf, PdbReaderOptions pdbOptions) throws IOException, PdbException {
+ Pdb400(Msf msf, PdbReaderOptions pdbOptions) throws IOException, PdbException {
super(msf, pdbOptions);
}
@Override
void deserializeIdentifiersOnly(TaskMonitor monitor)
throws IOException, PdbException, CancelledException {
- PdbByteReader reader = getDirectoryReader(monitor);
+ PdbByteReader reader = getDirectoryReader();
deserializeVersionSignatureAge(reader);
}
@@ -52,11 +52,11 @@ public class Pdb400 extends AbstractPdb {
// Abstract Methods
//==============================================================================================
@Override
- void deserializeDirectory(TaskMonitor monitor)
+ void deserializeDirectory()
throws IOException, PdbException, CancelledException {
- PdbByteReader reader = getDirectoryReader(monitor);
+ PdbByteReader reader = getDirectoryReader();
deserializeVersionSignatureAge(reader);
- deserializeParameters(reader, monitor);
+ deserializeParameters(reader);
}
@Override
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb700.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb700.java
index 18aecc4678..fb48800497 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb700.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/Pdb700.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pdb2.pdbreader;
import java.io.IOException;
import java.io.Writer;
-import ghidra.app.util.bin.format.pdb2.pdbreader.msf.AbstractMsf;
+import ghidra.app.util.bin.format.pdb2.pdbreader.msf.Msf;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -31,20 +31,20 @@ public class Pdb700 extends AbstractPdb {
// Package-Protected Internals
//==============================================================================================
/**
- * Constructor.
- * @param msf {@link AbstractMsf} foundation for the PDB.
- * @param pdbOptions {@link PdbReaderOptions} used for processing the PDB.
- * @throws IOException Upon file IO seek/read issues.
- * @throws PdbException Upon unknown value for configuration or error in processing components.
+ * Constructor
+ * @param msf {@link Msf} foundation for the PDB
+ * @param pdbOptions {@link PdbReaderOptions} used for processing the PDB
+ * @throws IOException upon file IO seek/read issues
+ * @throws PdbException upon unknown value for configuration or error in processing components
*/
- Pdb700(AbstractMsf msf, PdbReaderOptions pdbOptions) throws IOException, PdbException {
+ Pdb700(Msf msf, PdbReaderOptions pdbOptions) throws IOException, PdbException {
super(msf, pdbOptions);
}
@Override
void deserializeIdentifiersOnly(TaskMonitor monitor)
throws IOException, PdbException, CancelledException {
- PdbByteReader reader = getDirectoryReader(monitor);
+ PdbByteReader reader = getDirectoryReader();
deserializeVersionSignatureAge(reader);
guid = reader.parseGUID();
}
@@ -53,12 +53,12 @@ public class Pdb700 extends AbstractPdb {
// Abstract Methods
//==============================================================================================
@Override
- void deserializeDirectory(TaskMonitor monitor)
+ void deserializeDirectory()
throws IOException, PdbException, CancelledException {
- PdbByteReader reader = getDirectoryReader(monitor);
+ PdbByteReader reader = getDirectoryReader();
deserializeVersionSignatureAge(reader);
guid = reader.parseGUID();
- deserializeParameters(reader, monitor);
+ deserializeParameters(reader);
}
@Override
@@ -76,8 +76,8 @@ public class Pdb700 extends AbstractPdb {
// Internal Data Methods
//==============================================================================================
/**
- * Dumps the GUID. This method is for debugging only.
- * @return {@link String} of pretty output.
+ * Dumps the GUID. This method is for debugging only
+ * @return {@link String} of pretty output
*/
protected String dumpGUID() {
if (guid == null) {
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.java
index 5bc4d2437c..c5bb2945b5 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
@@ -21,7 +21,6 @@ import java.util.*;
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractMsSymbol;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* This class represents DebugInfo (DBI) component of a PDB file.
@@ -65,8 +64,8 @@ public abstract class PdbDebugInfo {
protected int lengthSectionMap = 0; // signed 32-bit
protected int lengthFileInformation = 0; // signed 32-bit
- protected List moduleInformationList = new ArrayList<>();
- protected List sectionContributionList = new ArrayList<>();
+ protected List moduleInformationList = new ArrayList<>();
+ protected List sectionContributionList = new ArrayList<>();
protected List segmentMapList = new ArrayList<>();
protected SymbolRecords symbolRecords;
@@ -83,9 +82,9 @@ public abstract class PdbDebugInfo {
// API
//==============================================================================================
/**
- * Constructor.
- * @param pdb {@link AbstractPdb} that owns this Database Interface.
- * @param streamNumber The stream number of the stream containing the Database Interface.
+ * Constructor
+ * @param pdb {@link AbstractPdb} that owns this debug info
+ * @param streamNumber the stream number of the stream containing the debug info
*/
public PdbDebugInfo(AbstractPdb pdb, int streamNumber) {
Objects.requireNonNull(pdb, "pdb cannot be null");
@@ -97,8 +96,8 @@ public abstract class PdbDebugInfo {
}
/**
- * Returns the number of bytes needed to store the version number.
- * @return The number of bytes needed to store the version number.
+ * Returns the number of bytes needed to store the version number
+ * @return the number of bytes needed to store the version number
*/
public static int getVersionNumberSize() {
return VERSION_NUMBER_SIZE;
@@ -109,29 +108,28 @@ public abstract class PdbDebugInfo {
* 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.
- * @return The version number of the Database Interface.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException upon error parsing a field.
- * @throws CancelledException Upon user cancellation.
+ * @return the version number of the debug info
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error parsing a field
+ * @throws CancelledException upon user cancellation
*/
- public long deserialize(boolean headerOnly, TaskMonitor monitor)
+ public long deserialize(boolean headerOnly)
throws IOException, PdbException, CancelledException {
if (headerOnly) {
PdbByteReader reader =
- pdb.getReaderForStreamNumber(streamNumber, 0, getHeaderLength(), monitor);
+ pdb.getReaderForStreamNumber(streamNumber, 0, getHeaderLength());
deserializeHeader(reader);
}
else {
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber);
deserializeHeader(reader);
- deserializeInternalSubstreams(reader, monitor);
- deserializeAdditionalSubstreams(monitor);
+ deserializeInternalSubstreams(reader);
+ deserializeAdditionalSubstreams();
// BELOW: NEW STUFF FROM REFACTOR/REWORK (can be duplicative with other stuff)
if (doNewStuff) {
- parseModules(monitor);
- compareSymbols(monitor); //temporary to ensure same results with previous work.
+ parseModules();
+ compareSymbols(); //temporary to ensure same results with previous work.
}
// ABOVE: NEW STUFF FROM REFACTOR/REWORK (can be duplicative with other stuff)
}
@@ -139,7 +137,7 @@ public abstract class PdbDebugInfo {
}
/**
- * Returns the number of modules.
+ * Returns the number of modules
* @return the number of modules
*/
public int getNumModules() {
@@ -147,24 +145,24 @@ public abstract class PdbDebugInfo {
}
/**
- * Returns the list of {@link AbstractModuleInformation}, indexed by the module number.
- * @return List of {@link AbstractModuleInformation}.
+ * Returns the list of {@link ModuleInformation}, indexed by the module number
+ * @return list of {@link ModuleInformation}
*/
- public List getModuleInformationList() {
+ public List getModuleInformationList() {
return moduleInformationList;
}
/**
- * Returns the {@link AbstractModuleInformation}, based on the moduleNumber.
- * @param moduleNumber The module number being requested (1 to {@link #getNumModules()}).
- * @return {@link AbstractModuleInformation} for the moduleNumber provided.
- * @throws PdbException Upon moduleNumber out of range or no module information.
+ * Returns the {@link ModuleInformation}, based on the moduleNumber
+ * @param moduleNumber the module number being requested (1 to {@link #getNumModules()})
+ * @return {@link ModuleInformation} for the moduleNumber provided
+ * @throws PdbException upon moduleNumber out of range or no module information
*/
- public AbstractModuleInformation getModuleInformation(int moduleNumber) throws PdbException {
+ public ModuleInformation getModuleInformation(int moduleNumber) throws PdbException {
if (moduleNumber < 1 || moduleNumber > moduleInformationList.size()) {
throw new PdbException("ModuleNumber out of range: " + moduleNumber);
}
- AbstractModuleInformation moduleInfo = moduleInformationList.get(moduleNumber - 1);
+ ModuleInformation moduleInfo = moduleInformationList.get(moduleNumber - 1);
if (moduleInfo == null) {
throw new PdbException("Null AbstractModuleInformation");
}
@@ -172,20 +170,20 @@ public abstract class PdbDebugInfo {
}
/**
- * Returns the list of combined global/public symbols.
+ * Returns the list of combined global/public symbols
* @return {@link Map}<{@link Long},{@link AbstractMsSymbol}> of buffer offsets to
- * symbols.
+ * symbols
*/
public Map getSymbolsByOffset() {
return symbolRecords.getSymbolsByOffset();
}
/**
- * Returns the buffer-offset-to-symbol map for the module as specified by moduleNumber.
- * @param moduleNumber The number ID of the module for which to return the list.
+ * Returns the buffer-offset-to-symbol map for the module as specified by moduleNumber
+ * @param moduleNumber the number ID of the module for which to return the list
* @return {@link Map}<{@link Long},{@link AbstractMsSymbol}> of buffer offsets to
- * symbols for the specified module.
- * @throws PdbException Upon moduleNumber out of range or no module information.
+ * symbols for the specified module
+ * @throws PdbException upon moduleNumber out of range or no module information
*/
public Map getModuleSymbolsByOffset(int moduleNumber)
throws PdbException {
@@ -200,10 +198,10 @@ public abstract class PdbDebugInfo {
/**
* Returns the {@link AbstractMsSymbol} from the main symbols for the
- * actual symbol record offset (which is past the length and symbol type fields).
+ * 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.
- * @return the symbol group for the module or null if not found.
+ * offset value specified by many symbol type records
+ * @return the symbol group for the module or null if not found
*/
public AbstractMsSymbol getSymbolForOffsetOfRecord(long offset) {
return getSymbolsByOffset().get(offset - 4);
@@ -211,13 +209,13 @@ public abstract class PdbDebugInfo {
/**
* Returns the {@link AbstractMsSymbol} for the module as specified by moduleNumber and
- * actual symbol record offset (which is past the length and symbol type fields).
- * @param moduleNumber The number ID of the module (1 to {@link #getNumModules()}) for
- * which to return the list.
+ * actual symbol record offset (which is past the length and symbol type fields)
+ * @param moduleNumber the number ID of the module (1 to {@link #getNumModules()}) for
+ * which to return the list
* @param offset the offset of the symbol (beyond length and symbol type fields); this is the
- * offset value specified by many symbol type records.
- * @return the symbol group for the module or null if not found.
- * @throws PdbException Upon moduleNumber out of range or no module information.
+ * offset value specified by many symbol type records
+ * @return the symbol group for the module or null if not found
+ * @throws PdbException upon moduleNumber out of range or no module information
*/
public AbstractMsSymbol getSymbolForModuleAndOffsetOfRecord(int moduleNumber, long offset)
throws PdbException {
@@ -229,41 +227,40 @@ public abstract class PdbDebugInfo {
}
/**
- * Returns list of {@link AbstractSectionContribution} for this Database Interface.
- * @return List of {@link AbstractSectionContribution}.
+ * Returns list of {@link SectionContribution} for this debug info
+ * @return list of {@link SectionContribution}
*/
- public List getSectionContributionList() {
+ public List getSectionContributionList() {
return sectionContributionList;
}
/**
- * Returns list of {@link SegmentMapDescription} for this Database Interface.
- * @return List of {@link SegmentMapDescription}.
+ * Returns list of {@link SegmentMapDescription} for this debug info
+ * @return list of {@link SegmentMapDescription}
*/
public List getSegmentMapList() {
return segmentMapList;
}
/**
- * Returns {@link SymbolRecords} component for this Database Interface.
- * @return {@link SymbolRecords} component.
+ * Returns {@link SymbolRecords} component for this debug info
+ * @return {@link SymbolRecords} component
*/
public SymbolRecords getSymbolRecords() {
return symbolRecords;
}
/**
- * Returns {@link GlobalSymbolInformation} component for this Database Interface.
- * @return {@link GlobalSymbolInformation} component.
+ * Returns {@link GlobalSymbolInformation} component for this debug info
+ * @return {@link GlobalSymbolInformation} component
*/
public GlobalSymbolInformation getGlobalSymbolInformation() {
return globalSymbolInformation;
}
/**
- * Returns Public Symbol Information component for
- * this Database Interface.
- * @return Public Symbol Information component.
+ * Returns Public Symbol Information component for this debug info
+ * @return Public Symbol Information component
*/
public PublicSymbolInformation getPublicSymbolInformation() {
return publicSymbolInformation;
@@ -273,24 +270,24 @@ public abstract class PdbDebugInfo {
// Package-Protected Internals
//==============================================================================================
/**
- * Returns the stream number for the GlobalSymbols component.
- * @return Stream number.
+ * Returns the stream number for the GlobalSymbols component
+ * @return stream number
*/
int getGlobalSymbolsHashMaybeStreamNumber() {
return streamNumberGlobalStaticSymbolsHashMaybe;
}
/**
- * Returns the stream number for the PublicStaticSymbols component.
- * @return Stream number.
+ * Returns the stream number for the PublicStaticSymbols component
+ * @return stream number
*/
int getPublicStaticSymbolsHashMaybeStreamNumber() {
return streamNumberPublicStaticSymbolsHashMaybe;
}
/**
- * Returns the stream number for {@link SymbolRecords} component.
- * @return Stream number.
+ * Returns the stream number for {@link SymbolRecords} component
+ * @return stream number
*/
int getSymbolRecordsStreamNumber() {
return streamNumberSymbolRecords;
@@ -300,9 +297,9 @@ public abstract class PdbDebugInfo {
// Abstract Methods
//==============================================================================================
/**
- * Deserializes the Header.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @throws PdbException Upon not enough data left to parse.
+ * Deserializes the Header
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @throws PdbException upon not enough data left to parse
*/
protected abstract void deserializeHeader(PdbByteReader reader) throws PdbException;
@@ -313,64 +310,62 @@ public abstract class PdbDebugInfo {
protected abstract int getHeaderLength();
/**
- * Deserializes the SubStreams internal to the Database Interface stream.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException upon error parsing a field.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the SubStreams internal to the debug info stream
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @throws PdbException upon error parsing a field
+ * @throws CancelledException upon user cancellation
*/
- protected abstract void deserializeInternalSubstreams(PdbByteReader reader, TaskMonitor monitor)
+ protected abstract void deserializeInternalSubstreams(PdbByteReader reader)
throws PdbException, CancelledException;
/**
- * Deserializes the AdditionalSubstreams components.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException upon error parsing a field.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the AdditionalSubstreams components
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error parsing a field
+ * @throws CancelledException upon user cancellation
*/
- protected abstract void deserializeAdditionalSubstreams(TaskMonitor monitor)
+ protected abstract void deserializeAdditionalSubstreams()
throws IOException, PdbException, CancelledException;
/**
- * Deserializes/Processes the appropriate {@link AbstractModuleInformation} flavor.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @param skip Skip over the data in the {@link PdbByteReader}.
- * @throws PdbException upon error parsing a field.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes/processes the appropriate {@link ModuleInformation} flavor
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @param skip skip over the data in the {@link PdbByteReader}
+ * @throws PdbException upon error parsing a field
+ * @throws CancelledException upon user cancellation
*/
- protected abstract void processModuleInformation(PdbByteReader reader, TaskMonitor monitor,
- boolean skip) throws PdbException, CancelledException;
+ protected abstract void processModuleInformation(PdbByteReader reader, boolean skip)
+ throws PdbException, CancelledException;
/**
- * Dumps the Header. This method is for debugging only.
- * @param writer {@link Writer} to which to write the debug dump.
- * @throws IOException On issue writing to the {@link Writer}.
+ * Dumps the Header. This method is for debugging only
+ * @param writer {@link Writer} to which to write the debug dump
+ * @throws IOException on issue writing to the {@link Writer}
*/
protected abstract void dumpHeader(Writer writer) throws IOException;
/**
- * Dumps the Internal Substreams. This method is for debugging only.
- * @param writer {@link Writer} to which to write the debug dump.
- * @throws IOException On issue writing to the {@link Writer}.
+ * Dumps the Internal Substreams. This method is for debugging only
+ * @param writer {@link Writer} to which to write the debug dump
+ * @throws IOException on issue writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
- protected abstract void dumpInternalSubstreams(Writer writer) throws IOException;
+ protected abstract void dumpInternalSubstreams(Writer writer)
+ throws IOException, CancelledException;
//==============================================================================================
// Internal Data Methods
//==============================================================================================
/**
- * Deserializes/Processes the SectionContributions component.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @param skip Skip over the data in the {@link PdbByteReader}.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes/processes the SectionContributions component
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @param skip skip over the data in the {@link PdbByteReader}
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
- protected void processSectionContributions(PdbByteReader reader, TaskMonitor monitor,
- boolean skip) throws PdbException, CancelledException {
+ protected void processSectionContributions(PdbByteReader reader, boolean skip)
+ throws PdbException, CancelledException {
if (lengthSectionContributionSubstream == 0) {
return;
}
@@ -385,8 +380,8 @@ public abstract class PdbDebugInfo {
if (version == SCV1400) {
//long version2 = substreamReader.parseUnsignedIntVal();
while (substreamReader.hasMore()) {
- monitor.checkCanceled();
- AbstractSectionContribution sectionContribution = new SectionContribution1400();
+ pdb.checkCanceled();
+ SectionContribution sectionContribution = new SectionContribution1400();
sectionContribution.deserialize(substreamReader);
sectionContributionList.add(sectionContribution);
}
@@ -394,8 +389,8 @@ public abstract class PdbDebugInfo {
else if (version == SCV600) {
//long version2 = substreamReader.parseUnsignedIntVal();
while (substreamReader.hasMore()) {
- monitor.checkCanceled();
- AbstractSectionContribution sectionContribution = new SectionContribution600();
+ pdb.checkCanceled();
+ SectionContribution sectionContribution = new SectionContribution600();
sectionContribution.deserialize(substreamReader);
sectionContributionList.add(sectionContribution);
}
@@ -403,11 +398,11 @@ public abstract class PdbDebugInfo {
//TODO: Don't know when SectionContribution200 is the type to use. Don't know if
// this part could be the default of processSectionContribs within
// DebugInfo and if the above part (test for SVC600 and SVC1400 would
- // be the override method for DatabaseInformationNew.
+ // be the override method for PdbNewDebugInfo.
else {
while (substreamReader.hasMore()) {
- monitor.checkCanceled();
- AbstractSectionContribution sectionContribution = new SectionContribution400();
+ pdb.checkCanceled();
+ SectionContribution sectionContribution = new SectionContribution400();
sectionContribution.deserialize(substreamReader);
sectionContributionList.add(sectionContribution);
}
@@ -415,18 +410,17 @@ public abstract class PdbDebugInfo {
}
/**
- * Deserializes/Processes the {@link SegmentMapDescription}.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @param skip Skip over the data in the {@link PdbByteReader}.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes/processes the {@link SegmentMapDescription}
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @param skip skip over the data in the {@link PdbByteReader}
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
// TODO: unused value numSegLog?
// Note: this is SegmentMap or SectionMap (API structs are segment; API code is Section)
// Suppress "unused" for numSegLog
@SuppressWarnings("unused")
- protected void processSegmentMap(PdbByteReader reader, TaskMonitor monitor, boolean skip)
+ protected void processSegmentMap(PdbByteReader reader, boolean skip)
throws PdbException, CancelledException {
if (lengthSectionMap == 0) {
return;
@@ -442,7 +436,7 @@ public abstract class PdbDebugInfo {
int numSegLog = substreamReader.parseUnsignedShortVal();
// Process records
while (substreamReader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
SegmentMapDescription segment = new SegmentMapDescription();
segment.deserialize(substreamReader);
segmentMapList.add(segment);
@@ -453,14 +447,13 @@ public abstract class PdbDebugInfo {
}
/**
- * Deserializes/Processes the FileInformation.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @param skip Skip over the data in the {@link PdbByteReader}.
- * @throws PdbException upon error parsing filename.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes/processes the FileInformation
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @param skip skip over the data in the {@link PdbByteReader}
+ * @throws PdbException upon error parsing filename
+ * @throws CancelledException upon user cancellation
*/
- protected void processFileInformation(PdbByteReader reader, TaskMonitor monitor, boolean skip)
+ protected void processFileInformation(PdbByteReader reader, boolean skip)
throws PdbException, CancelledException {
if (lengthFileInformation == 0) {
return;
@@ -484,7 +477,7 @@ public abstract class PdbDebugInfo {
int[] count = new int[numInformationModules];
int totalCount = 0;
for (int moduleIndex = 0; moduleIndex < numInformationModules; moduleIndex++) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
index[moduleIndex] = indicesReader.parseUnsignedShortVal();
count[moduleIndex] = countsReader.parseUnsignedShortVal();
totalCount += count[moduleIndex];
@@ -497,6 +490,7 @@ public abstract class PdbDebugInfo {
PdbByteReader offsetReader = fileInfoReader.getSubPdbByteReader(totalCount * 4);
int[] offset = new int[totalCount];
for (int moduleIndex = 0; moduleIndex < totalCount; moduleIndex++) {
+ pdb.checkCanceled();
offset[moduleIndex] = offsetReader.parseInt();
}
PdbByteReader namesReader =
@@ -504,8 +498,10 @@ public abstract class PdbDebugInfo {
int totalRefs = 0;
for (int moduleIndex = 0; moduleIndex < numInformationModules; moduleIndex++) {
- AbstractModuleInformation module = moduleInformationList.get(moduleIndex);
+ pdb.checkCanceled();
+ ModuleInformation module = moduleInformationList.get(moduleIndex);
for (int fileIndex = 0; fileIndex < count[moduleIndex]; fileIndex++) {
+ pdb.checkCanceled();
int ref = totalRefs + fileIndex;
int nameOffset = offset[ref];
namesReader.setIndex(nameOffset);
@@ -518,7 +514,7 @@ public abstract class PdbDebugInfo {
/**
* Method to parse the filename for the "File Information" section from the
- * {@link PdbByteReader}.
+ * {@link PdbByteReader}
* @param reader the {@link PdbByteReader} from which to parse the data
* @return the filename
* @throws PdbException upon error parsing the filename
@@ -527,11 +523,11 @@ public abstract class PdbDebugInfo {
/**
* Debug method for dumping information from this {@link PdbDebugInfo}-based
- * instance.
- * @param writer {@link Writer} to which to dump the information.
- * @throws IOException Upon IOException writing to the {@link Writer}.
- * @throws CancelledException Upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * instance
+ * @param writer {@link Writer} to which to dump the information
+ * @throws IOException upon IOException writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
+ * @throws PdbException upon not enough data left to parse
*/
protected void dump(Writer writer) throws IOException, CancelledException, PdbException {
writer.write("DebugInfoHeader---------------------------------------------\n");
@@ -546,12 +542,11 @@ public abstract class PdbDebugInfo {
}
/**
- * Debug method for dumping additional substreams from this
- * {@link PdbDebugInfo}-based instance.
- * @param writer {@link Writer} to which to dump the information.
- * @throws IOException Upon IOException writing to the {@link Writer}.
- * @throws CancelledException Upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * Debug method for dumping additional substreams from this {@link PdbDebugInfo}-based instance
+ * @param writer {@link Writer} to which to dump the information
+ * @throws IOException upon IOException writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
+ * @throws PdbException upon not enough data left to parse
*/
protected void dumpAdditionalSubstreams(Writer writer)
throws IOException, CancelledException, PdbException {
@@ -563,19 +558,22 @@ public abstract class PdbDebugInfo {
if (doNewStuff) {
dumpSymbols(writer);
for (Module module : modules) {
+ pdb.checkCanceled();
module.dump(writer);
}
}
}
/**
- * Debug method for dumping module information for all of the {@link AbstractModuleInformation}
- * modules from this {@link PdbDebugInfo}-based instance.
- * @param writer {@link Writer} to which to dump the information.
- * @throws IOException Upon IOException writing to the {@link Writer}.
+ * Debug method for dumping module information for all of the {@link ModuleInformation}
+ * modules from this {@link PdbDebugInfo}-based instance
+ * @param writer {@link Writer} to which to dump the information
+ * @throws IOException upon IOException writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
- protected void dumpModuleInformation(Writer writer) throws IOException {
- for (AbstractModuleInformation information : moduleInformationList) {
+ protected void dumpModuleInformation(Writer writer) throws IOException, CancelledException {
+ for (ModuleInformation information : moduleInformationList) {
+ pdb.checkCanceled();
writer.write(information.dump());
writer.write("\n");
}
@@ -583,13 +581,14 @@ public abstract class PdbDebugInfo {
/**
* Debug method for dumping section contribution for all of the
- * {@link AbstractSectionContribution} components from this
- * {@link PdbDebugInfo}-based instance.
- * @param writer {@link Writer} to which to dump the information.
- * @throws IOException Upon IOException writing to the {@link Writer}.
+ * {@link SectionContribution} components from this {@link PdbDebugInfo}-based instance
+ * @param writer {@link Writer} to which to dump the information
+ * @throws IOException upon IOException writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
- protected void dumpSectionContributions(Writer writer) throws IOException {
- for (AbstractSectionContribution contribution : sectionContributionList) {
+ protected void dumpSectionContributions(Writer writer) throws IOException, CancelledException {
+ for (SectionContribution contribution : sectionContributionList) {
+ pdb.checkCanceled();
writer.write(contribution.dump());
writer.write("\n");
}
@@ -597,13 +596,14 @@ public abstract class PdbDebugInfo {
/**
* Debug method for dumping segment map information for all of the
- * {@link SegmentMapDescription} components from this {@link PdbDebugInfo}-based
- * instance.
- * @param writer {@link Writer} to which to dump the information.
- * @throws IOException Upon IOException writing to the {@link Writer}.
+ * {@link SegmentMapDescription} components from this {@link PdbDebugInfo}-based instance
+ * @param writer {@link Writer} to which to dump the information
+ * @throws IOException upon IOException writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
- protected void dumpSegmentMap(Writer writer) throws IOException {
+ protected void dumpSegmentMap(Writer writer) throws IOException, CancelledException {
for (SegmentMapDescription description : segmentMapList) {
+ pdb.checkCanceled();
writer.write(description.dump());
writer.write("\n");
}
@@ -612,10 +612,10 @@ public abstract class PdbDebugInfo {
//==============================================================================================
// NEW STUFF FROM REFACTOR/REWORK (can be duplicative with other stuff)... might be turned off
// during development.
- private void parseModules(TaskMonitor monitor) throws CancelledException {
- for (AbstractModuleInformation moduleInformation : moduleInformationList) {
- monitor.checkCanceled();
- Module module = new Module(pdb, moduleInformation, monitor);
+ private void parseModules() throws CancelledException {
+ for (ModuleInformation moduleInformation : moduleInformationList) {
+ pdb.checkCanceled();
+ Module module = new Module(pdb, moduleInformation);
modules.add(module);
}
}
@@ -625,7 +625,7 @@ public abstract class PdbDebugInfo {
}
/**
- * Return the Module based upon the module number.
+ * Return the Module based upon the module number
* @param moduleNum the module number
* @return the module
*/
@@ -635,28 +635,27 @@ public abstract class PdbDebugInfo {
// NOTE: Designs are not done regarding possibly iterators for iterating only globals or publics
/**
- * Returns the symbol iterator for general (public and global symbols.
- * @param monitor monitor for the job
+ * Returns the symbol iterator for general (public and global symbols
* @return an iterator over all symbols of the module
- * @throws CancelledException Upon user cancellation
+ * @throws CancelledException upon user cancellation
* @throws IOException upon issue reading the stream
*/
- public MsSymbolIterator getSymbolIterator(TaskMonitor monitor)
+ public MsSymbolIterator getSymbolIterator()
throws CancelledException, IOException {
if (streamNumberSymbolRecords == 0xffff) {
return null;
}
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumberSymbolRecords, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumberSymbolRecords);
MsSymbolIterator iterator = new MsSymbolIterator(pdb, reader);
return iterator;
}
/**
- * Returns the symbol iterator symbols of the specified module.
+ * Returns the symbol iterator symbols of the specified module
* @param moduleNum the module number
* @return an iterator over all symbols of the module
- * @throws CancelledException Upon user cancellation
- * @throws PdbException Upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
+ * @throws PdbException upon not enough data left to parse
*/
MsSymbolIterator getSymbolIterator(int moduleNum) throws CancelledException, PdbException {
Module module = modules.get(moduleNum);
@@ -664,17 +663,17 @@ public abstract class PdbDebugInfo {
}
private void dumpSymbols(Writer writer) throws CancelledException, IOException {
- // TODO: in GP-2367 (rename/refactor) ticket... put in appropriate monitor
- MsSymbolIterator iterator = getSymbolIterator(TaskMonitor.DUMMY);
+ MsSymbolIterator iterator = getSymbolIterator();
List symbols = new ArrayList<>();
while (iterator.hasNext()) {
+ pdb.checkCanceled();
symbols.add(iterator.next());
}
}
// This method is temporary. It only exists for ensuring results as we transition processing
// mechanisms.
- private void compareSymbols(TaskMonitor monitor)
+ private void compareSymbols()
throws CancelledException, PdbException, IOException {
PdbDebugInfo debugInfo = pdb.getDebugInfo();
if (debugInfo == null) {
@@ -682,9 +681,10 @@ public abstract class PdbDebugInfo {
}
// Compare general symbols
- MsSymbolIterator iterator = getSymbolIterator(monitor);
+ MsSymbolIterator iterator = getSymbolIterator();
List symbols = new ArrayList<>();
while (iterator.hasNext()) {
+ pdb.checkCanceled();
symbols.add(iterator.next());
}
if (symbols.size() != symbolRecords.getSymbolsByOffset().size()) {
@@ -695,6 +695,7 @@ public abstract class PdbDebugInfo {
int cnt = 0;
for (Map.Entry entry : symbolRecords.getSymbolsByOffset()
.entrySet()) {
+ pdb.checkCanceled();
AbstractMsSymbol msym = entry.getValue();
AbstractMsSymbol lsym = symbols.get(cnt);
String mstr = msym.toString();
@@ -709,17 +710,20 @@ public abstract class PdbDebugInfo {
// Compare module symbols
for (int modnum = 0; modnum < numModules(); modnum++) {
+ pdb.checkCanceled();
Module module = modules.get(modnum);
MsSymbolIterator moduleSymbolsIterator = module.getSymbolIterator();
cnt = 0;
Map map = symbolRecords.getModuleSymbolsByOffset(modnum);
List keys = new ArrayList<>();
for (Map.Entry entry : map.entrySet()) {
+ pdb.checkCanceled();
Long key = entry.getKey();
keys.add(key);
}
Collections.sort(keys);
for (Long key : keys) {
+ pdb.checkCanceled();
AbstractMsSymbol msym = map.get(key);
if (!moduleSymbolsIterator.hasNext()) {
// Set break-point on next line. Multiple lines here to eliminate Eclipse warning.
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.java
index f7579e7175..a95396f1f0 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
@@ -19,7 +19,6 @@ import java.io.IOException;
import ghidra.util.exception.AssertException;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* Parser for detecting the appropriate {@link PdbDebugInfo} format for the filename
@@ -44,13 +43,13 @@ public class PdbDebugInfoParser {
// API
//==============================================================================================
/**
- * Parses information to determine the version of Database Interface to create.
- * @param pdb {@link AbstractPdb} that owns this Database Interface.
- * @return {@link PdbDebugInfo} of the appropriate Database Interface or null if
- * the stream does not have enough information to be parsed.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException Upon error in processing components.
+ * Parses information to determine the version of debug info to create
+ * @param pdb {@link AbstractPdb} that owns this debug info
+ * @return {@link PdbDebugInfo} of the appropriate debug info or null if the stream does not
+ * have enough information to be parsed
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon error in processing components
*/
public PdbDebugInfo parse(AbstractPdb pdb) throws IOException, PdbException {
PdbDebugInfo debugInfo;
@@ -58,7 +57,7 @@ public class PdbDebugInfoParser {
int streamNumber = getStreamNumber();
// Only reading 8-bytes - no need for monitor
PdbByteReader reader =
- pdb.getReaderForStreamNumber(streamNumber, 0, 8, TaskMonitor.DUMMY);
+ pdb.getReaderForStreamNumber(streamNumber, 0, 8);
if (reader.getLimit() == 0) {
return null;
}
@@ -102,8 +101,8 @@ public class PdbDebugInfoParser {
// Internal Data Methods
//==============================================================================================
/**
- * Returns the standard stream number that contains the serialized Database Interface.
- * @return Stream number that contains the Database Interface.
+ * Returns the standard stream number that contains the serialized debug info
+ * @return stream number that contains the debug info
*/
protected int getStreamNumber() {
return DEBUG_INFO_STREAM_NUMBER;
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbLog.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbLog.java
index 50934f9304..52cbf879c9 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbLog.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbLog.java
@@ -40,8 +40,8 @@ public class PdbLog {
* method gives control to the client to be able to turn on/off the messaging output without
* having to do conditional checks at each point that one of the messaging methods is called.
* @param enable {@code true} to enable logging; {@code false} to disable logging. Initial
- * state is {@code false}.
- * @throws IOException upon problem creating a {@link FileWriter}.
+ * state is {@code false}
+ * @throws IOException upon problem creating a {@link FileWriter}
* @see #message(String)
* @see #message(String, Supplier...)
*/
@@ -53,11 +53,11 @@ public class PdbLog {
* Outputs a message to the PDB log if messaging has been enable, else ignored. This method
* uses a format string and a variable arguments list of lambdas to allow for deferred
* processing of the message to output. Thus, when message output is disabled, the client
- * does not endure as much cost in supplying a message string that is not used.
+ * does not endure as much cost in supplying a message string that is not used
* @param format a {@link String} format list as would be used to a printf() function, but
* which must only specify {@code %s} {@link String} outputs.
* @param suppliers variable number of {@link Supplier}<{@link String}> arguments. The
- * number must match the number of {@code %s} outputs in the format string.
+ * number must match the number of {@code %s} outputs in the format string
* @see #setEnabled(boolean)
*/
// We know this is @SafeVarags (or SuppressWarnings("unchecked")) on potential
@@ -89,9 +89,9 @@ public class PdbLog {
* Outputs a message to the PDB log if messaging has been enable, else ignored. This method
* uses a {@link Supplier}<{@link String}> to allow for deferred processing of the message
* to output. Thus, when message output is disabled, the client does not endure as much cost
- * in supplying a message string that is not used.
+ * in supplying a message string that is not used
* @param supplier a {@link Supplier}<{@link String}> that supplies a {@link String}
- * message to be output.
+ * message to be output
* @see #setEnabled(boolean)
*/
public static void message(Supplier supplier) {
@@ -111,8 +111,8 @@ public class PdbLog {
}
/**
- * Outputs a {@link String} message to the PDB log if messaging has been enable, else ignored.
- * @param message a {@link String} message to be output.
+ * Outputs a {@link String} message to the PDB log if messaging has been enable, else ignored
+ * @param message a {@link String} message to be output
* @see #setEnabled(boolean)
*/
public static void message(String message) {
@@ -145,17 +145,17 @@ public class PdbLog {
// might not have been read, depending on the order of how record sets are read.
// TODO: is using PdbLog here. Is that what we intend?
/**
- * Logs fact of record index out of range (detection is performed by caller).
- * @param tpi the TypeProgramInterface involved.
- * @param recordNumber the record number to report.
+ * Logs fact of record index out of range (detection is performed by caller)
+ * @param tpi the TypeProgramInterface involved
+ * @param recordNumber the record number to report
*/
- public static void logBadTypeRecordIndex(AbstractTypeProgramInterface tpi, int recordNumber) {
+ public static void logBadTypeRecordIndex(TypeProgramInterface tpi, int recordNumber) {
message("Bad requested type record " + recordNumber + ", min: " + tpi.getTypeIndexMin() +
", max: " + tpi.getTypeIndexMaxExclusive());
}
/**
- * Logs fact of record index out of range (detection is performed by caller).
+ * Logs fact of record index out of range (detection is performed by caller)
* @param type {@link AbstractMsType} found
* @param itemRequiredClass class expected
*/
@@ -165,7 +165,7 @@ public class PdbLog {
}
/**
- * Cleans up the class by closing resources.
+ * Cleans up the class by closing resources
*/
public static void dispose() {
try {
@@ -180,8 +180,8 @@ public class PdbLog {
}
/**
- * Returns the {@link Writer} for logging.
- * @return a {@link Writer} for for logging.
+ * Returns the {@link Writer} for logging
+ * @return a {@link Writer} for for logging
*/
private static Writer getWriter() throws IOException {
return enabled ? getFileWriter() : getNullWriter();
@@ -189,8 +189,8 @@ public class PdbLog {
/**
* Returns the {@link FileWriter} for the log file. If the file is already open, it is
- * returned. If not already open, it is opened and previous contents are deleted.
- * @return a {@link FileWriter} for the log file.
+ * returned. If not already open, it is opened and previous contents are deleted
+ * @return a {@link FileWriter} for the log file
*/
private static Writer getFileWriter() throws IOException {
if (fileWriter == null) {
@@ -210,8 +210,8 @@ public class PdbLog {
/**
* Returns a {@link NullWriter} for the log file when chosen instead of a FileWriter. If
- * one already exists, it is returned. Otherwise a new one is created.
- * @return a {@link NullWriter} for the log file.
+ * one already exists, it is returned. Otherwise a new one is created
+ * @return a {@link NullWriter} for the log file
*/
private static Writer getNullWriter() {
if (nullWriter == null) {
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbNewDebugInfo.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbNewDebugInfo.java
index 852503f275..cc691d5e8b 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbNewDebugInfo.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbNewDebugInfo.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.List;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* This class is the version of {@link PdbDebugInfo} for newer PDB files.
@@ -63,9 +62,9 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
// API
//==============================================================================================
/**
- * Constructor.
- * @param pdb {@link AbstractPdb} that owns this {@link PdbNewDebugInfo}.
- * @param streamNumber The stream number that contains the {@link PdbNewDebugInfo} data.
+ * Constructor
+ * @param pdb {@link AbstractPdb} that owns this {@link PdbNewDebugInfo}
+ * @param streamNumber the stream number that contains the {@link PdbNewDebugInfo} data
*/
public PdbNewDebugInfo(AbstractPdb pdb, int streamNumber) {
super(pdb, streamNumber);
@@ -73,16 +72,16 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
}
/**
- * Returns the {@link ImageFileMachine} machine type.
- * @return the machine type.
+ * Returns the {@link ImageFileMachine} machine type
+ * @return the machine type
*/
public ImageFileMachine getMachineType() {
return machineType;
}
/**
- * Returns the {@link DebugData} for this {@link PdbNewDebugInfo}.
- * @return the {@link DebugData}.
+ * Returns the {@link DebugData} for this {@link PdbNewDebugInfo}
+ * @return the {@link DebugData}
*/
public DebugData getDebugData() {
return debugData;
@@ -133,34 +132,34 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
}
@Override
- protected void deserializeInternalSubstreams(PdbByteReader reader, TaskMonitor monitor)
+ protected void deserializeInternalSubstreams(PdbByteReader reader)
throws PdbException, CancelledException {
- processModuleInformation(reader, monitor, false);
- processSectionContributions(reader, monitor, false);
- processSegmentMap(reader, monitor, false);
- processFileInformation(reader, monitor, false);
+ processModuleInformation(reader, false);
+ processSectionContributions(reader, false);
+ processSegmentMap(reader, false);
+ processFileInformation(reader, false);
processTypeServerMap(reader, false);
//Note that the next two are in reverse order from their length fields in the header.
- processEditAndContinueInformation(reader, monitor, false);
+ processEditAndContinueInformation(reader, false);
//processDebugHeader(reader, false);
- debugData.deserializeHeader(reader, monitor);
+ debugData.deserializeHeader(reader);
}
@Override
- protected void deserializeAdditionalSubstreams(TaskMonitor monitor)
+ protected void deserializeAdditionalSubstreams()
throws IOException, PdbException, CancelledException {
// TODO: evaluate. I don't think we need GlobalSymbolInformation (hash) or the
- // PublicSymbolInformation (hash), as they are both are search mechanisms.
- symbolRecords.deserialize(monitor);
- globalSymbolInformation.deserialize(getGlobalSymbolsHashMaybeStreamNumber(), monitor);
- publicSymbolInformation.deserialize(getPublicStaticSymbolsHashMaybeStreamNumber(), monitor);
+ // PublicSymbolInformation (hash), as they are both are search mechanisms.
+ symbolRecords.deserialize();
+ globalSymbolInformation.deserialize(getGlobalSymbolsHashMaybeStreamNumber());
+ publicSymbolInformation.deserialize(getPublicStaticSymbolsHashMaybeStreamNumber());
//TODO: Process further information that might be found from ProcessTypeServerMap,
// and processEditAndContinueInformation.
- debugData.deserialize(monitor);
+ debugData.deserialize();
}
@Override
- protected void processModuleInformation(PdbByteReader reader, TaskMonitor monitor, boolean skip)
+ protected void processModuleInformation(PdbByteReader reader, boolean skip)
throws PdbException, CancelledException {
if (lengthModuleInformationSubstream == 0) {
return;
@@ -172,8 +171,8 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
PdbByteReader substreamReader =
reader.getSubPdbByteReader(lengthModuleInformationSubstream);
while (substreamReader.hasMore()) {
- monitor.checkCanceled();
- AbstractModuleInformation moduleInformation = new ModuleInformation600(pdb);
+ pdb.checkCanceled();
+ ModuleInformation moduleInformation = new ModuleInformation600(pdb);
moduleInformation.deserialize(substreamReader);
moduleInformationList.add(moduleInformation);
}
@@ -230,7 +229,7 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
}
@Override
- protected void dumpInternalSubstreams(Writer writer) throws IOException {
+ protected void dumpInternalSubstreams(Writer writer) throws IOException, CancelledException {
writer.write("ModuleInformationList---------------------------------------\n");
dumpModuleInformation(writer);
writer.write("\nEnd ModuleInformationList-----------------------------------\n");
@@ -251,10 +250,10 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
//==============================================================================================
//TODO: Find examples that exercise this.
/**
- * Deserializes/Processes the TypeServerMap.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param skip Skip over the data in the {@link PdbByteReader}.
- * @throws PdbException Upon not enough data left to parse.
+ * Deserializes/processes the TypeServerMap
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @param skip skip over the data in the {@link PdbByteReader}
+ * @throws PdbException upon not enough data left to parse
*/
@SuppressWarnings("unused") // substreamReader
protected void processTypeServerMap(PdbByteReader reader, boolean skip) throws PdbException {
@@ -270,16 +269,15 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
}
/**
- * Deserializes/Processes the EditAndContinueInformation.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @param skip Skip over the data in the {@link PdbByteReader}.
- * @throws PdbException upon error parsing a name or unexpected data.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes/processes the EditAndContinueInformation
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @param skip skip over the data in the {@link PdbByteReader}
+ * @throws PdbException upon error parsing a name or unexpected data
+ * @throws CancelledException upon user cancellation
*/
@SuppressWarnings("unused") // hashVal
- protected void processEditAndContinueInformation(PdbByteReader reader, TaskMonitor monitor,
- boolean skip) throws PdbException, CancelledException {
+ protected void processEditAndContinueInformation(PdbByteReader reader, boolean skip)
+ throws PdbException, CancelledException {
if (lengthEditAndContinueSubstream == 0) {
return;
}
@@ -312,7 +310,7 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
int count = tableSize;
int realEntryCount = 0;
while (--count >= 0) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
int offset = substreamReader.parseInt();
bufferReader.setIndex(offset);
String name = bufferReader.parseNullTerminatedString(
@@ -336,8 +334,8 @@ public class PdbNewDebugInfo extends PdbDebugInfo {
/**
* Dumps the EditAndContinueNameList. This package-protected method is for debugging only.
- * @param writer {@link Writer} to which to write the debug dump.
- * @throws IOException On issue writing to the {@link Writer}.
+ * @param writer {@link Writer} to which to write the debug dump
+ * @throws IOException on issue writing to the {@link Writer}
*/
protected void dumpEditAndContinueNameList(Writer writer) throws IOException {
for (String name : editAndContinueNameList) {
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbOldDebugInfo.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbOldDebugInfo.java
index ff1b8cf51e..ed80b760fb 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbOldDebugInfo.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbOldDebugInfo.java
@@ -19,7 +19,6 @@ import java.io.IOException;
import java.io.Writer;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* This class is the version of {@link PdbDebugInfo} for older PDB files.
@@ -34,9 +33,9 @@ public class PdbOldDebugInfo extends PdbDebugInfo {
// API
//==============================================================================================
/**
- * Constructor.
- * @param pdb {@link AbstractPdb} that owns this {@link PdbOldDebugInfo}.
- * @param streamNumber The number of the stream that contains the {@link PdbOldDebugInfo}.
+ * Constructor
+ * @param pdb {@link AbstractPdb} that owns this {@link PdbOldDebugInfo}
+ * @param streamNumber the number of the stream that contains the {@link PdbOldDebugInfo}
*/
public PdbOldDebugInfo(AbstractPdb pdb, int streamNumber) {
super(pdb, streamNumber);
@@ -62,28 +61,28 @@ public class PdbOldDebugInfo extends PdbDebugInfo {
}
@Override
- protected void deserializeInternalSubstreams(PdbByteReader reader, TaskMonitor monitor)
+ protected void deserializeInternalSubstreams(PdbByteReader reader)
throws PdbException, CancelledException {
- processModuleInformation(reader, monitor, false);
- processSectionContributions(reader, monitor, false);
- processSegmentMap(reader, monitor, false);
- processFileInformation(reader, monitor, false);
+ processModuleInformation(reader, false);
+ processSectionContributions(reader, false);
+ processSegmentMap(reader, false);
+ processFileInformation(reader, false);
}
@Override
- protected void deserializeAdditionalSubstreams(TaskMonitor monitor)
+ protected void deserializeAdditionalSubstreams()
throws IOException, PdbException, CancelledException {
// TODO: evaluate. I don't think we need GlobalSymbolInformation (hash) or the
// PublicSymbolInformation (hash), as they are both are search mechanisms.
- symbolRecords.deserialize(monitor);
- globalSymbolInformation.deserialize(getGlobalSymbolsHashMaybeStreamNumber(), monitor);
- publicSymbolInformation.deserialize(getPublicStaticSymbolsHashMaybeStreamNumber(), monitor);
+ symbolRecords.deserialize();
+ globalSymbolInformation.deserialize(getGlobalSymbolsHashMaybeStreamNumber());
+ publicSymbolInformation.deserialize(getPublicStaticSymbolsHashMaybeStreamNumber());
//TODO: SectionContributions has information about code sections and refers to
// debug streams for each.
}
@Override
- protected void processModuleInformation(PdbByteReader reader, TaskMonitor monitor, boolean skip)
+ protected void processModuleInformation(PdbByteReader reader, boolean skip)
throws PdbException, CancelledException {
if (lengthModuleInformationSubstream == 0) {
return;
@@ -95,8 +94,8 @@ public class PdbOldDebugInfo extends PdbDebugInfo {
PdbByteReader substreamReader =
reader.getSubPdbByteReader(lengthModuleInformationSubstream);
while (substreamReader.hasMore()) {
- monitor.checkCanceled();
- AbstractModuleInformation moduleInformation = new ModuleInformation500(pdb);
+ pdb.checkCanceled();
+ ModuleInformation moduleInformation = new ModuleInformation500(pdb);
moduleInformation.deserialize(substreamReader);
moduleInformationList.add(moduleInformation);
}
@@ -129,7 +128,7 @@ public class PdbOldDebugInfo extends PdbDebugInfo {
}
@Override
- protected void dumpInternalSubstreams(Writer writer) throws IOException {
+ protected void dumpInternalSubstreams(Writer writer) throws IOException, CancelledException {
writer.write("ModuleInformationList---------------------------------------\n");
dumpModuleInformation(writer);
writer.write("\nEnd ModuleInformationList-----------------------------------\n");
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbParser.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbParser.java
index e70dbe307b..ffbf026f26 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbParser.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PdbParser.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pdb2.pdbreader;
import java.io.IOException;
import java.util.Objects;
-import ghidra.app.util.bin.format.pdb2.pdbreader.msf.AbstractMsf;
+import ghidra.app.util.bin.format.pdb2.pdbreader.msf.Msf;
import ghidra.app.util.bin.format.pdb2.pdbreader.msf.MsfParser;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -43,16 +43,16 @@ public class PdbParser {
/**
* Static method to open a PDB file, determine its version, and return an {@link AbstractPdb}
* appropriate for that version; it will not have been deserialized. The main method
- * to deserialize it is {@link AbstractPdb#deserialize(TaskMonitor monitor)}; the method
+ * to deserialize it is {@link AbstractPdb#deserialize()}; the method
* used to deserialize its main identifiers (signature, age, guid (if available)) is
- * {@link AbstractPdb#deserializeIdentifiersOnly(TaskMonitor monitor)}.
- * @param filename {@link String} pathname of the PDB file to parse.
- * @param pdbOptions {@link PdbReaderOptions} used for processing the PDB.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @return {@link AbstractPdb} class object for the file.
- * @throws IOException on file I/O issues.
- * @throws PdbException on parsing issues.
- * @throws CancelledException Upon user cancellation.
+ * {@link AbstractPdb#deserializeIdentifiersOnly(TaskMonitor monitor)}
+ * @param filename {@link String} pathname of the PDB file to parse
+ * @param pdbOptions {@link PdbReaderOptions} used for processing the PDB
+ * @param monitor {@link TaskMonitor} used for checking cancellation
+ * @return {@link AbstractPdb} class object for the file
+ * @throws IOException on file I/O issues
+ * @throws PdbException on parsing issues
+ * @throws CancelledException upon user cancellation
*/
public static AbstractPdb parse(String filename, PdbReaderOptions pdbOptions,
TaskMonitor monitor) throws IOException, PdbException, CancelledException {
@@ -62,7 +62,7 @@ public class PdbParser {
// Do not do a try with resources here, as the msf must live within the PDB that is
// created below.
- AbstractMsf msf = MsfParser.parse(filename, pdbOptions, monitor);
+ Msf msf = MsfParser.parse(filename, pdbOptions, monitor);
int versionNumber = AbstractPdb.deserializeVersionNumber(msf, monitor);
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PublicSymbolInformation.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PublicSymbolInformation.java
index bf81106b84..b8bca9298d 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PublicSymbolInformation.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/PublicSymbolInformation.java
@@ -20,7 +20,6 @@ import java.io.Writer;
import java.util.*;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* This class represents Public Symbol Information component of a PDB file. This class is only
@@ -56,56 +55,56 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
// API
//==============================================================================================
/**
- * Constructor.
- * @param pdbIn {@link AbstractPdb} that owns the Public Symbol Information to process.
+ * Constructor
+ * @param pdbIn {@link AbstractPdb} that owns the Public Symbol Information to process
*/
public PublicSymbolInformation(AbstractPdb pdbIn) {
super(pdbIn);
}
/**
- * Returns the number of thunks in the thunk table.
- * @return the number of thunks.
+ * Returns the number of thunks in the thunk table
+ * @return the number of thunks
*/
public int getNumThunks() {
return numThunks;
}
/**
- * Returns the section within which the thunk table is located.
- * @return the section of the thunk table.
+ * Returns the section within which the thunk table is located
+ * @return the section of the thunk table
*/
public int getThunkTableSection() {
return iSectionThunkTable;
}
/**
- * Returns the offset of the thunk table within the section it is located.
- * @return the offset of the thunk table.
+ * Returns the offset of the thunk table within the section it is located
+ * @return the offset of the thunk table
*/
public int getThunkTableOffset() {
return offsetThunkTable;
}
/**
- * Returns the size of each thunk in the thunk table.
- * @return the size of a thunk.
+ * Returns the size of each thunk in the thunk table
+ * @return the size of a thunk
*/
public int getThunkSize() {
return thunkSize;
}
/**
- * Returns the overall length of the thunk table.
- * @return the thunk table length.
+ * Returns the overall length of the thunk table
+ * @return the thunk table length
*/
public int getThunkTableLength() {
return thunkTableLength;
}
/**
- * Returns the number of sections recorded for the program.
- * @return the number of sections.
+ * Returns the number of sections recorded for the program
+ * @return the number of sections
*/
public int getNumSections() {
return numSections;
@@ -113,7 +112,7 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
/**
* Returns the Offsets of symbols within the symbol table gotten from the address map. These
- * offsets to point to the size field of the symbols in the symbol table.
+ * offsets to point to the size field of the symbols in the symbol table
* @return offsets
*/
public List getAddressMapSymbolOffsets() {
@@ -124,31 +123,30 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
// Package-Protected Internals
//==============================================================================================
/**
- * Deserialize the {@link PublicSymbolInformation} from the appropriate stream in the Pdb.
- * @param streamNumber the stream number containing the information to deserialize.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws IOException On file seek or read, invalid parameters, bad file configuration, or
- * inability to read required bytes.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserialize the {@link PublicSymbolInformation} from the appropriate stream in the Pdb
+ * @param streamNumber the stream number containing the information to deserialize
+ * @throws IOException on file seek or read, invalid parameters, bad file configuration, or
+ * inability to read required bytes
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
@Override
- void deserialize(int streamNumber, TaskMonitor monitor)
+ void deserialize(int streamNumber)
throws IOException, PdbException, CancelledException {
- super.deserialize(streamNumber, monitor);
+ super.deserialize(streamNumber);
- PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber, monitor);
+ PdbByteReader reader = pdb.getReaderForStreamNumber(streamNumber);
deserializePubHeader(reader);
PdbByteReader hashReader = reader.getSubPdbByteReader(symbolHashLength);
- deserializeHashTable(hashReader, monitor);
+ deserializeHashTable(hashReader);
PdbByteReader addressMapReader = reader.getSubPdbByteReader(addressMapLength);
- deserializeAddressMap(addressMapReader, monitor);
+ deserializeAddressMap(addressMapReader);
PdbByteReader thunkMapReader = reader.getSubPdbByteReader(thunkMapLength);
- deserializeThunkMap(thunkMapReader, monitor);
+ deserializeThunkMap(thunkMapReader);
/*
* See note in {@link #deserializePubHeader(PdbByteReader)} regarding spurious data
@@ -161,19 +159,20 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
}
numSections = sectionMapLength / 8;
PdbByteReader sectionMapReader = reader.getSubPdbByteReader(sectionMapLength);
- deserializeSectionMap(sectionMapReader, monitor);
+ deserializeSectionMap(sectionMapReader);
// Organize the information
- generateSymbolsList(monitor);
+ generateSymbolsList();
}
/**
- * Debug method for dumping information from this {@link PublicSymbolInformation}.
- * @param writer {@link Writer} to which to dump the information.
- * @throws IOException Upon IOException writing to the {@link Writer}.
+ * Debug method for dumping information from this {@link PublicSymbolInformation}
+ * @param writer {@link Writer} to which to dump the information
+ * @throws IOException upon IOException writing to the {@link Writer}
+ * @throws CancelledException upon user cancellation
*/
@Override
- void dump(Writer writer) throws IOException {
+ void dump(Writer writer) throws IOException, CancelledException {
StringBuilder builder = new StringBuilder();
builder.append("PublicSymbolInformation-------------------------------------\n");
dumpPubHeader(builder);
@@ -193,23 +192,22 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
// Private Internals
//==============================================================================================
/**
- * Deserializes the Address Map for these public symbols.
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the Address Map for these public symbols
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
- private void deserializeAddressMap(PdbByteReader reader, TaskMonitor monitor)
+ private void deserializeAddressMap(PdbByteReader reader)
throws PdbException, CancelledException {
while (reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
addressMapSymbolOffsets.add((long) reader.parseInt());
}
}
/**
- * Debug method for dumping Address Map information from this {@link AbstractSymbolInformation}.
- * @param builder {@link StringBuilder} to which to dump the information.
+ * Debug method for dumping Address Map information from this {@link AbstractSymbolInformation}
+ * @param builder {@link StringBuilder} to which to dump the information
*/
private void dumpAddressMap(StringBuilder builder) {
builder.append("AddressMapSymbolOffsets-------------------------------------\n");
@@ -222,17 +220,16 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
}
/**
- * Deserializes the Thunk Map for these public symbols.
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the Thunk Map for these public symbols
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
- private void deserializeThunkMap(PdbByteReader reader, TaskMonitor monitor)
+ private void deserializeThunkMap(PdbByteReader reader)
throws PdbException, CancelledException {
int count = 0;
while (reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
int targetOffset = reader.parseInt();
int mapTableOffset = count * thunkSize + offsetThunkTable;
thunkTargetOffsetsByTableOffset.put(mapTableOffset, targetOffset);
@@ -240,8 +237,8 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
}
/**
- * Debug method for dumping Thunk Map information from this {@link AbstractSymbolInformation}.
- * @param builder {@link StringBuilder} to which to dump the information.
+ * Debug method for dumping Thunk Map information from this {@link AbstractSymbolInformation}
+ * @param builder {@link StringBuilder} to which to dump the information
*/
private void dumpThunkMap(StringBuilder builder) {
builder.append("ThunkMap----------------------------------------------------\n");
@@ -254,16 +251,15 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
}
/**
- * Deserializes the Section Map for these public symbols.
- * @param reader {@link PdbByteReader} containing the data buffer to process.
- * @param monitor {@link TaskMonitor} used for checking cancellation.
- * @throws PdbException Upon not enough data left to parse.
- * @throws CancelledException Upon user cancellation.
+ * Deserializes the Section Map for these public symbols
+ * @param reader {@link PdbByteReader} containing the data buffer to process
+ * @throws PdbException upon not enough data left to parse
+ * @throws CancelledException upon user cancellation
*/
- private void deserializeSectionMap(PdbByteReader reader, TaskMonitor monitor)
+ private void deserializeSectionMap(PdbByteReader reader)
throws PdbException, CancelledException {
while (reader.hasMore()) {
- monitor.checkCanceled();
+ pdb.checkCanceled();
int offset = reader.parseInt();
int section = reader.parseUnsignedShortVal();
reader.skip(2); // padding
@@ -272,22 +268,24 @@ public class PublicSymbolInformation extends AbstractSymbolInformation {
}
/**
- * Debug method for dumping Section Map information from this {@link AbstractSymbolInformation}.
- * @param builder {@link StringBuilder} to which to dump the information.
+ * Debug method for dumping Section Map information from this {@link AbstractSymbolInformation}
+ * @param builder {@link StringBuilder} to which to dump the information
+ * @throws CancelledException upon user cancellation
*/
- private void dumpSectionMap(StringBuilder builder) {
+ private void dumpSectionMap(StringBuilder builder) throws CancelledException {
builder.append("SectionMap--------------------------------------------------\n");
builder.append(
"numAbsoluteOffsetsBySectionNumber: " + absoluteOffsetsBySectionNumber.size() + "\n");
for (Map.Entry entry : absoluteOffsetsBySectionNumber.entrySet()) {
+ pdb.checkCanceled();
builder.append(String.format("0X%08X 0X%08X\n", entry.getKey(), entry.getValue()));
}
builder.append("\nEnd SectionMap----------------------------------------------\n");
}
/**
- * Debug method for dumping the {@link PublicSymbolInformation} header.
- * @param builder {@link StringBuilder} to which to dump the information.
+ * Debug method for dumping the {@link PublicSymbolInformation} header
+ * @param builder {@link StringBuilder} to which to dump the information
*/
private void dumpPubHeader(StringBuilder builder) {
builder.append("PublicSymbolInformationHeader-------------------------------\n");
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractSectionContribution.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution.java
similarity index 90%
rename from Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractSectionContribution.java
rename to Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution.java
index 3cb20ef537..6551fcdd01 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/AbstractSectionContribution.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution.java
@@ -22,7 +22,7 @@ package ghidra.app.util.bin.format.pdb2.pdbreader;
* We have intended to implement according to the Microsoft PDB API (source); see the API for
* truth.
*/
-public abstract class AbstractSectionContribution {
+public abstract class SectionContribution {
//==============================================================================================
// Internals
@@ -41,7 +41,7 @@ public abstract class AbstractSectionContribution {
//==============================================================================================
// API
//==============================================================================================
- public AbstractSectionContribution() {
+ public SectionContribution() {
}
public int getSection() {
@@ -69,15 +69,15 @@ public abstract class AbstractSectionContribution {
// Abstract Methods
//==============================================================================================
/**
- * Deserializes the Section Contribution.
- * @param reader {@link PdbByteReader} from which to deserialize the data.
- * @throws PdbException Upon not enough data left to parse.
+ * Deserializes the Section Contribution
+ * @param reader {@link PdbByteReader} from which to deserialize the data
+ * @throws PdbException upon not enough data left to parse
*/
abstract void deserialize(PdbByteReader reader) throws PdbException;
/**
- * Dumps the SectionContribution. This method is for debugging only.
- * @return {@link String} of pretty output.
+ * Dumps the SectionContribution. This method is for debugging only
+ * @return {@link String} of pretty output
*/
abstract String dumpInternals();
@@ -85,8 +85,8 @@ public abstract class AbstractSectionContribution {
// Package-Protected Internals
//==============================================================================================
/**
- * Dumps the Section Contribution. This method is for debugging only.
- * @return {@link String} of pretty output.
+ * Dumps the Section Contribution. This method is for debugging only
+ * @return {@link String} of pretty output
*/
String dump() {
StringBuilder builder = new StringBuilder();
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution1400.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution1400.java
index 56507c4375..244ea32b51 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution1400.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution1400.java
@@ -16,16 +16,15 @@
package ghidra.app.util.bin.format.pdb2.pdbreader;
/**
- * This class is the version of {@link AbstractSectionContribution} for Microsoft v14.00 PDB.
+ * This class is the version of {@link SectionContribution} for Microsoft v14.00 PDB.
*/
-public class SectionContribution1400 extends AbstractSectionContribution {
+public class SectionContribution1400 extends SectionContribution {
//==============================================================================================
// Abstract Methods
//==============================================================================================
@Override
void deserialize(PdbByteReader reader) throws PdbException {
- //System.out.println(reader.dump(0x200));
isect = reader.parseUnsignedShortVal();
reader.parseBytes(2); // I think there is padding here.
offset = reader.parseInt();
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution200.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution200.java
index 54d9c1968e..c0e1b91105 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution200.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution200.java
@@ -16,16 +16,15 @@
package ghidra.app.util.bin.format.pdb2.pdbreader;
/**
- * This class is the version of {@link AbstractSectionContribution} for Microsoft v2.00 PDB.
+ * This class is the version of {@link SectionContribution} for Microsoft v2.00 PDB.
*/
-public class SectionContribution200 extends AbstractSectionContribution {
+public class SectionContribution200 extends SectionContribution {
//==============================================================================================
// Abstract Methods
//==============================================================================================
@Override
void deserialize(PdbByteReader reader) throws PdbException {
- //System.out.println(reader.dump());
isect = reader.parseUnsignedShortVal();
offset = reader.parseInt();
length = reader.parseInt();
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution400.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution400.java
index 7272e80470..3a610d5a42 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution400.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution400.java
@@ -16,16 +16,15 @@
package ghidra.app.util.bin.format.pdb2.pdbreader;
/**
- * This class is the version of {@link AbstractSectionContribution} for Microsoft v4.00 PDB.
+ * This class is the version of {@link SectionContribution} for Microsoft v4.00 PDB.
*/
-public class SectionContribution400 extends AbstractSectionContribution {
+public class SectionContribution400 extends SectionContribution {
//==============================================================================================
// Abstract Methods
//==============================================================================================
@Override
void deserialize(PdbByteReader reader) throws PdbException {
- //System.out.println(reader.dump(0x200));
isect = reader.parseUnsignedShortVal();
reader.parseBytes(2); // I think there is padding here.
offset = reader.parseInt();
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution600.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution600.java
index 881b4ee12c..076cecde97 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution600.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SectionContribution600.java
@@ -16,16 +16,15 @@
package ghidra.app.util.bin.format.pdb2.pdbreader;
/**
- * This class is the version of {@link AbstractSectionContribution} for Microsoft v6.00 PDB.
+ * This class is the version of {@link SectionContribution} for Microsoft v6.00 PDB.
*/
-public class SectionContribution600 extends AbstractSectionContribution {
+public class SectionContribution600 extends SectionContribution {
//==============================================================================================
// Abstract Methods
//==============================================================================================
@Override
void deserialize(PdbByteReader reader) throws PdbException {
- //System.out.println(reader.dump(0x200));
isect = reader.parseUnsignedShortVal();
reader.parseBytes(2); // I think there is padding here.
offset = reader.parseInt();
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SymbolRecords.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SymbolRecords.java
index fcab933840..512e13f53b 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SymbolRecords.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb2/pdbreader/SymbolRecords.java
@@ -21,7 +21,6 @@ import java.util.*;
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractMsSymbol;
import ghidra.util.exception.CancelledException;
-import ghidra.util.task.TaskMonitor;
/**
* This class represents Symbol Records component of a PDB file. This class is only
@@ -37,8 +36,8 @@ public class SymbolRecords {
private List