Package ghidra.program.model.pcode
Class PcodeDataTypeManager
java.lang.Object
ghidra.program.model.pcode.PcodeDataTypeManager
Class for marshaling DataType objects to and from the Decompiler.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodeDataType(Decoder decoder) Decode a data-type from the streamvoidencodeCompositeZeroSizePlaceholder(Encoder encoder, DataType type) Encode a Structure to the stream that has its size reported as zero.voidencodeCoreTypes(Encoder encoder) Encode the coretypes to the streamvoidencodeType(Encoder encoder, DataType type, int size) Encode information for a data-type to the streamvoidencodeTypeRef(Encoder encoder, DataType type, int size) Encode a reference to the given data-type to stream.voidencodeUnion(Encoder encoder, Union unionType) Encode a Union data-type to the streamfindBaseType(String nm, long id) Find a base/built-in data-type with the given name and/or id.static DataTypefindPointerRelativeInner(DataType base, int offset) Get the inner data-type being referred to by an offset from a relative/shifted pointer.voidsetNameTransformer(NameTransformer newTransformer)
-
Constructor Details
-
PcodeDataTypeManager
-
-
Method Details
-
getProgram
-
getNameTransformer
-
setNameTransformer
-
findBaseType
Find a base/built-in data-type with the given name and/or id. If an id is provided and a corresponding data-type exists, this data-type is returned. Otherwise the first built-in data-type with a matching name is returned- Parameters:
nm- name of data-typeid- is an optional data-type id number- Returns:
- the data-type object or null if no matching data-type exists
-
decodeDataType
Decode a data-type from the stream- Parameters:
decoder- is the stream decoder- Returns:
- the decoded data-type object
- Throws:
DecoderException- for invalid encodings
-
findPointerRelativeInner
Get the inner data-type being referred to by an offset from a relative/shifted pointer. Generally we expect the base of the relative pointer to be a structure and the offset refers to a (possibly nested) field. In this case, we return the data-type of the field. Otherwise return an "undefined" data-type.- Parameters:
base- is the base data-type of the relative pointeroffset- is the offset into the base data-type- Returns:
- the inner data-type
-
encodeUnion
Encode a Union data-type to the stream- Parameters:
encoder- is the stream encoderunionType- is the Union data-type- Throws:
IOException- for errors in the underlying stream
-
encodeCompositeZeroSizePlaceholder
Encode a Structure to the stream that has its size reported as zero.- Parameters:
encoder- is the stream encodertype- data type to encode- Throws:
IOException- for errors in the underlying stream
-
encodeTypeRef
Encode a reference to the given data-type to stream. Most data-types produce a<type>element, fully describing the data-type. Where possible a<typeref>element is produced, which just encodes the name of the data-type, deferring a full description of the data-type. For certain simple or nameless data-types, a<type>element is emitted giving a full description.- Parameters:
encoder- is the stream encodertype- is the data-type to be convertedsize- is the size in bytes of the specific instance of the data-type- Throws:
IOException- for errors in the underlying stream
-
encodeType
Encode information for a data-type to the stream- Parameters:
encoder- is the stream encodertype- is the data-type to encodesize- is the size of the data-type- Throws:
IOException- for errors in the underlying stream
-
encodeCoreTypes
Encode the coretypes to the stream- Parameters:
encoder- is the stream encoder- Throws:
IOException- for errors in the underlying stream
-