Merge remote-tracking branch 'origin/GP-2470_EnumVariants' (#2581)

This commit is contained in:
Ryan Kurtz 2024-11-18 06:24:24 -05:00
commit 4cbc94d960
21 changed files with 1176 additions and 706 deletions

View file

@ -114,7 +114,7 @@ public record AttributeId(String name, int id) {
public static final AttributeId ATTRIB_ARRAYSIZE = new AttributeId("arraysize", 48);
public static final AttributeId ATTRIB_CHAR = new AttributeId("char", 49);
public static final AttributeId ATTRIB_CORE = new AttributeId("core", 50);
public static final AttributeId ATTRIB_ENUM = new AttributeId("enum", 51);
// public static final AttributeId ATTRIB_ENUM = new AttributeId("enum", 51); // deprecated
public static final AttributeId ATTRIB_INCOMPLETE = new AttributeId("incomplete", 52);
// public static final AttributeId ATTRIB_ENUMSIZE = new AttributeId("enumsize", 53); // deprecated
// public static final AttributeId ATTRIB_INTSIZE = new AttributeId("intsize", 54); // deprecated

View file

@ -278,6 +278,13 @@ public class PcodeDataTypeManager {
decoder.closeElement(el);
return new PartialUnion(progDataTypes, dt, offset, size);
}
else if (meta.equals("partenum")) {
int size = (int) decoder.readSignedInteger(ATTRIB_SIZE);
// int offset = (int) decoder.readSignedInteger(ATTRIB_OFFSET);
// DataType dt = decodeDataType(decoder);
decoder.closeElementSkipping(el);
return AbstractIntegerDataType.getUnsignedDataType(size, progDataTypes);
}
else { // We typically reach here if the decompiler invents a new type
// probably an unknown with a non-standard size
int size = (int) decoder.readSignedInteger(ATTRIB_SIZE);
@ -541,11 +548,10 @@ public class PcodeDataTypeManager {
private void encodeEnum(Encoder encoder, Enum type, int size) throws IOException {
encoder.openElement(ELEM_TYPE);
encodeNameIdAttributes(encoder, type);
String metatype = type.isSigned() ? "int" : "uint";
String metatype = type.isSigned() ? "enum_int" : "enum_uint";
String[] names = type.getNames();
encoder.writeString(ATTRIB_METATYPE, metatype);
encoder.writeSignedInteger(ATTRIB_SIZE, type.getLength());
encoder.writeBool(ATTRIB_ENUM, true);
for (String name : names) {
encoder.openElement(ELEM_VAL);
encoder.writeString(ATTRIB_NAME, name);