Package ghidra.program.model.data
Interface DataOrganization
-
- All Known Implementing Classes:
DataOrganizationImpl
public interface DataOrganization
-
-
Field Summary
Fields Modifier and Type Field Description static int
NO_MAXIMUM_ALIGNMENT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearSizeAlignmentMap()
Remove all entries from the size alignment mapint
getAbsoluteMaxAlignment()
Gets the maximum alignment value that is allowed by this data organization.int
getAlignment(DataType dataType, int dtSize)
Determines the alignment value for the indicated data type.int
getAlignmentOffset(int minimumOffset, DataType dataType, int dtSize)
Determines the offset where the specified data type should be placed to be properly aligned.BitFieldPacking
getBitFieldPacking()
Get the composite bitfield packing information associated with this data organization.int
getCharSize()
int
getDefaultAlignment()
Gets the default alignment to be used for any data type that isn't a structure, union, array, pointer, type definition, and whose size isn't in the size/alignment map.int
getDefaultPointerAlignment()
Gets the default alignment to be used for a pointer that doesn't have size.int
getDoubleSize()
int
getFloatSize()
int
getForcedAlignment(DataType dataType)
java.lang.String
getIntegerCTypeApproximation(int size, boolean signed)
Returns the best fitting integer C-type whose size is less-than-or-equal to the specified size.int
getIntegerSize()
int
getLongDoubleSize()
int
getLongLongSize()
int
getLongSize()
int
getMachineAlignment()
Gets the maximum useful alignment for the target machineint
getPointerShift()
Shift amount affects interpretation of in-memory pointer values only and will also be reflected within instruction pcode.int
getPointerSize()
int
getShortSize()
int
getSizeAlignment(int size)
Gets the alignment that is defined for a data type of the indicated size if one is defined.int
getSizeAlignmentCount()
Gets the number of sizes that have an alignment specified.int[]
getSizes()
Gets the sizes that have an alignment specified.int
getWideCharSize()
boolean
isBigEndian()
boolean
isForcingAlignment(DataType dataType)
boolean
isSignedChar()
-
-
-
Field Detail
-
NO_MAXIMUM_ALIGNMENT
static final int NO_MAXIMUM_ALIGNMENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
isBigEndian
boolean isBigEndian()
- Returns:
- true if data stored big-endian byte order
-
getPointerSize
int getPointerSize()
- Returns:
- the size of a pointer data type in bytes.
-
getPointerShift
int getPointerShift()
Shift amount affects interpretation of in-memory pointer values only and will also be reflected within instruction pcode. A value of zero indicates that shifted-pointers are not supported.- Returns:
- the left shift amount for shifted-pointers.
-
isSignedChar
boolean isSignedChar()
- Returns:
- true if the "char" type is signed
-
getCharSize
int getCharSize()
- Returns:
- the size of a char (char) primitive data type in bytes.
-
getWideCharSize
int getWideCharSize()
- Returns:
- the size of a wide-char (wchar_t) primitive data type in bytes.
-
getShortSize
int getShortSize()
- Returns:
- the size of a short primitive data type in bytes.
-
getIntegerSize
int getIntegerSize()
- Returns:
- the size of a int primitive data type in bytes.
-
getLongSize
int getLongSize()
- Returns:
- the size of a long primitive data type in bytes.
-
getLongLongSize
int getLongLongSize()
- Returns:
- the size of a long long primitive data type in bytes.
-
getFloatSize
int getFloatSize()
- Returns:
- the size of a float primitive data type in bytes.
-
getDoubleSize
int getDoubleSize()
- Returns:
- the size of a double primitive data type in bytes.
-
getLongDoubleSize
int getLongDoubleSize()
- Returns:
- the size of a long double primitive data type in bytes.
-
getAbsoluteMaxAlignment
int getAbsoluteMaxAlignment()
Gets the maximum alignment value that is allowed by this data organization. When getting an alignment for any data type it will not exceed this value. If NO_MAXIMUM_ALIGNMENT is returned, the data organization isn't specifically limited.- Returns:
- the absolute maximum alignment or NO_MAXIMUM_ALIGNMENT
-
getMachineAlignment
int getMachineAlignment()
Gets the maximum useful alignment for the target machine- Returns:
- the machine alignment
-
getDefaultAlignment
int getDefaultAlignment()
Gets the default alignment to be used for any data type that isn't a structure, union, array, pointer, type definition, and whose size isn't in the size/alignment map.- Returns:
- the default alignment to be used if no other alignment can be determined for a data type.
-
getDefaultPointerAlignment
int getDefaultPointerAlignment()
Gets the default alignment to be used for a pointer that doesn't have size.- Returns:
- the default alignment for a pointer
-
getSizeAlignment
int getSizeAlignment(int size) throws NoValueException
Gets the alignment that is defined for a data type of the indicated size if one is defined.- Parameters:
size
- the size of the data type- Returns:
- the alignment of the data type.
- Throws:
NoValueException
- if there isn't an alignment defined for the indicated size.
-
getBitFieldPacking
BitFieldPacking getBitFieldPacking()
Get the composite bitfield packing information associated with this data organization.- Returns:
- composite bitfield packing information
-
clearSizeAlignmentMap
void clearSizeAlignmentMap()
Remove all entries from the size alignment map
-
getSizeAlignmentCount
int getSizeAlignmentCount()
Gets the number of sizes that have an alignment specified.- Returns:
- the number of sizes with an alignment mapped to them.
-
getSizes
int[] getSizes()
Gets the sizes that have an alignment specified.- Returns:
- the sizes with alignments mapped to them.
-
getIntegerCTypeApproximation
java.lang.String getIntegerCTypeApproximation(int size, boolean signed)
Returns the best fitting integer C-type whose size is less-than-or-equal to the specified size. "long long" will be returned for any size larger than "long long";- Parameters:
size
- integer sizesigned
- if false the unsigned modifier will be prepended.- Returns:
- the best fitting
-
getAlignment
int getAlignment(DataType dataType, int dtSize)
Determines the alignment value for the indicated data type. (i.e. how the data type gets aligned within other data types.) NOTE: the alignment of bitfields is dependent upon packing rules which must be considered at the composite level.- Parameters:
dataType
- the data typedtSize
- the data type's size or component size- Returns:
- the alignment
-
isForcingAlignment
boolean isForcingAlignment(DataType dataType)
-
getForcedAlignment
int getForcedAlignment(DataType dataType)
-
getAlignmentOffset
int getAlignmentOffset(int minimumOffset, DataType dataType, int dtSize)
Determines the offset where the specified data type should be placed to be properly aligned.- Parameters:
minimumOffset
- the minimum allowable offset where the data type can be placed.dataType
- the data typedtSize
- the data type's size- Returns:
- the aligned offset for the data type
-
-