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.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidThrow out any temporary ids (from previous function decompilation) and reset the counter.decodeDataType(Decoder decoder) Decode a data-type from the streamvoidencodeCompositePlaceholder(Encoder encoder, DataType type) Encode a Structure/Union to the stream without listing its fieldsvoidencodeCoreTypes(Encoder encoder) Encode the core data-types 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.static intgetMetatype(DataType tp) Get the decompiler meta-type associated with a data-type.static intgetMetatype(String metaString) Convert an XML marshaling string to a metatype codestatic StringgetMetatypeString(int meta) Convert a decompiler metatype code to a string for XML marshalingvoidsetNameTransformer(NameTransformer newTransformer) 
- 
Field Details- 
TYPE_VOIDpublic static final int TYPE_VOID- See Also:
 
- 
TYPE_UNKNOWNpublic static final int TYPE_UNKNOWN- See Also:
 
- 
TYPE_INTpublic static final int TYPE_INT- See Also:
 
- 
TYPE_UINTpublic static final int TYPE_UINT- See Also:
 
- 
TYPE_BOOLpublic static final int TYPE_BOOL- See Also:
 
- 
TYPE_CODEpublic static final int TYPE_CODE- See Also:
 
- 
TYPE_FLOATpublic static final int TYPE_FLOAT- See Also:
 
- 
TYPE_PTRpublic static final int TYPE_PTR- See Also:
 
- 
TYPE_PTRRELpublic static final int TYPE_PTRREL- See Also:
 
- 
TYPE_ARRAYpublic static final int TYPE_ARRAY- See Also:
 
- 
TYPE_STRUCTpublic static final int TYPE_STRUCT- See Also:
 
- 
TYPE_UNIONpublic static final int TYPE_UNION- See Also:
 
 
- 
- 
Constructor Details- 
PcodeDataTypeManager
 
- 
- 
Method Details- 
getProgram
- 
getNameTransformer
- 
setNameTransformer
- 
findBaseTypeFind 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-type
- id- is an optional data-type id number
- Returns:
- the data-type object or null if no matching data-type exists
 
- 
decodeDataTypeDecode a data-type from the stream- Parameters:
- decoder- is the stream decoder
- Returns:
- the decoded data-type object
- Throws:
- DecoderException- for invalid encodings
 
- 
findPointerRelativeInnerGet 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 pointer
- offset- is the offset into the base data-type
- Returns:
- the inner data-type
 
- 
encodeUnionEncode a Union data-type to the stream- Parameters:
- encoder- is the stream encoder
- unionType- is the Union data-type
- Throws:
- IOException- for errors in the underlying stream
 
- 
encodeCompositePlaceholderEncode a Structure/Union to the stream without listing its fields- Parameters:
- encoder- is the stream encoder
- type- data type to encode
- Throws:
- IOException- for errors in the underlying stream
 
- 
encodeTypeRefEncode 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 encoder
- type- is the data-type to be converted
- size- is the size in bytes of the specific instance of the data-type
- Throws:
- IOException- for errors in the underlying stream
 
- 
clearTemporaryIdspublic void clearTemporaryIds()Throw out any temporary ids (from previous function decompilation) and reset the counter.
- 
encodeTypeEncode information for a data-type to the stream- Parameters:
- encoder- is the stream encoder
- type- is the data-type to encode
- size- is the size of the data-type
- Throws:
- IOException- for errors in the underlying stream
 
- 
encodeCoreTypesEncode the core data-types to the stream- Parameters:
- encoder- is the stream encoder
- Throws:
- IOException- for errors in the underlying stream
 
- 
getMetatypeGet the decompiler meta-type associated with a data-type.- Parameters:
- tp- is the data-type
- Returns:
- the meta-type
 
- 
getMetatypeConvert an XML marshaling string to a metatype code- Parameters:
- metaString- is the string
- Returns:
- the metatype code
- Throws:
- XmlParseException- if the string does not represent a valid metatype
 
- 
getMetatypeStringConvert a decompiler metatype code to a string for XML marshaling- Parameters:
- meta- is the metatype
- Returns:
- the marshaling string
- Throws:
- IOException- is the metatype is invalid
 
 
-