Merge remote-tracking branch 'origin/GP-119_FillOutStructureRedux'

This commit is contained in:
ghidravore 2020-09-04 14:07:11 -04:00
commit 17d5a14d42
3 changed files with 85 additions and 1 deletions

View file

@ -91,10 +91,22 @@ public enum MetaDataType {
return aCopy;
}
if (aMeta == MetaDataType.PTR) {
if (a instanceof TypeDef) {
a = ((TypeDef) a).getBaseDataType();
}
if (b instanceof TypeDef) {
b = ((TypeDef) b).getBaseDataType();
}
a = ((Pointer) a).getDataType();
b = ((Pointer) b).getDataType();
}
else if (aMeta == MetaDataType.ARRAY) {
if (a instanceof TypeDef) {
a = ((TypeDef) a).getBaseDataType();
}
if (b instanceof TypeDef) {
b = ((TypeDef) b).getBaseDataType();
}
if (!(a instanceof Array) || !(b instanceof Array)) {
break;
}

View file

@ -79,10 +79,16 @@ public class NoisyStructureBuilder {
* @param dt is the data-type of field if known (null otherwise)
*/
public void addDataType(long offset, DataType dt) {
if (dt == null) {
if (dt == null || dt instanceof VoidDataType) {
computeMax(offset, 1);
return;
}
if (dt instanceof Pointer && ((Pointer) dt).getDataType().equals(structDT)) {
// Be careful of taking a pointer to the structure when the structure
// is not fully defined
DataTypeManager manager = dt.getDataTypeManager();
dt = manager.getPointer(DataType.DEFAULT, dt.getLength());
}
computeMax(offset, dt.getLength());
Entry<Long, DataType> firstEntry = checkForOverlap(offset, dt.getLength());
if (firstEntry != null) {