Package ghidra.program.util
Class CodeUnitLocation
- java.lang.Object
-
- ghidra.program.util.ProgramLocation
-
- ghidra.program.util.CodeUnitLocation
-
- All Implemented Interfaces:
java.lang.Comparable<ProgramLocation>
- Direct Known Subclasses:
AddressFieldLocation
,BytesFieldLocation
,CommentFieldLocation
,FieldNameFieldLocation
,IndentFieldLocation
,LabelFieldLocation
,MnemonicFieldLocation
,OperandFieldLocation
,SpaceFieldLocation
,SpacerFieldLocation
,SubDataFieldLocation
,XRefFieldLocation
public class CodeUnitLocation extends ProgramLocation
CodeUnitLocation
provides information about the location in a program within aCodeUnit
.
-
-
Field Summary
-
Fields inherited from class ghidra.program.util.ProgramLocation
addr, program, refAddr
-
-
Constructor Summary
Constructors Modifier Constructor Description CodeUnitLocation()
Default constructor for a code unit location needed for restoring from XML.CodeUnitLocation(Program program, Address addr, int[] componentPath, int row, int col, int charOffset)
Create a newCodeUnitLocation
for the given address.protected
CodeUnitLocation(Program program, Address addr, int[] componentPath, Address refAddr, int row, int col, int charOffset)
CodeUnitLocation(Program program, Address addr, int row, int col, int charOffset)
Create a newCodeUnitLocation
for the given address.protected
CodeUnitLocation(Program program, Address addr, Address byteAddr, int[] componentPath, int row, int col, int charOffset)
Create a newCodeUnitLocation
using the given information
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isValid(Program p)
Returns true if this location represents a valid location in the given program-
Methods inherited from class ghidra.program.util.ProgramLocation
compareAddr, compareTo, equals, getAddress, getByteAddress, getCharOffset, getColumn, getComponentPath, getLocation, getProgram, getRefAddress, getRow, hashCode, restoreState, saveState, toString
-
-
-
-
Constructor Detail
-
CodeUnitLocation
public CodeUnitLocation(Program program, Address addr, int[] componentPath, int row, int col, int charOffset)
Create a newCodeUnitLocation
for the given address. The address will be adjusted to the beginning of the code unit containing that address(if it exists). The original address can be retrieved using the "getByteAddress()" method.- Parameters:
program
- the program for obtaining the code unitaddr
- address of the location; should not be nullcomponentPath
- if this is not null it is the path to a data component inside of another data componentrow
- the row within the field.col
- - the display item index on the given row. (Note most fields only have one display item per row)charOffset
- - the character offset within the display item.
-
CodeUnitLocation
protected CodeUnitLocation(Program program, Address addr, Address byteAddr, int[] componentPath, int row, int col, int charOffset)
Create a newCodeUnitLocation
using the given information- Parameters:
program
- the program for obtaining the code unitaddr
- address of the location; should be on a code unit boundary.byteAddr
- the address of specific byte within the code unit at the addr address.componentPath
- if this is not null it is the path to a data component inside of another data componentrow
- the row within the field.col
- - the display item index on the given row. (Note most fields only have one display item per row)charOffset
- - the character offset within the display item.
-
CodeUnitLocation
public CodeUnitLocation(Program program, Address addr, int row, int col, int charOffset)
Create a newCodeUnitLocation
for the given address. The address will be adjusted to the beginning of the code unit containing that address(if it exists). The original address can be retrieved using the "getByteAddress()" method.- Parameters:
program
- the program for obtaining the code unitaddr
- address of the location; should not be nullrow
- the row within the field.col
- - the display item index on the given row. (Note most fields only have one display item per row)charOffset
- - the character offset within the display item.
-
CodeUnitLocation
protected CodeUnitLocation(Program program, Address addr, int[] componentPath, Address refAddr, int row, int col, int charOffset)
-
CodeUnitLocation
public CodeUnitLocation()
Default constructor for a code unit location needed for restoring from XML.
-
-
Method Detail
-
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 classProgramLocation
- Parameters:
p
- the program to test if this location is valid.- Returns:
- true if this location represents a valid location in the given program
-
-