Class CodeUnitLocation

java.lang.Object
ghidra.program.util.ProgramLocation
ghidra.program.util.CodeUnitLocation
All Implemented Interfaces:
Cloneable, Comparable<ProgramLocation>
Direct Known Subclasses:
AddressFieldLocation, BytesFieldLocation, CommentFieldLocation, FieldNameFieldLocation, IndentFieldLocation, LabelFieldLocation, MnemonicFieldLocation, OffsetFieldLocation, OperandFieldLocation, SpaceFieldLocation, SpacerFieldLocation, SubDataFieldLocation, XRefFieldLocation

public class CodeUnitLocation extends ProgramLocation
CodeUnitLocation provides information about the location in a program within a CodeUnit.
  • Constructor Details

    • CodeUnitLocation

      public CodeUnitLocation(Program program, Address addr, int[] componentPath, int row, int col, int charOffset)
      Create a new CodeUnitLocation 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 unit
      addr - address of the location; should not be null
      componentPath - if this is not null it is the path to a data component inside of another data component
      row - 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 new CodeUnitLocation using the given information
      Parameters:
      program - the program for obtaining the code unit
      addr - 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 component
      row - 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 new CodeUnitLocation 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 unit
      addr - address of the location; should not be null
      row - 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 Details

    • 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 class ProgramLocation
      Parameters:
      p - the program to test if this location is valid.
      Returns:
      true if this location represents a valid location in the given program.