mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Merge remote-tracking branch 'origin/GP-3261_PartialUnionStripping'
This commit is contained in:
commit
2baf786689
2 changed files with 14 additions and 0 deletions
|
@ -19,6 +19,8 @@ import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import ghidra.program.model.pcode.PartialUnion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a structure from a "noisy" source of field information.
|
* Build a structure from a "noisy" source of field information.
|
||||||
* Feed it field records, either via addDataType(), when we
|
* Feed it field records, either via addDataType(), when we
|
||||||
|
@ -92,6 +94,11 @@ public class NoisyStructureBuilder {
|
||||||
dt = manager.getPointer(DataType.DEFAULT, dt.getLength());
|
dt = manager.getPointer(DataType.DEFAULT, dt.getLength());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (dt instanceof PartialUnion) {
|
||||||
|
// The decompiler can produce the internal data-type PartialUnion, which must
|
||||||
|
// be replaced with a suitable formal data-type within the structure being built
|
||||||
|
dt = ((PartialUnion) dt).getStrippedDataType();
|
||||||
|
}
|
||||||
computeMax(offset, dt.getLength());
|
computeMax(offset, dt.getLength());
|
||||||
Entry<Long, DataType> firstEntry = checkForOverlap(offset, dt.getLength());
|
Entry<Long, DataType> firstEntry = checkForOverlap(offset, dt.getLength());
|
||||||
if (firstEntry != null) {
|
if (firstEntry != null) {
|
||||||
|
|
|
@ -119,4 +119,11 @@ public class PartialUnion extends AbstractDataType {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a data-type that can be used as a formal replacement for this (internal) data-type
|
||||||
|
* @return a replacement data-type
|
||||||
|
*/
|
||||||
|
public DataType getStrippedDataType() {
|
||||||
|
return Undefined.getUndefinedDataType(size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue