Package ghidra.program.util
Class BytesFieldLocation
- java.lang.Object
-
- ghidra.program.util.ProgramLocation
-
- ghidra.program.util.CodeUnitLocation
-
- ghidra.program.util.BytesFieldLocation
-
- All Implemented Interfaces:
java.lang.Comparable<ProgramLocation>
public class BytesFieldLocation extends CodeUnitLocation
TheBytesFieldLocation
class provides specific information about the BYTES field within a program location.
-
-
Field Summary
-
Fields inherited from class ghidra.program.util.ProgramLocation
addr, program, refAddr
-
-
Constructor Summary
Constructors Constructor Description BytesFieldLocation()
Default constructor needed for restoring a byte field location from XML.BytesFieldLocation(Program program, Address addr)
Creates a new BytesFieldLocation for the given address.BytesFieldLocation(Program program, Address addr, Address byteAddress, int[] componentPath, int columnInByte)
Create a new BytesFieldLocation which represents a specific byte address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Address
getAddressForByte()
int
getByteIndex()
Returns the index of byte that represents the current program location.int
getColumn()
This is overridden here because previous versions used to store the byte index in the column field.int
getColumnInByte()
Returns the character position within the byte specified by getByteIndex().-
Methods inherited from class ghidra.program.util.CodeUnitLocation
isValid
-
Methods inherited from class ghidra.program.util.ProgramLocation
compareAddr, compareTo, equals, getAddress, getByteAddress, getCharOffset, getComponentPath, getLocation, getProgram, getRefAddress, getRow, hashCode, restoreState, saveState, toString
-
-
-
-
Constructor Detail
-
BytesFieldLocation
public BytesFieldLocation(Program program, Address addr, Address byteAddress, int[] componentPath, int columnInByte)
Create a new BytesFieldLocation which represents a specific byte address.- Parameters:
program
- the program for this location.addr
- the address of the code unit containing this location.byteAddress
- the address of this location which can be the address of a specific byte within a code unit.componentPath
- the data component path which is specified as an array of indexes where each index indicates the index into nested structures. For instructions or simple data, this should be null.columnInByte
- the character position in the the bytes
-
BytesFieldLocation
public BytesFieldLocation(Program program, Address addr)
Creates a new BytesFieldLocation 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 that this location is related.addr
- the address of the byte for this location.
-
BytesFieldLocation
public BytesFieldLocation()
Default constructor needed for restoring a byte field location from XML.
-
-
Method Detail
-
getByteIndex
public int getByteIndex()
Returns the index of byte that represents the current program location. Sources that do not get this specific should simply return 0.
-
getColumn
public int getColumn()
This is overridden here because previous versions used to store the byte index in the column field. So if anyone was incorrectly using getColumn() to get the byte index, then this override will allow that to keep working.- Overrides:
getColumn
in classProgramLocation
-
getColumnInByte
public int getColumnInByte()
Returns the character position within the byte specified by getByteIndex(). Normally, this is 1,2, or 3 corresponding to before the byte, between the nibbles of the byte or past the byte. Sometimes, extra delimiters may exist allowing the position to be greater than 3.
-
getAddressForByte
public Address getAddressForByte()
-
-