Package ghidra.program.model.pcode
Class UnionFacetSymbol
java.lang.Object
ghidra.program.model.pcode.HighSymbol
ghidra.program.model.pcode.UnionFacetSymbol
A specialized HighSymbol that directs the decompiler to use a specific field of a union,
when interpreting a particular PcodeOp that accesses a Varnode whose data-type involves the
union. The symbol is stored as a dynamic variable annotation. The data-type must either be the
union itself or a pointer to the union. The firstUseOffset and dynamic hash
identify the particular PcodeOp and Varnode affected. The field number is the ordinal
of the desired field (DataTypeComponent) within the union. It is currently stored by
encoding it in the symbol name.
-
Field Summary
Fields inherited from class ghidra.program.model.pcode.HighSymbol
category, categoryIndex, dtmanage, entryList, function, ID_BASE, name, type
-
Constructor Summary
ConstructorDescriptionUnionFacetSymbol
(long uniqueId, String nm, DataType dt, int fldNum, HighFunction func) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
buildSymbolName
(int fldNum, Address addr) Generate an automatic symbol name, given a field number and addressvoid
Encode the symbol description as an element to the stream.static int
The actual field number is encoded in the symbol namestatic boolean
isUnionType
(DataType dt) Return true if the given data-type is either a union or a pointer to a union and is suitable for being the data-type of UnionFacetSymbolMethods inherited from class ghidra.program.model.pcode.HighSymbol
addMapEntry, decode, decodeHeader, decodeMapSym, encodeHeader, encodeMapSym, getCategoryIndex, getDataType, getFirstUseOffset, getFirstWholeMap, getHighFunction, getHighVariable, getId, getMutability, getName, getNamespace, getPCAddress, getProgram, getSize, getStorage, getSymbol, isGlobal, isHiddenReturn, isIsolated, isNameLocked, isParameter, isThisPointer, isTypeLocked, setCategory, setNameLock, setTypeLock
-
Field Details
-
BASENAME
-
-
Constructor Details
-
UnionFacetSymbol
-
-
Method Details
-
encode
Description copied from class:HighSymbol
Encode the symbol description as an element to the stream. This does NOT save the mappings.- Overrides:
encode
in classHighSymbol
- Parameters:
encoder
- is the stream encoder- Throws:
IOException
- for errors in the underlying stream
-
buildSymbolName
Generate an automatic symbol name, given a field number and address- Parameters:
fldNum
- is the field numberaddr
- is the Address- Returns:
- the name
-
extractFieldNumber
The actual field number is encoded in the symbol name- Parameters:
nm
- is the symbol name- Returns:
- the field number or -1 if we cannot parse
-
isUnionType
Return true if the given data-type is either a union or a pointer to a union and is suitable for being the data-type of UnionFacetSymbol- Parameters:
dt
- is the given data-type- Returns:
- true if the data-type is a union or a pointer to a union
-