Merge remote-tracking branch

'origin/GP-1670_ghidra007_RecoveredClass_ReplaceInStructureBug--SQUASHED'
into patch

Conflicts:
	Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIGccClassRecoverer.java
	Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassHelper.java
This commit is contained in:
ghidra1
2022-01-24 17:07:32 -05:00
4 changed files with 119 additions and 125 deletions

View File

@@ -2906,13 +2906,9 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {
DataType classVftablePointer = vfPointerDataTypes.get(vftableAddress);
// simple case the offset for vftablePtr is 0
if (EditStructureUtils.canAdd(classStructureDataType, 0,
classVftablePointer.getLength(), monitor)) {
classStructureDataType =
EditStructureUtils.addDataTypeToStructure(classStructureDataType, 0,
classVftablePointer, CLASS_VTABLE_PTR_FIELD_EXT, monitor);
}
// if can fit or grow structure, add the vftablePtr to it
EditStructureUtils.addDataTypeToStructure(classStructureDataType, 0,
classVftablePointer, CLASS_VTABLE_PTR_FIELD_EXT, monitor);
}
// if single inheritance or multi non-virtual (wouldn't have called this method if
// it were virtually inherited) put parent struct and data into class struct
@@ -2953,12 +2949,10 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {
" : structure should exist but doesn't.");
}
if (EditStructureUtils.canAdd(classStructureDataType, parentOffset,
baseClassStructure.getLength(), monitor)) {
classStructureDataType = EditStructureUtils.addDataTypeToStructure(
classStructureDataType, parentOffset, baseClassStructure,
baseClassStructure.getName(), monitor);
}
// if it fits at offset or is at the end and class structure can be grown,
// copy the whole baseClass structure to the class Structure at the given offset
EditStructureUtils.addDataTypeToStructure(classStructureDataType, parentOffset,
baseClassStructure, baseClassStructure.getName(), monitor);
}
}
@@ -2977,8 +2971,10 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {
classStructureDataType, dataLen, dataOffset);
if (recoveredClassDataStruct != null) {
classStructureDataType = EditStructureUtils.addDataTypeToStructure(
classStructureDataType, dataOffset, recoveredClassDataStruct, "data", monitor);
// if it fits at offset or is at the end and class structure can be grown,
// copy the whole baseClass structure to the class Structure at the given offset
EditStructureUtils.addDataTypeToStructure(classStructureDataType, dataOffset,
recoveredClassDataStruct, "data", monitor);
}
}