mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Merge remote-tracking branch 'origin/GP-2470_EnumVariants' (#2581)
This commit is contained in:
commit
4cbc94d960
21 changed files with 1176 additions and 706 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue