GP-2964 corrected legacy program upgrade issues

This commit is contained in:
ghidra1 2022-12-20 17:20:49 -05:00
parent 982997256e
commit 63b22fd8fc
5 changed files with 17 additions and 10 deletions

View file

@ -30,7 +30,7 @@ class RelocationDBAdapterV1 extends RelocationDBAdapter {
private final static int V1_TYPE_COL = 0;
// final static Schema SCHEMA = new Schema(
// RelocationDBAdapterV4.VERSION, "Address", new Field[] { IntField.INSTANCE },
// RelocationDBAdapterV1.VERSION, "Address", new Field[] { IntField.INSTANCE },
// new String[] { "Type" });
private Table relocTable;

View file

@ -31,8 +31,7 @@ class RelocationDBAdapterV2 extends RelocationDBAdapter {
private final static int V2_VALUE_COL = 1;
// final static Schema SCHEMA = new Schema(
// RelocationDBAdapterV4.VERSION, "Address", new Field[] { IntField.INSTANCE,
// LongField.INSTANCE },
// RelocationDBAdapterV2.VERSION, "Address", new Field[] { IntField.INSTANCE, LongField.INSTANCE },
// new String[] { "Type", "Values" });
private Table relocTable;

View file

@ -33,9 +33,9 @@ class RelocationDBAdapterV3 extends RelocationDBAdapter {
private final static int V3_BYTES_COL = 2;
// final static Schema SCHEMA = new Schema(
// RelocationDBAdapterV4.VERSION, "Address", new Field[] { IntField.INSTANCE,
// LongField.INSTANCE, BinaryField.INSTANCE },
// new String[] { "Type", "Values", "Bytes" });
// RelocationDBAdapterV3.VERSION, "Address", new Field[] { IntField.INSTANCE,
// BinaryField.INSTANCE, BinaryField.INSTANCE },
// new String[] { "Type", "Values", "Bytes" });
private Table relocTable;
private AddressMap addrMap;
@ -94,8 +94,7 @@ class RelocationDBAdapterV3 extends RelocationDBAdapter {
DBRecord newRec = SCHEMA.createRecord(rec.getKey());
newRec.setLongValue(ADDR_COL, rec.getKey()); // key was encoded address
newRec.setIntValue(TYPE_COL, rec.getIntValue(V3_TYPE_COL));
long[] values = new long[] { rec.getLongValue(V3_VALUE_COL) };
newRec.setField(VALUE_COL, new BinaryCodedField(values));
newRec.setBinaryData(VALUE_COL, rec.getBinaryData(V3_VALUE_COL));
newRec.setBinaryData(BYTES_COL, rec.getBinaryData(V3_BYTES_COL));
return newRec;
}

View file

@ -24,8 +24,8 @@ public abstract class RefType {
//
// NOTE:
// When creating a new flow type, be sure
// to add code to the RefTypeFactory
// - When creating a new flow type, be sure to add code to the RefTypeFactory
// - Once a RefType value is defined it must be maintained for upgrade use
//
static final byte __INVALID = -2;
@ -68,6 +68,12 @@ public abstract class RefType {
static final byte __WRITE_IND = 105;
static final byte __READ_WRITE_IND = 106;
static final byte __UNKNOWNPARAM = 107;
@Deprecated
static final byte __STACK_READ = 110; // Use __READ instead - required for upgrade use
@Deprecated
static final byte __STACK_WRITE = 111; // Use __WRITE instead - required for upgrade use
static final byte __EXTERNAL_REF = 113;
static final byte __UNKNOWNDATA_IND = 114;

View file

@ -31,6 +31,7 @@ import ghidra.util.datastruct.IntObjectHashtable;
/**
* Factory class to create RefType objects.
*/
@SuppressWarnings("deprecation")
public class RefTypeFactory {
private static final IntObjectHashtable<RefType> REFTYPE_LOOKUP_BY_TYPE_MAP =
@ -73,6 +74,8 @@ public class RefTypeFactory {
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.READ_IND.getValue(), RefType.READ_IND);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.WRITE_IND.getValue(), RefType.WRITE_IND);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.READ_WRITE_IND.getValue(), RefType.READ_WRITE_IND);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.__STACK_READ, RefType.READ); // re-mapping required for upgrade use
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.__STACK_WRITE, RefType.WRITE); // re-mapping required for upgrade use
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.EXTERNAL_REF.getValue(), RefType.EXTERNAL_REF);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.__CALL_OVERRIDE_UNCONDITIONAL,
RefType.CALL_OVERRIDE_UNCONDITIONAL);