Corrected test issues and refined datatype conflict handling

This commit is contained in:
ghidra1 2020-06-04 11:33:33 -04:00
parent 76925e6342
commit 7f09488133
12 changed files with 202 additions and 183 deletions

View file

@ -268,7 +268,7 @@ abstract class DataTypeDB extends DatabaseObject implements DataType, ChangeList
}
protected DataType resolve(DataType dt) {
return resolve(dt, dataMgr.getCurrentConflictHandler());
return resolve(dt, dataMgr.getDependencyConflictHandler());
}
protected DataType resolve(DataType dt, DataTypeConflictHandler handler) {

View file

@ -812,7 +812,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
finally {
if (isResolveCacheOwner) {
flushResolveCacheAndClearQueue(handler);
flushResolveCacheAndClearQueue();
}
if (isEquivalenceCacheOwner) {
clearEquivalenceCache();
@ -909,7 +909,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
case REPLACE_EXISTING: // new type replaces old conflicted type
try {
if (updateExistingDataType(existingDataType, dataType, handler)) {
if (updateExistingDataType(existingDataType, dataType)) {
return existingDataType;
}
renameToUnusedConflictName(existingDataType);
@ -919,12 +919,14 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
replace(existingDataType, newDataType);
}
catch (DataTypeDependencyException e) {
throw new AssertException(e);
throw new IllegalArgumentException(
"Invalid datatype replacement: " + newDataType.getName(), e);
}
return newDataType;
}
catch (DataTypeDependencyException e) {
// fallthrough to RENAME_AND_ADD
// new type refers to old type - fallthrough to RENAME_AND_ADD
// TODO: alternatively we could throw an exception
}
case RENAME_AND_ADD: // default handler behavior
@ -970,13 +972,12 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
*
* @param existingDataType existing datatype
* @param dataType new datatype
* @param handler conflict handler
* @return true if replacment approach was successful, else false
* @throws DataTypeDependencyException if datatype contains dependency issues
* during resolve process
*/
private boolean updateExistingDataType(DataType existingDataType, DataType dataType,
DataTypeConflictHandler handler) throws DataTypeDependencyException {
private boolean updateExistingDataType(DataType existingDataType, DataType dataType)
throws DataTypeDependencyException {
// TODO: this approach could be added to other DB datatypes to avoid
// unnececesary creation and removal.
@ -987,7 +988,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return false;
}
StructureDB existingStruct = (StructureDB) existingDataType;
existingStruct.doReplaceWith((Structure) dataType, true, handler);
existingStruct.doReplaceWith((Structure) dataType, true);
return true;
}
else if (existingDataType instanceof UnionDB) {
@ -995,7 +996,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return false;
}
UnionDB existingUnion = (UnionDB) existingDataType;
existingUnion.doReplaceWith((Union) dataType, true, handler);
existingUnion.doReplaceWith((Union) dataType, true);
return true;
}
}
@ -1149,7 +1150,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
finally {
if (isResolveCacheOwner) {
flushResolveCacheAndClearQueue(handler);
flushResolveCacheAndClearQueue();
}
if (isEquivalenceCacheOwner) {
clearEquivalenceCache();
@ -1504,12 +1505,16 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
/**
* Get the current active datatype conflict handler
* Get the datatype conflict handler to be used when resolving
* datatype dependencies
*
* @return current active datatype conflict handler
* @return dependency datatype conflict handler
*/
DataTypeConflictHandler getCurrentConflictHandler() {
return currentHandler;
DataTypeConflictHandler getDependencyConflictHandler() {
if (currentHandler == null) {
return DataTypeConflictHandler.DEFAULT_HANDLER;
}
return currentHandler.getSubsequentHandler();
}
@Override
@ -2273,17 +2278,17 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
else if (dt instanceof Structure) {
Structure structure = (Structure) dt;
newDataType = createStructure(structure, name, cat, sourceArchiveIdValue,
id.getValue(), handler);
id.getValue());
}
else if (dt instanceof TypeDef) {
TypeDef typedef = (TypeDef) dt;
newDataType =
createTypeDef(typedef, name, cat, sourceArchiveIdValue, id.getValue(), handler);
createTypeDef(typedef, name, cat, sourceArchiveIdValue, id.getValue());
}
else if (dt instanceof Union) {
Union union = (Union) dt;
newDataType =
createUnion(union, name, cat, sourceArchiveIdValue, id.getValue(), handler);
createUnion(union, name, cat, sourceArchiveIdValue, id.getValue());
}
else if (dt instanceof Enum) {
Enum enumm = (Enum) dt;
@ -2292,7 +2297,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
else if (dt instanceof FunctionDefinition) {
FunctionDefinition funDef = (FunctionDefinition) dt;
newDataType = createFunctionDefinition(funDef, name, cat, sourceArchiveIdValue,
id.getValue(), handler);
id.getValue());
}
else if (dt instanceof BuiltInDataType) {
BuiltInDataType builtInDataType = (BuiltInDataType) dt;
@ -2316,7 +2321,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
private Structure createStructure(Structure struct, String name, CategoryDB category,
long sourceArchiveIdValue, long universalIdValue, DataTypeConflictHandler handler)
long sourceArchiveIdValue, long universalIdValue)
throws IOException {
try {
if (name == null || name.length() == 0) {
@ -2338,7 +2343,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
// Make sure category knows about structure before replace is performed
category.dataTypeAdded(structDB);
structDB.doReplaceWith(struct, false, handler);
structDB.doReplaceWith(struct, false);
structDB.setDescription(struct.getDescription());
// structDB.notifySizeChanged();
// doReplaceWith updated the last change time so set it back to what we want.
@ -2347,7 +2352,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return structDB;
}
catch (DataTypeDependencyException e) {
throw new AssertException(e); // unexpected for new type
throw new IllegalArgumentException("Invalid structure: " + struct.getName(), e);
}
finally {
creatingDataType--;
@ -2386,12 +2391,12 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
private TypeDef createTypeDef(TypeDef typedef, String name, Category cat,
long sourceArchiveIdValue, long universalIdValue, DataTypeConflictHandler handler)
long sourceArchiveIdValue, long universalIdValue)
throws IOException {
if (name == null || name.length() == 0) {
throw new IllegalArgumentException("Data type must have a valid name");
}
DataType dataType = resolve(typedef.getDataType(), handler);
DataType dataType = resolve(typedef.getDataType(), getDependencyConflictHandler());
Record record = typedefAdapter.createRecord(getID(dataType), name, cat.getID(),
sourceArchiveIdValue, universalIdValue, typedef.getLastChangeTime());
TypedefDB typedefDB = new TypedefDB(this, dtCache, typedefAdapter, record);
@ -2401,7 +2406,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
private Union createUnion(Union union, String name, CategoryDB category,
long sourceArchiveIdValue, long universalIdValue, DataTypeConflictHandler handler)
long sourceArchiveIdValue, long universalIdValue)
throws IOException {
if (name == null || name.length() == 0) {
throw new IllegalArgumentException("Data type must have a valid name");
@ -2417,7 +2422,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
// Make sure category knows about union before replace is performed
category.dataTypeAdded(unionDB);
unionDB.doReplaceWith(union, false, handler);
unionDB.doReplaceWith(union, false);
unionDB.setDescription(union.getDescription());
// unionDB.notifySizeChanged();
// doReplaceWith updated the last change time so set it back to what we want.
@ -2426,7 +2431,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return unionDB;
}
catch (DataTypeDependencyException e) {
throw new AssertException(e); // unexpected for new type
throw new IllegalArgumentException("Invalid union: " + union.getName(), e);
}
finally {
creatingDataType--;
@ -2658,8 +2663,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
private FunctionDefinition createFunctionDefinition(FunctionDefinition funDef, String name,
CategoryDB cat, long sourceArchiveIdValue, long universalIdValue,
DataTypeConflictHandler handler) throws IOException {
CategoryDB cat, long sourceArchiveIdValue, long universalIdValue) throws IOException {
if (name == null || name.length() == 0) {
throw new IllegalArgumentException("Data type must have a valid name");
}
@ -3750,7 +3754,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
replace(dataType, resolve(builtIn, null));
}
catch (DataTypeDependencyException e) {
throw new AssertException("Got DataTypeDependencyException on built in");
throw new AssertException("Got DataTypeDependencyException on built in", e);
}
}
}
@ -3787,7 +3791,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
resolveQueue.add(new ResolvePair(resolvedDt, definitionDt));
}
void flushResolveCacheAndClearQueue(DataTypeConflictHandler handler) {
void flushResolveCacheAndClearQueue() {
DataTypeConflictHandler handler = getDependencyConflictHandler();
while (!resolveQueue.isEmpty()) {
ResolvePair resolvePair = resolveQueue.pollFirst();
DataTypeDB resolvedDt = resolvePair.resolvedDt;

View file

@ -260,7 +260,7 @@ class FunctionDefinitionDB extends DataTypeDB implements FunctionDefinition {
for (int i = 0; i < args.length; i++) {
DataType type =
ParameterDefinitionImpl.validateDataType(args[i].getDataType(), dataMgr, false);
DataType resolvedDt = resolve(type, dataMgr.getCurrentConflictHandler());
DataType resolvedDt = resolve(type, dataMgr.getDependencyConflictHandler());
paramAdapter.createRecord(dataMgr.getID(resolvedDt), key, i, args[i].getName(),
args[i].getComment(), args[i].getLength());
resolvedDt.addParent(this);
@ -287,7 +287,7 @@ class FunctionDefinitionDB extends DataTypeDB implements FunctionDefinition {
if (type == null) {
type = DataType.DEFAULT;
}
DataType resolvedDt = resolve(type, dataMgr.getCurrentConflictHandler());
DataType resolvedDt = resolve(type, dataMgr.getDependencyConflictHandler());
record.setLongValue(FunctionDefinitionDBAdapter.FUNCTION_DEF_RETURN_ID_COL,
dataMgr.getID(resolvedDt));
funDefAdapter.updateRecord(record, true);
@ -472,7 +472,7 @@ class FunctionDefinitionDB extends DataTypeDB implements FunctionDefinition {
param.getDataType().removeParent(this);
paramAdapter.removeRecord(param.getKey());
}
DataType rdt = resolve(dt, dataMgr.getCurrentConflictHandler());
DataType rdt = resolve(dt, dataMgr.getDependencyConflictHandler());
rdt.addParent(this);
paramAdapter.createRecord(dataMgr.getID(rdt), key, ordinal, name, comment,
dt.getLength());

View file

@ -1158,7 +1158,7 @@ class StructureDB extends CompositeDB implements Structure {
boolean isResolveCacheOwner = dataMgr.activateResolveCache();
try {
checkDeleted();
doReplaceWith((Structure) dataType, true, dataMgr.getCurrentConflictHandler());
doReplaceWith((Structure) dataType, true);
}
catch (DataTypeDependencyException e) {
throw new IllegalArgumentException(e.getMessage(), e);
@ -1168,7 +1168,7 @@ class StructureDB extends CompositeDB implements Structure {
}
finally {
if (isResolveCacheOwner) {
dataMgr.flushResolveCacheAndClearQueue(null);
dataMgr.flushResolveCacheAndClearQueue();
}
lock.release();
}
@ -1179,15 +1179,16 @@ class StructureDB extends CompositeDB implements Structure {
*
* @param struct
* @param notify
* @param handler
* @return true if fully completed else false if pointer component post resolve
* required
* @throws DataTypeDependencyException
* @throws IOException
*/
void doReplaceWith(Structure struct, boolean notify, DataTypeConflictHandler handler)
void doReplaceWith(Structure struct, boolean notify)
throws DataTypeDependencyException, IOException {
DataTypeConflictHandler handler = dataMgr.getDependencyConflictHandler();
// pre-resolved component types to catch dependency issues early
DataTypeComponent flexComponent = struct.getFlexibleArrayComponent();
DataTypeComponent[] otherComponents = struct.getDefinedComponents();

View file

@ -250,22 +250,24 @@ class UnionDB extends CompositeDB implements Union {
boolean isResolveCacheOwner = dataMgr.activateResolveCache();
try {
checkDeleted();
doReplaceWith((Union) dataType, true, dataMgr.getCurrentConflictHandler());
doReplaceWith((Union) dataType, true);
}
catch (DataTypeDependencyException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
finally {
if (isResolveCacheOwner) {
dataMgr.flushResolveCacheAndClearQueue(null);
dataMgr.flushResolveCacheAndClearQueue();
}
lock.release();
}
}
void doReplaceWith(Union union, boolean notify, DataTypeConflictHandler handler)
void doReplaceWith(Union union, boolean notify)
throws DataTypeDependencyException {
DataTypeConflictHandler handler = dataMgr.getDependencyConflictHandler();
// pre-resolved component types to catch dependency issues early
DataTypeComponent[] otherComponents = union.getComponents();
DataType[] resolvedDts = new DataType[otherComponents.length];

View file

@ -15,8 +15,6 @@
*/
package ghidra.program.model.data;
import ghidra.util.Msg;
public abstract class DataTypeConflictHandler {
/**
@ -62,10 +60,10 @@ public abstract class DataTypeConflictHandler {
public final static DataTypeConflictHandler DEFAULT_HANDLER = new DataTypeConflictHandler() {
@Override
public ConflictResult resolveConflict(DataType addedDataType, DataType existingDataType) {
Msg.info(this,
"Conflict with existing type " + existingDataType.getName() + "(" +
existingDataType.getDescription() +
"), new type will be renamed with .conflict suffix");
// Msg.info(this,
// "Conflict with existing type " + existingDataType.getName() + "(" +
// existingDataType.getDescription() +
// "), new type will be renamed with .conflict suffix");
return ConflictResult.RENAME_AND_ADD;
}
@ -142,8 +140,8 @@ public abstract class DataTypeConflictHandler {
public final static DataTypeConflictHandler KEEP_HANDLER = new DataTypeConflictHandler() {
@Override
public ConflictResult resolveConflict(DataType addedDataType, DataType existingDataType) {
Msg.info(this, "New type not added in favor of existing type " +
existingDataType.getName() + "(" + existingDataType.getDescription() + ")");
// Msg.info(this, "New type not added in favor of existing type " +
// existingDataType.getName() + "(" + existingDataType.getDescription() + ")");
return ConflictResult.USE_EXISTING;
}

View file

@ -508,9 +508,9 @@ public class StructureDBTest extends AbstractGTest {
" 3 dword 4 field3 \"\"\n" +
" 7 byte 1 field4 \"Comment4\"\n" +
" 8 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 9 undefined 1 null \"\"\n" +
" 10 undefined 1 null \"\"\n" +
" 11 undefined 1 null \"\"\n" +
// " 9 undefined 1 null \"\"\n" +
// " 10 undefined 1 null \"\"\n" +
// " 11 undefined 1 null \"\"\n" +
"}\n" +
"Size = 12 Actual Alignment = 1", struct);
//@formatter:on
@ -527,9 +527,9 @@ public class StructureDBTest extends AbstractGTest {
" 7 byte 1 field4 \"Comment4\"\n" +
" 8 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 8 int:3(3) 1 bf2 \"bf2Comment\"\n" +
" 9 undefined 1 null \"\"\n" +
" 10 undefined 1 null \"\"\n" +
" 11 undefined 1 null \"\"\n" +
// " 9 undefined 1 null \"\"\n" +
// " 10 undefined 1 null \"\"\n" +
// " 11 undefined 1 null \"\"\n" +
"}\n" +
"Size = 12 Actual Alignment = 1", struct);
//@formatter:on
@ -547,8 +547,8 @@ public class StructureDBTest extends AbstractGTest {
" 8 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 8 int:3(3) 1 bf2 \"bf2Comment\"\n" +
" 9 byte:3(0) 1 bf3 \"bf3Comment\"\n" +
" 10 undefined 1 null \"\"\n" +
" 11 undefined 1 null \"\"\n" +
// " 10 undefined 1 null \"\"\n" +
// " 11 undefined 1 null \"\"\n" +
"}\n" +
"Size = 12 Actual Alignment = 1", struct);
//@formatter:on
@ -567,12 +567,12 @@ public class StructureDBTest extends AbstractGTest {
" 1 word 2 null \"Comment2\"\n" +
" 3 dword 4 field3 \"\"\n" +
" 7 byte 1 field4 \"Comment4\"\n" +
" 8 undefined 1 null \"\"\n" +
" 9 undefined 1 null \"\"\n" +
// " 8 undefined 1 null \"\"\n" +
// " 9 undefined 1 null \"\"\n" +
" 10 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 11 undefined 1 null \"\"\n" +
" 12 undefined 1 null \"\"\n" +
" 13 undefined 1 null \"\"\n" +
// " 11 undefined 1 null \"\"\n" +
// " 12 undefined 1 null \"\"\n" +
// " 13 undefined 1 null \"\"\n" +
"}\n" +
"Size = 14 Actual Alignment = 1", struct);
//@formatter:on
@ -587,13 +587,13 @@ public class StructureDBTest extends AbstractGTest {
" 1 word 2 null \"Comment2\"\n" +
" 3 dword 4 field3 \"\"\n" +
" 7 byte 1 field4 \"Comment4\"\n" +
" 8 undefined 1 null \"\"\n" +
" 9 undefined 1 null \"\"\n" +
// " 8 undefined 1 null \"\"\n" +
// " 9 undefined 1 null \"\"\n" +
" 10 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 10 int:3(3) 1 bf2 \"bf2Comment\"\n" +
" 11 undefined 1 null \"\"\n" +
" 12 undefined 1 null \"\"\n" +
" 13 undefined 1 null \"\"\n" +
// " 11 undefined 1 null \"\"\n" +
// " 12 undefined 1 null \"\"\n" +
// " 13 undefined 1 null \"\"\n" +
"}\n" +
"Size = 14 Actual Alignment = 1", struct);
//@formatter:on
@ -609,11 +609,11 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 3 undefined 1 null \"\"\n" +
" 4 undefined 1 null \"\"\n" +
" 5 undefined 1 null \"\"\n" +
// " 3 undefined 1 null \"\"\n" +
// " 4 undefined 1 null \"\"\n" +
// " 5 undefined 1 null \"\"\n" +
" 6 word 2 null \"Comment2\"\n" +
" 8 dword 4 field3 \"\"\n" +
" 12 byte 1 field4 \"Comment4\"\n" +
@ -628,12 +628,12 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(3) 1 bf2 \"bf2Comment\"\n" +
" 3 undefined 1 null \"\"\n" +
" 4 undefined 1 null \"\"\n" +
" 5 undefined 1 null \"\"\n" +
// " 3 undefined 1 null \"\"\n" +
// " 4 undefined 1 null \"\"\n" +
// " 5 undefined 1 null \"\"\n" +
" 6 word 2 null \"Comment2\"\n" +
" 8 dword 4 field3 \"\"\n" +
" 12 byte 1 field4 \"Comment4\"\n" +
@ -648,11 +648,11 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(3) 1 bf2 \"bf2Comment\"\n" +
" 2 int:15(6) 3 bf3 \"bf3Comment\"\n" +
" 5 undefined 1 null \"\"\n" +
// " 5 undefined 1 null \"\"\n" +
" 6 word 2 null \"Comment2\"\n" +
" 8 dword 4 field3 \"\"\n" +
" 12 byte 1 field4 \"Comment4\"\n" +
@ -676,7 +676,7 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(3) 1 bf2 \"bf2Comment\"\n" +
" 2 int:15(6) 3 bf3 \"bf3Comment\"\n" +
@ -695,7 +695,7 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:0(0) 1 \"zero bitfield\"\n" + // field name discarded
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(3) 1 bf2 \"bf2Comment\"\n" +
@ -730,11 +730,11 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(5) 1 bf1 \"bf1Comment\"\n" +
" 3 undefined 1 null \"\"\n" +
" 4 undefined 1 null \"\"\n" +
" 5 undefined 1 null \"\"\n" +
// " 3 undefined 1 null \"\"\n" +
// " 4 undefined 1 null \"\"\n" +
// " 5 undefined 1 null \"\"\n" +
" 6 word 2 null \"Comment2\"\n" +
" 8 dword 4 field3 \"\"\n" +
" 12 byte 1 field4 \"Comment4\"\n" +
@ -749,12 +749,12 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(5) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(2) 1 bf2 \"bf2Comment\"\n" +
" 3 undefined 1 null \"\"\n" +
" 4 undefined 1 null \"\"\n" +
" 5 undefined 1 null \"\"\n" +
// " 3 undefined 1 null \"\"\n" +
// " 4 undefined 1 null \"\"\n" +
// " 5 undefined 1 null \"\"\n" +
" 6 word 2 null \"Comment2\"\n" +
" 8 dword 4 field3 \"\"\n" +
" 12 byte 1 field4 \"Comment4\"\n" +
@ -769,11 +769,11 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(5) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(2) 1 bf2 \"bf2Comment\"\n" +
" 2 int:15(3) 3 bf3 \"bf3Comment\"\n" +
" 5 undefined 1 null \"\"\n" +
// " 5 undefined 1 null \"\"\n" +
" 6 word 2 null \"Comment2\"\n" +
" 8 dword 4 field3 \"\"\n" +
" 12 byte 1 field4 \"Comment4\"\n" +
@ -788,7 +788,7 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(5) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(2) 1 bf2 \"bf2Comment\"\n" +
" 2 int:15(3) 3 bf3 \"bf3Comment\"\n" +
@ -807,7 +807,7 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:0(7) 1 \"zero bitfield\"\n" + // field name discarded
" 2 int:3(5) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(2) 1 bf2 \"bf2Comment\"\n" +
@ -838,7 +838,7 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 float 4 null \"\"\n" +
" 6 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 6 int:3(3) 1 bf2 \"bf2Comment\"\n" +
@ -1083,9 +1083,9 @@ public class StructureDBTest extends AbstractGTest {
" 1 word 2 null \"Comment2\"\n" +
" 3 dword 4 field3 \"\"\n" +
" 7 byte 1 field4 \"Comment4\"\n" +
" 8 undefined 1 null \"\"\n" +
" 9 undefined 1 null \"\"\n" +
" 10 undefined 1 null \"\"\n" +
// " 8 undefined 1 null \"\"\n" +
// " 9 undefined 1 null \"\"\n" +
// " 10 undefined 1 null \"\"\n" +
"}\n" +
"Size = 11 Actual Alignment = 1", struct);
//@formatter:on
@ -1204,11 +1204,11 @@ public class StructureDBTest extends AbstractGTest {
" 1 word 2 null \"Comment2\"\n" +
" 3 dword 4 field3 \"\"\n" +
" 7 byte 1 field4 \"Comment4\"\n" +
" 8 undefined 1 null \"\"\n" +
// " 8 undefined 1 null \"\"\n" +
" 9 Foo:4(0) 1 MyBit1 \"bitComment1\"\n" +
" 9 Foo:3(4) 1 MyBit2 \"bitComment2\"\n" +
" 9 Foo:2(7) 2 MyBit3 \"bitComment3\"\n" +
" 11 undefined 1 null \"\"\n" +
// " 11 undefined 1 null \"\"\n" +
" Foo[0] 0 myFlex \"flexComment\"\n" +
"}\n" +
"Size = 12 Actual Alignment = 1", struct);
@ -1228,11 +1228,11 @@ public class StructureDBTest extends AbstractGTest {
" 1 word 2 null \"Comment2\"\n" +
" 3 dword 4 field3 \"\"\n" +
" 7 byte 1 field4 \"Comment4\"\n" +
" 8 undefined 1 null \"\"\n" +
// " 8 undefined 1 null \"\"\n" +
" 9 Foo:4(0) 1 MyBit1 \"bitComment1\"\n" +
" 9 Foo:3(4) 1 MyBit2 \"bitComment2\"\n" +
" 9 Foo:2(7) 2 MyBit3 \"bitComment3\"\n" +
" 11 undefined 1 null \"\"\n" +
// " 11 undefined 1 null \"\"\n" +
" Foo[0] 0 myFlex \"flexComment\"\n" +
"}\n" +
"Size = 12 Actual Alignment = 1", newStruct);
@ -1252,7 +1252,7 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(3) 1 bf2 \"bf2Comment\"\n" +
" 2 int:15(6) 3 bf3 \"bf3Comment\"\n" +
@ -1271,7 +1271,7 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 2 int:3(3) 1 bf2 \"bf2Comment\"\n" +
" 2 int:15(6) 3 bf3 \"bf3Comment\"\n" +
@ -1289,7 +1289,7 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 2 int:15(6) 3 bf3 \"bf3Comment\"\n" +
" 4 int:11(5) 2 bf4 \"bf4Comment\"\n" +
@ -1306,9 +1306,9 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 3 undefined 1 null \"\"\n" +
// " 3 undefined 1 null \"\"\n" +
" 4 int:11(5) 2 bf4 \"bf4Comment\"\n" +
" 6 dword 4 field3 \"\"\n" +
" 10 byte 1 field4 \"Comment4\"\n" +
@ -1323,11 +1323,11 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
" 2 int:3(0) 1 bf1 \"bf1Comment\"\n" +
" 3 undefined 1 null \"\"\n" +
" 4 undefined 1 null \"\"\n" +
" 5 undefined 1 null \"\"\n" +
// " 3 undefined 1 null \"\"\n" +
// " 4 undefined 1 null \"\"\n" +
// " 5 undefined 1 null \"\"\n" +
" 6 dword 4 field3 \"\"\n" +
" 10 byte 1 field4 \"Comment4\"\n" +
"}\n" +
@ -1341,11 +1341,11 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
" 2 undefined 1 null \"\"\n" +
" 3 undefined 1 null \"\"\n" +
" 4 undefined 1 null \"\"\n" +
" 5 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
// " 2 undefined 1 null \"\"\n" +
// " 3 undefined 1 null \"\"\n" +
// " 4 undefined 1 null \"\"\n" +
// " 5 undefined 1 null \"\"\n" +
" 6 dword 4 field3 \"\"\n" +
" 10 byte 1 field4 \"Comment4\"\n" +
"}\n" +
@ -1359,10 +1359,10 @@ public class StructureDBTest extends AbstractGTest {
"Unaligned\n" +
"Structure Test {\n" +
" 0 byte 1 field1 \"Comment1\"\n" +
" 1 undefined 1 null \"\"\n" +
" 2 undefined 1 null \"\"\n" +
" 3 undefined 1 null \"\"\n" +
" 4 undefined 1 null \"\"\n" +
// " 1 undefined 1 null \"\"\n" +
// " 2 undefined 1 null \"\"\n" +
// " 3 undefined 1 null \"\"\n" +
// " 4 undefined 1 null \"\"\n" +
" 5 dword 4 field3 \"\"\n" +
" 9 byte 1 field4 \"Comment4\"\n" +
"}\n" +