mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-08-27 21:10:26 +00:00
GP-4572 - PDB - Fix misc: pointer type, notype symbol, unproc
primitives, symbol metrics
This commit is contained in:
parent
e51365c539
commit
da46d670ec
|
@ -130,10 +130,10 @@ public abstract class AbstractPointerMsType extends AbstractMsType {
|
|||
FUNCTION_VIRTUAL_INHERITANCE("pmf16_nearvbase", 7),
|
||||
FUNCTION_SINGLE_INHERITANCE_1632("pmf16_farnvsa", 8),
|
||||
FUNCTION_MULTIPLE_INHERITANCE_1632("pmf16_farnvma", 9),
|
||||
FUNCTION_VIRTUAL_INHERITANCE_1632("pmf16_farnvbase", 10),
|
||||
FUNCTION_VIRTUAL_INHERITANCE_1632("pmf16_farvbase", 10),
|
||||
FUNCTION_SINGLE_INHERITANCE_32("pmf32_nvsa", 11),
|
||||
FUNCTION_MULTIPLE_INHERITANCE_32("pmf32_nvma", 12),
|
||||
FUNCTION_VIRTUAL_INHERITANCE_32("pmf32_nvbase", 13);
|
||||
FUNCTION_VIRTUAL_INHERITANCE_32("pmf32_vbase", 13);
|
||||
|
||||
private static final Map<Integer, MemberPointerType> BY_VALUE = new HashMap<>();
|
||||
static {
|
||||
|
@ -327,8 +327,8 @@ public abstract class AbstractPointerMsType extends AbstractMsType {
|
|||
switch (pointerMode) {
|
||||
case MEMBER_DATA_POINTER:
|
||||
case MEMBER_FUNCTION_POINTER:
|
||||
pdb.getTypeRecord(memberPointerContainingClassRecordNumber).emit(builder,
|
||||
Bind.NONE);
|
||||
pdb.getTypeRecord(memberPointerContainingClassRecordNumber)
|
||||
.emit(builder, Bind.NONE);
|
||||
myBuilder.append(pointerMode);
|
||||
myBuilder.append(" <");
|
||||
myBuilder.append(memberPointerType);
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
*/
|
||||
package ghidra.app.util.pdb.pdbapplicator;
|
||||
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.MsSymbolIterator;
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.PdbException;
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.*;
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractDataMsSymbol;
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.AbstractMsSymbol;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
@ -83,7 +82,11 @@ public class DataSymbolApplier extends MsSymbolApplier
|
|||
}
|
||||
|
||||
boolean createData(Address address) throws CancelledException, PdbException {
|
||||
DataType dataType = applicator.getCompletedDataType(symbol.getTypeRecordNumber());
|
||||
RecordNumber typeRecordNumber = symbol.getTypeRecordNumber();
|
||||
if (typeRecordNumber.isNoType()) {
|
||||
return false;
|
||||
}
|
||||
DataType dataType = applicator.getCompletedDataType(typeRecordNumber);
|
||||
if (dataType == null) { // TODO: check that we can have null here.
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import ghidra.app.util.bin.format.pdb.PdbParserConstants;
|
|||
import ghidra.app.util.bin.format.pdb2.pdbreader.*;
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.*;
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.type.AbstractMsType;
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.type.PrimitiveMsType;
|
||||
import ghidra.app.util.bin.format.pe.cli.tables.CliAbstractTableRow;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.app.util.pdb.PdbCategories;
|
||||
|
@ -274,8 +275,7 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
* @throws PdbException upon error processing the PDB
|
||||
* @throws CancelledException upon user cancellation
|
||||
*/
|
||||
public void applyDataTypesAndMainSymbolsAnalysis()
|
||||
throws PdbException, CancelledException {
|
||||
public void applyDataTypesAndMainSymbolsAnalysis() throws PdbException, CancelledException {
|
||||
pdbAnalysisLookupState = getPdbAnalysisLookupState(program, true);
|
||||
doPdbPreWork();
|
||||
doPdbTypesAndMainSymbolsWork();
|
||||
|
@ -297,8 +297,7 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
* @throws PdbException upon error processing the PDB
|
||||
* @throws CancelledException upon user cancellation
|
||||
*/
|
||||
public void applyFunctionInternalsAnalysis()
|
||||
throws PdbException, CancelledException {
|
||||
public void applyFunctionInternalsAnalysis() throws PdbException, CancelledException {
|
||||
pdbAnalysisLookupState = getPdbAnalysisLookupState(program, true);
|
||||
doPdbPreWork();
|
||||
doPdbFunctionInternalsWork();
|
||||
|
@ -919,8 +918,16 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
}
|
||||
else if (dataType == null) {
|
||||
AbstractMsType type = getTypeRecord(recordNumber);
|
||||
throw new PdbException("Type not completed for record: " + recordNumber + "; " +
|
||||
type.getClass().getSimpleName());
|
||||
if (!(type instanceof PrimitiveMsType)) {
|
||||
throw new PdbException("Type not completed for record: " + recordNumber + "; " +
|
||||
type.getClass().getSimpleName());
|
||||
}
|
||||
multiphaseResolver.process(recordNumber);
|
||||
dataType = getDataType(recordNumber);
|
||||
if (dataType == null) {
|
||||
throw new PdbException(
|
||||
"Problem creating Primitive data type for record: " + recordNumber);
|
||||
}
|
||||
}
|
||||
return dataType;
|
||||
}
|
||||
|
@ -2347,8 +2354,8 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
symbol =
|
||||
program.getSymbolTable().createLabel(address, name, namespace, SourceType.IMPORTED);
|
||||
if (makePrimary && !symbol.isPrimary()) {
|
||||
SetLabelPrimaryCmd cmd = new SetLabelPrimaryCmd(address, symbol.getName(),
|
||||
symbol.getParentNamespace());
|
||||
SetLabelPrimaryCmd cmd =
|
||||
new SetLabelPrimaryCmd(address, symbol.getName(), symbol.getParentNamespace());
|
||||
cmd.applyTo(program);
|
||||
}
|
||||
}
|
||||
|
@ -2387,8 +2394,8 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
|
||||
private SymbolPath getCleanSymbolPath(String symbolPathString) {
|
||||
if (symbolPathString.startsWith(THUNK_NAME_PREFIX)) {
|
||||
symbolPathString = symbolPathString.substring(THUNK_NAME_PREFIX.length(),
|
||||
symbolPathString.length());
|
||||
symbolPathString =
|
||||
symbolPathString.substring(THUNK_NAME_PREFIX.length(), symbolPathString.length());
|
||||
}
|
||||
SymbolPath symbolPath = new SymbolPath(symbolPathString);
|
||||
symbolPath = symbolPath.replaceInvalidChars();
|
||||
|
|
|
@ -41,7 +41,7 @@ public class SymbolApplierFactory {
|
|||
|
||||
MsSymbolApplier getSymbolApplier(AbstractMsSymbol symbol, MsSymbolIterator iter) {
|
||||
MsSymbolApplier applier = getSymbolApplierInternal(symbol, iter);
|
||||
if (!(applier instanceof NoSymbolApplier)) {
|
||||
if (applier instanceof NoSymbolApplier) {
|
||||
applicator.getPdbApplicatorMetrics().witnessCannotApplySymbolType(symbol);
|
||||
}
|
||||
return applier;
|
||||
|
|
Loading…
Reference in a new issue