BitFields - added direct parse support of bitfield entry within

composite.  Restrict use of bitfield datatype.
This commit is contained in:
ghidra1 2019-05-14 14:30:41 -04:00
parent 5ac462441a
commit 1fcad78bc4
13 changed files with 153 additions and 43 deletions

View file

@ -72,6 +72,10 @@ public class ArrayDataType extends DataTypeImpl implements Array {
}
private void validate(DataType dt) {
if (dt instanceof BitFieldDataType) {
throw new IllegalArgumentException(
"Array data-type may not be a bitfield: " + dt.getName());
}
if (dt instanceof FactoryDataType) {
throw new IllegalArgumentException(
"Array data-type may not be a Factory data-type: " + dt.getName());

View file

@ -90,7 +90,7 @@ public class BitFieldDataType extends AbstractDataType {
/**
* Construct a bit-field type based upon a supported baseDataType.
* @param baseDataType a supported primitive integer data type or TypeDef to such a type.
* A deep clone of this type will be performed using the specified dataMgr.
* The baseType must already be cloned to the target datatype manager.
* @param bitSize size of bit-field expressed as number of bits
* @throws InvalidDataTypeException if specified baseDataType is not permitted
*/

View file

@ -112,6 +112,11 @@ public class PointerDataType extends BuiltIn implements Pointer {
public PointerDataType(DataType referencedDataType, int length, DataTypeManager dtm) {
super(referencedDataType != null ? referencedDataType.getCategoryPath() : null,
constructUniqueName(referencedDataType, length), dtm);
if (referencedDataType instanceof BitFieldDataType) {
throw new IllegalArgumentException(
"Pointer reference data-type may not be a bitfield: " +
referencedDataType.getName());
}
this.length = length <= 0 ? -1 : length;
this.referencedDataType = referencedDataType;
if (referencedDataType != null) {

View file

@ -75,6 +75,10 @@ public class TypedefDataType extends GenericDataType implements TypeDef {
}
private void validate(DataType dt) {
if (dt instanceof BitFieldDataType) {
throw new IllegalArgumentException(
"TypeDef data-type may not be a bitfield: " + dt.getName());
}
if (dt instanceof FactoryDataType) {
throw new IllegalArgumentException(
"TypeDef data-type may not be a Factory data-type: " + dt.getName());