Better handle undefined types in mangling script

This commit is contained in:
KeybadeBlox 2026-02-11 20:17:22 -05:00
parent e9b0c3c6bc
commit 55046bf009

View file

@ -38,6 +38,7 @@ import ghidra.program.model.data.StringDataInstance;
import ghidra.program.model.data.Structure;
import ghidra.program.model.data.TerminatedUnicodeDataType;
import ghidra.program.model.data.TypeDef;
import ghidra.program.model.data.Undefined;
import ghidra.program.model.data.Union;
import ghidra.program.model.data.UnsignedCharDataType;
import ghidra.program.model.data.UnsignedIntegerDataType;
@ -305,7 +306,7 @@ public class MSVC7Mangle extends GhidraScript{
*/
if (t == null) throw new Exception (
"A data type was reported as null. Ensure that all " +
"data types in the demangled code/data have been " +
"data types in the code/data to mangle have been " +
"defined."
);
@ -336,7 +337,8 @@ public class MSVC7Mangle extends GhidraScript{
case Array a -> "PA" + mangleArrDims(a) + mangleType(arrType(a), dict);
case FunctionSignature f -> mangleFnType(f, dict);
case TypeDef d -> mangleType(d.getBaseDataType(), dict);
case DefaultDataType _ -> throw new Exception ("Encountered data marked \"undefined\". All data types must be defined.");
case DefaultDataType _ -> throw new Exception ("Encountered data marked \"undefined\". Ensure that all data types in the code/data to mangle have been defined.");
case Undefined _ -> throw new Exception ("Encountered data marked \"undefined\". Ensure that all data types in the code/data to mangle have been defined.");
default -> throw new Exception ("Unknown type \"" + t.getClass().getName() + "\"");
};
}