Package ghidra.program.model.symbol
Class SymbolType
- java.lang.Object
-
- ghidra.program.model.symbol.SymbolType
-
public abstract class SymbolType extends java.lang.Object
Class to represent the various types of Symbols.
-
-
Field Summary
Fields Modifier and Type Field Description static SymbolType
CLASS
static SymbolType
CODE
Deprecated, for removal: This API element is subject to removal in a future version.useLABEL
instead.static SymbolType
FUNCTION
static SymbolType
GLOBAL
static SymbolType
GLOBAL_VAR
static SymbolType
LABEL
static SymbolType
LIBRARY
static SymbolType
LOCAL_VAR
static SymbolType
NAMESPACE
static SymbolType
PARAMETER
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
allowsDuplicates()
Returns true of this symbol type allows duplicate names.boolean
equals(java.lang.Object obj)
byte
getID()
Returns the id of this symbol type.static SymbolType
getSymbolType(int id)
Returns the SymbolType for the given id.int
hashCode()
boolean
isNamespace()
Returns true if this symbol represents a namespace.abstract boolean
isValidAddress(Program program, Address symbolAddress)
Returns true if the given address is valid for this symbol type.abstract boolean
isValidParent(Program program, Namespace parent, Address symbolAddr, boolean isExternalSymbol)
Returns true if the given namespace is a valid parent for a symbol of this type if it has the given address and whether or not it is external.abstract boolean
isValidSourceType(SourceType sourceType, Address symbolAddress)
Returns true if the given SourceType is valid for this symbol type.java.lang.String
toString()
-
-
-
Field Detail
-
LABEL
public static final SymbolType LABEL
-
CODE
@Deprecated(since="9.1", forRemoval=true) public static final SymbolType CODE
Deprecated, for removal: This API element is subject to removal in a future version.useLABEL
instead.
-
LIBRARY
public static final SymbolType LIBRARY
-
NAMESPACE
public static final SymbolType NAMESPACE
-
CLASS
public static final SymbolType CLASS
-
FUNCTION
public static final SymbolType FUNCTION
-
PARAMETER
public static final SymbolType PARAMETER
-
LOCAL_VAR
public static final SymbolType LOCAL_VAR
-
GLOBAL_VAR
public static final SymbolType GLOBAL_VAR
-
GLOBAL
public static final SymbolType GLOBAL
-
-
Method Detail
-
isValidParent
public abstract boolean isValidParent(Program program, Namespace parent, Address symbolAddr, boolean isExternalSymbol)
Returns true if the given namespace is a valid parent for a symbol of this type if it has the given address and whether or not it is external.- Parameters:
program
- the program to contain the symbolparent
- the namespace where a symbol will potentially be parented.symbolAddr
- the address of they symbol to be parented.isExternalSymbol
- true if the symbol is external.- Returns:
- true if the given namespace is a valid parent for a symbol if it has the given address and whether or not it is external.
-
isValidAddress
public abstract boolean isValidAddress(Program program, Address symbolAddress)
Returns true if the given address is valid for this symbol type.- Parameters:
program
- the program to test for a valid address.symbolAddress
- the address of the symbol to be tested.- Returns:
- true if the given address is valid within the given program.
-
isValidSourceType
public abstract boolean isValidSourceType(SourceType sourceType, Address symbolAddress)
Returns true if the given SourceType is valid for this symbol type. (For example, Some symbols don't support the SymbolType.DEFAULT)- Parameters:
sourceType
- the sourceType to test.symbolAddress
- the address of the symbol to be tested.- Returns:
- true if the given SourceType is valid for this symbol type.
-
allowsDuplicates
public boolean allowsDuplicates()
Returns true of this symbol type allows duplicate names.- Returns:
- true of this symbol type allows duplicate names.
-
isNamespace
public boolean isNamespace()
Returns true if this symbol represents a namespace.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getID
public byte getID()
Returns the id of this symbol type.
-
getSymbolType
public static SymbolType getSymbolType(int id)
Returns the SymbolType for the given id.- Parameters:
id
- the id for the SymbolType to find.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-