mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
BitFields - added direct parse support of bitfield entry within
composite. Restrict use of bitfield datatype.
This commit is contained in:
parent
5ac462441a
commit
1fcad78bc4
13 changed files with 153 additions and 43 deletions
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue