Package ghidra.app.util.demangler
Class DemangledFunction
- java.lang.Object
-
- ghidra.app.util.demangler.DemangledObject
-
- ghidra.app.util.demangler.DemangledFunction
-
- All Implemented Interfaces:
ParameterReceiver
- Direct Known Subclasses:
DemangledMethod
public class DemangledFunction extends DemangledObject implements ParameterReceiver
A class to represent a demangled function.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
callingConvention
static java.lang.String
CONST
protected boolean
isOverloadedOperator
protected java.util.List<DemangledDataType>
parameters
static java.lang.String
PTR64
static java.lang.String
RESTRICT
protected DemangledDataType
returnType
protected DemangledTemplate
template
protected boolean
thisPassedOnStack
static java.lang.String
UNALIGNED
static java.lang.String
VOLATILE
-
Fields inherited from class ghidra.app.util.demangler.DemangledObject
basedName, EMPTY_STRING, isRestrict, isStatic, isThunk, isUnaligned, isVirtual, memberScope, namespace, NAMESPACE_SEPARATOR, originalMangled, SPACE, SPACE_PATTERN, specialMidfix, specialPrefix, specialSuffix, storageClass, utilDemangled, visibility
-
-
Constructor Summary
Constructors Constructor Description DemangledFunction(java.lang.String name)
Constructs a new demangled function.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameter(DemangledDataType parameter)
Adds the specified parameter to this object.boolean
applyTo(Program program, Address address, DemanglerOptions options, TaskMonitor monitor)
java.lang.String
getCallingConvention()
Returns the calling convention or null, if unspecified.java.util.List<DemangledDataType>
getParameters()
Returns the parameters added to this object.java.lang.String
getParameterString()
DemangledDataType
getReturnType()
Returns the return type or null, if unspecified.java.lang.String
getSignature(boolean format)
Returns a complete signature for the demangled symbol.DemangledTemplate
getTemplate()
protected boolean
isAlreadyDemangled(Program program, Address address)
Determine if the symbol at address has already been demangled.boolean
isTrailingConst()
boolean
isTrailingPointer64()
boolean
isTrailingRestrict()
boolean
isTrailingUnaligned()
boolean
isTrailingVolatile()
boolean
isTypeCast()
void
setCallingConvention(java.lang.String callingConvention)
Sets the function calling convention.void
setOverloadedOperator(boolean isOverloadedOperator)
Sets whether this demangled function represents an overloaded operator.void
setReturnType(DemangledDataType returnType)
Sets the function return type.void
setTemplate(DemangledTemplate template)
void
setTemplatedConstructorType(java.lang.String type)
Special constructor where it has a templated type before the parameter listvoid
setThrowAttribute(java.lang.String throwAttribute)
void
setTrailingConst()
void
setTrailingPointer64()
void
setTrailingRestrict()
void
setTrailingUnaligned()
void
setTrailingVolatile()
void
setTypeCast()
-
Methods inherited from class ghidra.app.util.demangler.DemangledObject
applyDemangledName, applyDemangledName, createClassStructure, createNamespace, ensureNameLength, generatePlateComment, getBasedName, getDemangledName, getMemberScope, getName, getNamespace, getSpecialMidfix, getSpecialPrefix, getSpecialSuffix, getStorageClass, getUtilDemangled, getVisibility, isConst, isPointer64, isRestrict, isStatic, isThunk, isUnaligned, isVirtual, isVolatile, pad, setBasedName, setConst, setMemberScope, setName, setNamespace, setOriginalMangled, setPointer64, setRestrict, setSignature, setSpecialMidfix, setSpecialPrefix, setSpecialSuffix, setStatic, setStorageClass, setThunk, setUnaligned, setUtilDemangled, setVirtual, setVisibilty, setVolatile, toString
-
-
-
-
Field Detail
-
VOLATILE
public static final java.lang.String VOLATILE
- See Also:
- Constant Field Values
-
CONST
public static final java.lang.String CONST
- See Also:
- Constant Field Values
-
PTR64
public static final java.lang.String PTR64
- See Also:
- Constant Field Values
-
UNALIGNED
public static final java.lang.String UNALIGNED
- See Also:
- Constant Field Values
-
RESTRICT
public static final java.lang.String RESTRICT
- See Also:
- Constant Field Values
-
returnType
protected DemangledDataType returnType
-
callingConvention
protected java.lang.String callingConvention
-
thisPassedOnStack
protected boolean thisPassedOnStack
-
parameters
protected java.util.List<DemangledDataType> parameters
-
template
protected DemangledTemplate template
-
isOverloadedOperator
protected boolean isOverloadedOperator
-
-
Method Detail
-
setReturnType
public void setReturnType(DemangledDataType returnType)
Sets the function return type.- Parameters:
returnType
- the function return type
-
setCallingConvention
public void setCallingConvention(java.lang.String callingConvention)
Sets the function calling convention. For example, "__cdecl".- Parameters:
callingConvention
- the function calling convention
-
setTemplate
public void setTemplate(DemangledTemplate template)
-
getTemplate
public DemangledTemplate getTemplate()
-
setOverloadedOperator
public void setOverloadedOperator(boolean isOverloadedOperator)
Sets whether this demangled function represents an overloaded operator. For example, "operator+()".- Parameters:
isOverloadedOperator
- true if overloaded operator
-
addParameter
public void addParameter(DemangledDataType parameter)
Description copied from interface:ParameterReceiver
Adds the specified parameter to this object.- Specified by:
addParameter
in interfaceParameterReceiver
- Parameters:
parameter
- the parameter to add- See Also:
ParameterReceiver
-
getParameters
public java.util.List<DemangledDataType> getParameters()
Description copied from interface:ParameterReceiver
Returns the parameters added to this object.- Specified by:
getParameters
in interfaceParameterReceiver
- Returns:
- the parameters added to this object
- See Also:
ParameterReceiver
-
getReturnType
public DemangledDataType getReturnType()
Returns the return type or null, if unspecified.- Returns:
- the return type or null, if unspecified
-
getCallingConvention
public java.lang.String getCallingConvention()
Returns the calling convention or null, if unspecified.- Returns:
- the calling convention or null, if unspecified
-
setTemplatedConstructorType
public void setTemplatedConstructorType(java.lang.String type)
Special constructor where it has a templated type before the parameter list
-
isTrailingConst
public boolean isTrailingConst()
-
setTrailingConst
public void setTrailingConst()
-
isTrailingVolatile
public boolean isTrailingVolatile()
-
setTrailingVolatile
public void setTrailingVolatile()
-
isTrailingPointer64
public boolean isTrailingPointer64()
-
setTrailingPointer64
public void setTrailingPointer64()
-
isTrailingUnaligned
public boolean isTrailingUnaligned()
-
setTrailingUnaligned
public void setTrailingUnaligned()
-
isTrailingRestrict
public boolean isTrailingRestrict()
-
setTrailingRestrict
public void setTrailingRestrict()
-
isTypeCast
public boolean isTypeCast()
-
setTypeCast
public void setTypeCast()
-
setThrowAttribute
public void setThrowAttribute(java.lang.String throwAttribute)
-
getSignature
public java.lang.String getSignature(boolean format)
Description copied from class:DemangledObject
Returns a complete signature for the demangled symbol. For example: "unsigned long foo" "unsigned char * ClassA::getFoo(float, short *)" "void * getBar(int **, MyStruct &)" Note: based on the underlying mangling scheme, the return type may or may not be specified in the signature.- Specified by:
getSignature
in classDemangledObject
- Parameters:
format
- true if signature should be pretty printed- Returns:
- a complete signature for the demangled symbol
-
getParameterString
public java.lang.String getParameterString()
-
isAlreadyDemangled
protected boolean isAlreadyDemangled(Program program, Address address)
Description copied from class:DemangledObject
Determine if the symbol at address has already been demangled. While memory symbols check for presence of demangledName, external symbols simply check if demangled/alternate name has already been assigned.- Overrides:
isAlreadyDemangled
in classDemangledObject
- Parameters:
program
- the program being modifiedaddress
- address of demangled symbol- Returns:
- true if symbol at address has already been demangled
-
applyTo
public boolean applyTo(Program program, Address address, DemanglerOptions options, TaskMonitor monitor) throws java.lang.Exception
- Overrides:
applyTo
in classDemangledObject
- Throws:
java.lang.Exception
-
-