Package ghidra.program.util
Class VariableLocation
- java.lang.Object
-
- ghidra.program.util.ProgramLocation
-
- ghidra.program.util.FunctionLocation
-
- ghidra.program.util.VariableLocation
-
- All Implemented Interfaces:
java.lang.Comparable<ProgramLocation>
- Direct Known Subclasses:
VariableCommentFieldLocation
,VariableLocFieldLocation
,VariableNameFieldLocation
,VariableTypeFieldLocation
,VariableXRefFieldLocation
public class VariableLocation extends FunctionLocation
VariableLocation
provides information about the location on a variable within aFunction
.
-
-
Field Summary
-
Fields inherited from class ghidra.program.util.FunctionLocation
functionAddr
-
Fields inherited from class ghidra.program.util.ProgramLocation
addr, program, refAddr
-
-
Constructor Summary
Constructors Constructor Description VariableLocation()
Default constructor needed for restoring a variable location from XML.VariableLocation(Program program, Address locationAddr, Variable var, int index, int charOffset)
Create a new VariableLocation.VariableLocation(Program program, Variable var, int index, int charOffset)
Create a new VariableLocation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ProgramLocation pl)
boolean
equals(java.lang.Object object)
Variable
getVariable()
Get the variable associated with this variable locationboolean
isLocationFor(Variable var)
Checks to see if this location is for the indicated variable.boolean
isParameter()
boolean
isReturn()
boolean
isValid(Program p)
Returns true if this location represents a valid location in the given programvoid
restoreState(Program p, SaveState obj)
Restore this function location using the given program and save state object.void
saveState(SaveState obj)
Save this function location to the given save state object.java.lang.String
toString()
-
Methods inherited from class ghidra.program.util.FunctionLocation
getFunctionAddress
-
Methods inherited from class ghidra.program.util.ProgramLocation
compareAddr, getAddress, getByteAddress, getCharOffset, getColumn, getComponentPath, getLocation, getProgram, getRefAddress, getRow, hashCode
-
-
-
-
Constructor Detail
-
VariableLocation
public VariableLocation()
Default constructor needed for restoring a variable location from XML.
-
VariableLocation
public VariableLocation(Program program, Address locationAddr, Variable var, int index, int charOffset)
Create a new VariableLocation.- Parameters:
the
- program of the locationlocationAddr
- the address of the listing location (i.e., referent code unit)var
- the variable associated with this location.
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classFunctionLocation
-
getVariable
public Variable getVariable()
Get the variable associated with this variable location- Returns:
- associated function variable
-
isLocationFor
public boolean isLocationFor(Variable var)
Checks to see if this location is for the indicated variable.- Parameters:
var
- the variable- Returns:
- true if this location is for the specified variable.
-
isParameter
public boolean isParameter()
-
isReturn
public boolean isReturn()
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classFunctionLocation
- See Also:
Object.equals(java.lang.Object)
-
compareTo
public int compareTo(ProgramLocation pl)
- Specified by:
compareTo
in interfacejava.lang.Comparable<ProgramLocation>
- Overrides:
compareTo
in classProgramLocation
-
restoreState
public void restoreState(Program p, SaveState obj)
Description copied from class:FunctionLocation
Restore this function location using the given program and save state object.- Overrides:
restoreState
in classFunctionLocation
-
saveState
public void saveState(SaveState obj)
Description copied from class:FunctionLocation
Save this function location to the given save state object.- Overrides:
saveState
in classFunctionLocation
- Parameters:
obj
- the save state object for saving the location
-
isValid
public boolean isValid(Program p)
Description copied from class:ProgramLocation
Returns true if this location represents a valid location in the given program- Overrides:
isValid
in classFunctionLocation
- Parameters:
p
- the program to test if this location is valid.- Returns:
- true if this location represents a valid location in the given program
-
-