Package ghidra.program.database.function
Class ReturnParameterDB
- java.lang.Object
-
- ghidra.program.database.function.VariableDB
-
- ghidra.program.database.function.ReturnParameterDB
-
public class ReturnParameterDB extends VariableDB
-
-
Field Summary
-
Fields inherited from class ghidra.program.database.function.VariableDB
function, functionMgr, storage, symbol
-
Fields inherited from interface ghidra.program.model.listing.Parameter
RETURN_NAME, RETURN_ORIDINAL, UNASSIGNED_ORDINAL
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AutoParameterTypegetAutoParameterType()If this is an auto-parameter this method will indicate its type.java.lang.StringgetComment()Get the Comment for this variableDataTypegetDataType()Get the Data Type of this variableintgetFirstUseOffset()DataTypegetFormalDataType()Get the original formal signature data type before a possible forced indirect was possibly imposed by the functions calling convention.java.lang.StringgetName()Get the Name of this variable or null if not assigned or not-applicableintgetOrdinal()Returns the ordinal (index) of this parameter within the function signature.SourceTypegetSource()Get the source of this variableVariableStoragegetVariableStorage()Get the variable storage associated with this variable.booleanhasAssignedStorage()booleanisAutoParameter()booleanisForcedIndirect()If this parameter which was forced by the associated calling convention to be passed as a pointer instead of its original formal type.voidsetComment(java.lang.String comment)Set the comment for this variablevoidsetDataType(DataType type, boolean alignStack, boolean force, SourceType source)Set the Data Type of this variable.voidsetDataType(DataType type, VariableStorage newStorage, boolean force, SourceType source)Set the Data Type of this variable and the associated storage whose size matches the data type length.voidsetDataType(DataType type, SourceType source)Set the Data Type of this variable using the default alignment behavior (implementation specific).voidsetName(java.lang.String name, SourceType source)Set the name of this variable.-
Methods inherited from class ghidra.program.database.function.VariableDB
compareTo, equals, getFirstStorageVarnode, getFunction, getLastStorageVarnode, getLength, getMinAddress, getProgram, getRegister, getRegisters, getStackOffset, getSymbol, hashCode, hasStackStorage, isCompoundVariable, isEquivalent, isMemoryVariable, isRegisterVariable, isStackVariable, isUniqueVariable, isValid, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ghidra.program.model.listing.Variable
getFirstStorageVarnode, getFunction, getLastStorageVarnode, getLength, getMinAddress, getProgram, getRegister, getRegisters, getStackOffset, getSymbol, hasStackStorage, isCompoundVariable, isEquivalent, isMemoryVariable, isRegisterVariable, isStackVariable, isUniqueVariable, isValid
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:VariableGet the Name of this variable or null if not assigned or not-applicable- Specified by:
getNamein interfaceVariable- Overrides:
getNamein classVariableDB- Returns:
- the name of the variable
-
setName
public void setName(java.lang.String name, SourceType source) throws DuplicateNameException, InvalidInputExceptionDescription copied from interface:VariableSet the name of this variable.- Specified by:
setNamein interfaceVariable- Overrides:
setNamein classVariableDB- Parameters:
name- the namesource- the source of this variable name- Throws:
DuplicateNameException- if the name collides with the name of another variable.InvalidInputException- if name contains blank characters, is zero length, or is null
-
getComment
public java.lang.String getComment()
Description copied from interface:VariableGet the Comment for this variable- Specified by:
getCommentin interfaceVariable- Overrides:
getCommentin classVariableDB- Returns:
- the comment
-
setComment
public void setComment(java.lang.String comment)
Description copied from interface:VariableSet the comment for this variable- Specified by:
setCommentin interfaceVariable- Overrides:
setCommentin classVariableDB- Parameters:
comment- the comment
-
getOrdinal
public final int getOrdinal()
Description copied from interface:ParameterReturns the ordinal (index) of this parameter within the function signature.- Specified by:
getOrdinalin interfaceParameter- See Also:
ghidra.program.database.function.model.Parameter#getOrdinal()
-
setDataType
public void setDataType(DataType type, VariableStorage newStorage, boolean force, SourceType source) throws InvalidInputException, VariableSizeException
Description copied from interface:VariableSet the Data Type of this variable and the associated storage whose size matches the data type length.NOTE: The storage and source are ignored if the function does not have custom storage enabled.
- Specified by:
setDataTypein interfaceVariable- Overrides:
setDataTypein classVariableDB- Parameters:
type- the data typenewStorage- properly sized storage for the new data typeforce- overwrite conflicting variablessource- variable storage source (used only for function parameters and return)- Throws:
InvalidInputException- if data type is not a fixed length or violates storage constraints.VariableSizeException- if force is false and data type size causes a conflict with other variables
-
setDataType
public void setDataType(DataType type, SourceType source) throws InvalidInputException
Description copied from interface:VariableSet the Data Type of this variable using the default alignment behavior (implementation specific). The given dataType must have a fixed length. If contained within a stack-frame, data-type size will be constrained by existing variables (e.g., equivalent to force=false) Note: stack offset will be maintained for stack variables.- Specified by:
setDataTypein interfaceVariable- Overrides:
setDataTypein classVariableDB- Parameters:
type- the data typesource- signature source- Throws:
InvalidInputException- if data type is not a fixed length or violates storage constraints.VariableSizeException- if data type size causes a conflict with other variables- See Also:
#setDataType(DataType, boolean)
-
setDataType
public void setDataType(DataType type, boolean alignStack, boolean force, SourceType source) throws InvalidInputException
Description copied from interface:VariableSet the Data Type of this variable. The given dataType must have a fixed length.- Specified by:
setDataTypein interfaceVariable- Overrides:
setDataTypein classVariableDB- Parameters:
type- the data typeforce- overwrite conflicting variablessource- signature source- Throws:
InvalidInputException- if data type is not a fixed length or violates storage constraints.VariableSizeException- if force is false and data type size causes a conflict with other variables
-
getFormalDataType
public DataType getFormalDataType()
Description copied from interface:ParameterGet the original formal signature data type before a possible forced indirect was possibly imposed by the functions calling convention. TheVariable.getDataType()method will always return the effective data type which corresponds to the allocated variable storage.- Specified by:
getFormalDataTypein interfaceParameter- Returns:
- Formal data type. This type will only differ from the
Variable.getDataType()value if this parameter isForcedIndirect.
-
getSource
public SourceType getSource()
Description copied from interface:VariableGet the source of this variable- Specified by:
getSourcein interfaceVariable- Overrides:
getSourcein classVariableDB- Returns:
- the source of this variable
-
hasAssignedStorage
public boolean hasAssignedStorage()
- Specified by:
hasAssignedStoragein interfaceVariable- Overrides:
hasAssignedStoragein classVariableDB- Returns:
- true if this variable has been assigned storage. This is equivalent to
Variable.getVariableStorage()!= null
-
getVariableStorage
public VariableStorage getVariableStorage()
Description copied from interface:VariableGet the variable storage associated with this variable.- Specified by:
getVariableStoragein interfaceVariable- Overrides:
getVariableStoragein classVariableDB- Returns:
- the variable storage for this variable
-
getFirstUseOffset
public int getFirstUseOffset()
- Specified by:
getFirstUseOffsetin interfaceVariable- Returns:
- the first use offset relative to the function entry point.
-
getDataType
public DataType getDataType()
Description copied from interface:VariableGet the Data Type of this variable- Specified by:
getDataTypein interfaceVariable- Overrides:
getDataTypein classVariableDB- Returns:
- the data type of the variable
-
isForcedIndirect
public boolean isForcedIndirect()
Description copied from interface:ParameterIf this parameter which was forced by the associated calling convention to be passed as a pointer instead of its original formal type.- Specified by:
isForcedIndirectin interfaceParameter- Returns:
- true if this parameter was forced to be passed as a pointer instead of its original formal type
-
isAutoParameter
public boolean isAutoParameter()
- Specified by:
isAutoParameterin interfaceParameter- Returns:
- true if this parameter is automatically generated based upon the associated function calling convention and function signature. An example of such a parameter include the "__return_storage_ptr__" parameter.
-
getAutoParameterType
public AutoParameterType getAutoParameterType()
Description copied from interface:ParameterIf this is an auto-parameter this method will indicate its type.- Specified by:
getAutoParameterTypein interfaceParameter- Returns:
- auto-parameter type of null if not applicable.
-
-