From 053097616a26d30c2d6ea1501dc462a1dca3d4d5 Mon Sep 17 00:00:00 2001 From: caheckman <48068198+caheckman@users.noreply.github.com> Date: Tue, 7 Nov 2023 21:18:02 +0000 Subject: [PATCH] GP-4020 Send core data-type id as unsigned --- Ghidra/Features/Decompiler/src/decompile/cpp/type.cc | 2 +- .../ghidra/program/model/pcode/PcodeDataTypeManager.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc index 118bf74e9a..0c16011bf1 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc @@ -3021,7 +3021,7 @@ Datatype *TypeFactory::findAdd(Datatype &ct) if (ct.name.size()!=0) { // If there is a name if (ct.id == 0) // There must be an id - throw LowlevelError("Datatype must have a valid id"); + throw LowlevelError("Datatype must have a valid id: "+ct.name); res = findByIdLocal(ct.name,ct.id); // Lookup type by it if (res != (Datatype *)0) { // If a type has this name if (0!=res->compareDependency( ct )) // Check if it is the same type diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/PcodeDataTypeManager.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/PcodeDataTypeManager.java index 2207edb9e0..9b9c3c1dc9 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/PcodeDataTypeManager.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/PcodeDataTypeManager.java @@ -1215,7 +1215,7 @@ public class PcodeDataTypeManager { } /** - * Encode the coretypes to the stream + * Encode the core data-types to the stream * @param encoder is the stream encoder * @throws IOException for errors in the underlying stream */ @@ -1233,8 +1233,7 @@ public class PcodeDataTypeManager { if (typeMap.isUtf) { encoder.writeBool(ATTRIB_UTF, true); } - // Encode special id ( <0 for builtins ) - encoder.writeSignedInteger(ATTRIB_ID, typeMap.id); + encoder.writeUnsignedInteger(ATTRIB_ID, typeMap.id); encoder.closeElement(ELEM_TYPE); } encoder.closeElement(ELEM_CORETYPES);