Package ghidra.program.util
Class LabelFieldLocation
java.lang.Object
ghidra.program.util.ProgramLocation
ghidra.program.util.CodeUnitLocation
ghidra.program.util.LabelFieldLocation
- All Implemented Interfaces:
Cloneable
,Comparable<ProgramLocation>
This class contains specific location information within the label field of a
CodeUnitLocation
-
Field Summary
Fields inherited from class ghidra.program.util.ProgramLocation
addr, program, refAddr
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor needed for restoring a label field location from XMLLabelFieldLocation
(Program program, Address addr, int[] componentPath, String label, Namespace namespace, int row, int charOffset) Construct a new LabelFieldLocation.LabelFieldLocation
(Program program, Address addr, String label) Construct a new LabelFieldLocation where the namespace is global, primary is false, and the cursor location is at row 0, column 0;LabelFieldLocation
(Program program, Address addr, String label, Namespace namespace, int row) Construct a new LabelFieldLocation.Creates a label field location using the specified symbol and an index of 0.LabelFieldLocation
(Symbol s, int row, int charOffset) Creates a label field location using the specified symbol and the specified field index. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getName()
Returns the symbol at this LabelFieldLocation NOTE: currently a null symbol will be returned for default thunk functionsReturns the symbol path which corresponds to the label locationint
hashCode()
void
restoreState
(Program p, SaveState obj) Restore this program location using the given program and save state object.void
Save this program location to the given save state object.toString()
Methods inherited from class ghidra.program.util.CodeUnitLocation
isValid
Methods inherited from class ghidra.program.util.ProgramLocation
clone, compareAddr, compareTo, getAddress, getByteAddress, getCharOffset, getColumn, getComponentPath, getLocation, getProgram, getRefAddress, getRow, getTranslatedCopy
-
Constructor Details
-
LabelFieldLocation
public LabelFieldLocation()Default constructor needed for restoring a label field location from XML -
LabelFieldLocation
public LabelFieldLocation(Program program, Address addr, int[] componentPath, String label, Namespace namespace, int row, int charOffset) Construct a new LabelFieldLocation.- Parameters:
program
- the program of the locationaddr
- address of the location; should not be nullcomponentPath
- array of indexes for each nested data component; the index is the data component's index within its parent; may be null.label
- the label String at this location.namespace
- the namespace; may be null.row
- the row in list of labels as displayed by the label field. Only used for program location comparison purposes.charOffset
- the column position within the label string for this location.
-
LabelFieldLocation
Construct a new LabelFieldLocation where the namespace is global, primary is false, and the cursor location is at row 0, column 0;- Parameters:
program
- the program of the location.addr
- the address of the location.label
- the name of the symbol for this label location.
-
LabelFieldLocation
public LabelFieldLocation(Program program, Address addr, String label, Namespace namespace, int row) Construct a new LabelFieldLocation.- Parameters:
program
- the program of the location.addr
- address of the location; should not be nulllabel
- the label String at this location.namespace
- the namespace for the label. Null will default to the global namespace.row
- the row in list of labels as displayed by the label field. Only used for program location comparison purposes.
-
LabelFieldLocation
Creates a label field location using the specified symbol and an index of 0.- Parameters:
s
- the symbol to use when creating the location
-
LabelFieldLocation
Creates a label field location using the specified symbol and the specified field index.- Parameters:
s
- the symbol to use when creating the locationrow
- the row of the symbol.charOffset
- the position within the label string for this location
-
-
Method Details
-
getName
-
getSymbol
Returns the symbol at this LabelFieldLocation NOTE: currently a null symbol will be returned for default thunk functions- Returns:
- the symbol at this LabelFieldLocation or null if symbol lookup fails
-
getSymbolPath
Returns the symbol path which corresponds to the label location- Returns:
- symbol path
-
toString
- Overrides:
toString
in classProgramLocation
-
hashCode
public int hashCode()- Overrides:
hashCode
in classProgramLocation
-
equals
- Overrides:
equals
in classProgramLocation
-
saveState
Description copied from class:ProgramLocation
Save this program location to the given save state object.- Overrides:
saveState
in classProgramLocation
- Parameters:
obj
- the save state object for saving the location
-
restoreState
Description copied from class:ProgramLocation
Restore this program location using the given program and save state object.- Overrides:
restoreState
in classProgramLocation
- Parameters:
p
- program to restore fromobj
- the save state to restore from
-