Class DBTraceProgramViewFragment

java.lang.Object
ghidra.trace.database.program.DBTraceProgramViewFragment
All Implemented Interfaces:
AddressSetView, Group, ProgramFragment, Iterable<AddressRange>

public class DBTraceProgramViewFragment extends Object implements ProgramFragment
  • Field Details

  • Constructor Details

  • Method Details

    • getComment

      public String getComment()
      Description copied from interface: Group
      Obtains the comment that has been associated with this fragment or module.
      Specified by:
      getComment in interface Group
      Returns:
      may be null.
    • setComment

      public void setComment(String comment)
      Description copied from interface: Group
      Sets the comment to associate with this fragment.
      Specified by:
      setComment in interface Group
      Parameters:
      comment - the comment.
    • getName

      public String getName()
      Description copied from interface: Group
      Obtains the name that has been associated with this fragment. A fragment will always have a name and it will be unique within the set of all fragment and module names.
      Specified by:
      getName in interface Group
    • setName

      public void setName(String name) throws DuplicateNameException
      Description copied from interface: Group
      Sets the name of this fragment.
      Specified by:
      setName in interface Group
      Parameters:
      name - the string to use for the fragment's name.
      Throws:
      DuplicateNameException - thrown if the name being set is already in use by another fragment or a module.
    • getNumParents

      public int getNumParents()
      Description copied from interface: Group
      Obtains the number of parent's of this fragment. If a fragment is in a module then the module is a parent of the fragment and the fragment is a child of the module. A fragment must have at least one parent and it may have multiple parents.
      Specified by:
      getNumParents in interface Group
      Returns:
      the number of parents of this fragment.
    • getParents

      public ProgramModule[] getParents()
      Description copied from interface: Group
      Returns a list of the modules which are parents for this group.
      Specified by:
      getParents in interface Group
    • getParentNames

      public String[] getParentNames()
      Description copied from interface: Group
      Returns the names of the modules which are parents to this fragment.
      Specified by:
      getParentNames in interface Group
    • getTreeName

      public String getTreeName()
      Description copied from interface: Group
      Returns the name of the tree that this group belongs to.
      Specified by:
      getTreeName in interface Group
    • contains

      public boolean contains(Address addr)
      Description copied from interface: AddressSetView
      Test if the address is contained within this set.
      Specified by:
      contains in interface AddressSetView
      Parameters:
      addr - address to test.
      Returns:
      true if addr exists in the set, false otherwise.
    • contains

      public boolean contains(Address start, Address end)
      Description copied from interface: AddressSetView
      Test if the given address range is contained in this set.

      The specified start and end addresses must form a valid range within a single AddressSpace.

      Specified by:
      contains in interface AddressSetView
      Parameters:
      start - the first address in the range.
      end - the last address in the range.
      Returns:
      true if entire range is contained within the set, false otherwise.
    • contains

      public boolean contains(AddressSetView rangeSet)
      Description copied from interface: AddressSetView
      Test if the given address set is a subset of this set.
      Specified by:
      contains in interface AddressSetView
      Parameters:
      rangeSet - the set to test.
      Returns:
      true if the entire set is contained within this set, false otherwise.
    • toAddressSet

      protected AddressSet toAddressSet()
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface AddressSetView
      Returns:
      true if this set is empty.
    • getMinAddress

      public Address getMinAddress()
      Description copied from interface: AddressSetView
      Get the minimum address for this address set.

      NOTE: An AddressRange should generally not be formed using this address and AddressSetView.getMaxAddress() since it may span multiple AddressSpaces.

      Specified by:
      getMinAddress in interface AddressSetView
      Specified by:
      getMinAddress in interface Group
      Returns:
      the minimum address for this set. Returns null if the set is empty.
    • getMaxAddress

      public Address getMaxAddress()
      Description copied from interface: AddressSetView
      Get the maximum address for this address set.

      NOTE: An AddressRange should generally not be formed using this address and AddressSetView.getMaxAddress() since it may span multiple AddressSpaces.

      Specified by:
      getMaxAddress in interface AddressSetView
      Specified by:
      getMaxAddress in interface Group
      Returns:
      the maximum address for this set. Returns null if the set is empty.
    • getNumAddressRanges

      public int getNumAddressRanges()
      Specified by:
      getNumAddressRanges in interface AddressSetView
      Returns:
      the number of address ranges in this set.
    • getAddressRanges

      public AddressRangeIterator getAddressRanges()
      Specified by:
      getAddressRanges in interface AddressSetView
      Returns:
      an iterator over the address ranges in this address set.
    • getAddressRanges

      public AddressRangeIterator getAddressRanges(boolean forward)
      Description copied from interface: AddressSetView
      Returns an iterator over the ranges in the specified order
      Specified by:
      getAddressRanges in interface AddressSetView
      Parameters:
      forward - the ranges are returned from lowest to highest, otherwise from highest to lowest
      Returns:
      an iterator over all the addresse ranges in the set.
    • getAddressRanges

      public AddressRangeIterator getAddressRanges(Address start, boolean forward)
      Description copied from interface: AddressSetView
      Returns an iterator of address ranges starting with the range that contains the given address.

      If there is no range containing the start address, then the first range will be the next range greater than the start address if going forward, otherwise the range less than the start address

      Specified by:
      getAddressRanges in interface AddressSetView
      Parameters:
      start - the address the first range should contain.
      forward - true iterators forward, false backwards
      Returns:
      the AddressRange iterator
    • iterator

      public Iterator<AddressRange> iterator()
      Description copied from interface: AddressSetView
      Returns an iterator over the address ranges in this address set.
      Specified by:
      iterator in interface AddressSetView
      Specified by:
      iterator in interface Iterable<AddressRange>
    • iterator

      public Iterator<AddressRange> iterator(boolean forward)
      Description copied from interface: AddressSetView
      Returns an iterator over the ranges in the specified order
      Specified by:
      iterator in interface AddressSetView
      Parameters:
      forward - the ranges are returned from lowest to highest, otherwise from highest to lowest
      Returns:
      an iterator over all the address ranges in the set.
    • iterator

      public Iterator<AddressRange> iterator(Address start, boolean forward)
      Description copied from interface: AddressSetView
      Returns an iterator of address ranges starting with the range that contains the given address.

      If there is no range containing the start address, then the first range will be the next range greater than the start address if going forward, otherwise the range less than the start address

      Specified by:
      iterator in interface AddressSetView
      Parameters:
      start - the address that the first range should contain.
      forward - true iterators forward, false backwards
      Returns:
      the AddressRange iterator
    • getNumAddresses

      public long getNumAddresses()
      Specified by:
      getNumAddresses in interface AddressSetView
      Returns:
      the number of addresses in this set.
    • getAddresses

      public AddressIterator getAddresses(boolean forward)
      Description copied from interface: AddressSetView
      Returns an iterator over all addresses in this set.
      Specified by:
      getAddresses in interface AddressSetView
      Parameters:
      forward - if true the address are return in increasing order, otherwise in decreasing order.
      Returns:
      an iterator over all addresses in this set.
    • getAddresses

      public AddressIterator getAddresses(Address start, boolean forward)
      Description copied from interface: AddressSetView
      Returns an iterator over the addresses in this address set starting at the start address
      Specified by:
      getAddresses in interface AddressSetView
      Parameters:
      start - address to start iterating at in the address set
      forward - if true address are return from lowest to highest, else from highest to lowest
      Returns:
      an iterator over the addresses in this address set starting at the start address
    • intersects

      public boolean intersects(AddressSetView addrSet)
      Description copied from interface: AddressSetView
      Determine if this address set intersects with the specified address set.
      Specified by:
      intersects in interface AddressSetView
      Parameters:
      addrSet - address set to check intersection with.
      Returns:
      true if this set intersects the specified addrSet else false
    • intersects

      public boolean intersects(Address start, Address end)
      Description copied from interface: AddressSetView
      Determine if the start and end range intersects with the specified address set.

      The specified start and end addresses must form a valid range within a single AddressSpace.

      Specified by:
      intersects in interface AddressSetView
      Parameters:
      start - start of range
      end - end of range
      Returns:
      true if the given range intersects this address set.
    • intersect

      public AddressSet intersect(AddressSetView view)
      Description copied from interface: AddressSetView
      Computes the intersection of this address set with the given address set.

      This method does not modify this address set.

      Specified by:
      intersect in interface AddressSetView
      Parameters:
      view - the address set to intersect with.
      Returns:
      AddressSet a new address set that contains all addresses that are contained in both this set and the given set.
    • intersectRange

      public AddressSet intersectRange(Address start, Address end)
      Description copied from interface: AddressSetView
      Computes the intersection of this address set with the given address range.

      This method does not modify this address set. The specified start and end addresses must form a valid range within a single AddressSpace.

      Specified by:
      intersectRange in interface AddressSetView
      Parameters:
      start - start of range
      end - end of range
      Returns:
      AddressSet a new address set that contains all addresses that are contained in both this set and the given range.
    • union

      public AddressSet union(AddressSetView addrSet)
      Description copied from interface: AddressSetView
      Computes the union of this address set with the given address set.

      This method does not change this address set.

      Specified by:
      union in interface AddressSetView
      Parameters:
      addrSet - The address set to be unioned with this address set.
      Returns:
      AddressSet A new address set which contains all the addresses from both this set and the given set.
    • subtract

      public AddressSet subtract(AddressSetView addrSet)
      Description copied from interface: AddressSetView
      Computes the difference of this address set with the given address set (this - set).

      Note that this is not the same as (set - this). This method does not change this address set.

      Specified by:
      subtract in interface AddressSetView
      Parameters:
      addrSet - the set to subtract from this set.
      Returns:
      AddressSet a new address set which contains all the addresses that are in this set, but not in the given set.
    • xor

      public AddressSet xor(AddressSetView addrSet)
      Description copied from interface: AddressSetView
      Computes the exclusive-or of this address set with the given set.

      This method does not modify this address set.

      Specified by:
      xor in interface AddressSetView
      Parameters:
      addrSet - address set to exclusive-or with.
      Returns:
      AddressSet a new address set containing all addresses that are in either this set or the given set, but not in both sets
    • hasSameAddresses

      public boolean hasSameAddresses(AddressSetView view)
      Description copied from interface: AddressSetView
      Returns true if the given address set contains the same set of addresses as this set.
      Specified by:
      hasSameAddresses in interface AddressSetView
      Parameters:
      view - the address set to compare.
      Returns:
      true if the given set contains the same addresses as this set.
    • getFirstRange

      public AddressRange getFirstRange()
      Description copied from interface: AddressSetView
      Returns the first range in this set or null if the set is empty
      Specified by:
      getFirstRange in interface AddressSetView
      Returns:
      the first range in this set or null if the set is empty
    • getLastRange

      public AddressRange getLastRange()
      Description copied from interface: AddressSetView
      Returns the last range in this set or null if the set is empty
      Specified by:
      getLastRange in interface AddressSetView
      Returns:
      the last range in this set or null if the set is empty
    • getRangeContaining

      public AddressRange getRangeContaining(Address address)
      Description copied from interface: AddressSetView
      Returns the range that contains the given address
      Specified by:
      getRangeContaining in interface AddressSetView
      Parameters:
      address - the address for which to find a range.
      Returns:
      the range that contains the given address.
    • findFirstAddressInCommon

      public Address findFirstAddressInCommon(AddressSetView set)
      Description copied from interface: AddressSetView
      Finds the first address in this collection that is also in the given addressSet.
      Specified by:
      findFirstAddressInCommon in interface AddressSetView
      Parameters:
      set - the addressSet to search for the first (lowest) common address.
      Returns:
      the first address that is contained in this set and the given set.
    • contains

      public boolean contains(CodeUnit codeUnit)
      Description copied from interface: ProgramFragment
      Returns whether this fragment contains the given code unit.
      Specified by:
      contains in interface Group
      Specified by:
      contains in interface ProgramFragment
      Parameters:
      codeUnit - the code unit being tested.
      Returns:
      true if the code unit is in the fragment, false otherwise.
    • getCodeUnits

      public CodeUnitIterator getCodeUnits()
      Description copied from interface: ProgramFragment
      Returns a forward iterator over the code units making up this fragment.
      Specified by:
      getCodeUnits in interface ProgramFragment
    • move

      public void move(Address min, Address max) throws NotFoundException
      Description copied from interface: ProgramFragment
      Moves all of the code units in a given range into this fragment. Note that min must the starting address of a code unit and max must be the ending address of a code unit. Furthermore every address in the given range must exist in program memory.
      Specified by:
      move in interface ProgramFragment
      Parameters:
      min - min address of range specifying the code units to move
      max - max address of range specifying the code units to move
      Throws:
      NotFoundException - thrown if any address between min and max (inclusive) does not belong to program memory.
    • isDeleted

      public boolean isDeleted()
      Description copied from interface: Group
      Returns true if this group has been deleted from the program
      Specified by:
      isDeleted in interface Group
      Returns:
      true if this group has been deleted from the program