mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
BitFields - corrections to structure editor actions and some packing
fixes
This commit is contained in:
parent
55238b0393
commit
fab75940bd
18 changed files with 435 additions and 220 deletions
|
@ -295,7 +295,8 @@ public class DataTypeEditorsScreenShots extends GhidraScreenShotGenerator {
|
|||
waitForBusyTool(tool);
|
||||
}
|
||||
|
||||
private void createAlignedDetailedStructure(long address, boolean includeFlexArray) {
|
||||
private void createAlignedDetailedStructure(long address,
|
||||
boolean includeBitFieldsAndFlexArray) {
|
||||
|
||||
goToListing(address);
|
||||
|
||||
|
@ -303,17 +304,27 @@ public class DataTypeEditorsScreenShots extends GhidraScreenShotGenerator {
|
|||
struct.add(new ByteDataType(), "myByteElement", "alignment 1");
|
||||
struct.add(new ByteDataType(), "", "This is my undefined element");
|
||||
struct.add(new WordDataType(), "myWordElement", "alignment 2");
|
||||
if (includeBitFieldsAndFlexArray) {
|
||||
try {
|
||||
struct.addBitField(ByteDataType.dataType, 1, "myBitField1", "alignment 1");
|
||||
struct.addBitField(ByteDataType.dataType, 2, "myBitField2", "alignment 1");
|
||||
struct.addBitField(ByteDataType.dataType, 3, "myBitField3", "alignment 1");
|
||||
}
|
||||
catch (InvalidDataTypeException e) {
|
||||
failWithException("Unexpected Error", e);
|
||||
}
|
||||
}
|
||||
struct.add(new ByteDataType(), "myByteElement2", "alignment 1");
|
||||
struct.add(new DWordDataType(), "myDWordElement", "alignment 4");
|
||||
if (includeFlexArray) {
|
||||
if (includeBitFieldsAndFlexArray) {
|
||||
struct.setFlexibleArrayComponent(CharDataType.dataType, "flex",
|
||||
"unsized flexible array");
|
||||
}
|
||||
struct.clearComponent(1);
|
||||
struct.setDescription(
|
||||
"Members internally aligned " + (includeFlexArray ? "with a flexible char array"
|
||||
struct.setDescription("Members internally aligned " +
|
||||
(includeBitFieldsAndFlexArray ? "with bitfields and a flexible char array"
|
||||
: "according to their alignment size") +
|
||||
". ");
|
||||
". ");
|
||||
struct.setInternallyAligned(true);
|
||||
|
||||
CreateDataCmd createDataCmd = new CreateDataCmd(addr(address), struct);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue