Interface SourceFileManager

All Known Implementing Classes:
DummySourceFileManager, SourceFileManagerDB

public interface SourceFileManager
This interface defines methods for managing SourceFiles and SourceMapEntrys.
  • Field Details

  • Method Details

    • getSourceMapEntries

      List<SourceMapEntry> getSourceMapEntries(Address addr)
      Returns a sorted list of SourceMapEntrys associated with an address addr.
      Parameters:
      addr - address
      Returns:
      line number
    • addSourceMapEntry

      default SourceMapEntry addSourceMapEntry(SourceFile sourceFile, int lineNumber, AddressRange range) throws LockException
      Adds a SourceMapEntry with SourceFile sourceFile, line number lineNumber, and AddressRange range to the program database.

      Entries with non-zero lengths must either cover the same address range or be disjoint.

      Parameters:
      sourceFile - source file
      lineNumber - line number
      range - address range
      Returns:
      created SourceMapEntry
      Throws:
      LockException - if invoked without exclusive access
      IllegalArgumentException - if the range of the new entry intersects, but does not equal, the range of an existing entry or if sourceFile was not previously added to the program.
      AddressOutOfBoundsException - if the range of the new entry contains addresses that are not in a defined memory block
    • addSourceMapEntry

      SourceMapEntry addSourceMapEntry(SourceFile sourceFile, int lineNumber, Address baseAddr, long length) throws AddressOverflowException, LockException
      Creates a SourceMapEntry with SourceFile sourceFile, line number lineNumber, and non-negative length length and adds it to the program database.

      Entries with non-zero lengths must either cover the same address range or be disjoint.

      Parameters:
      sourceFile - source file
      lineNumber - line number
      baseAddr - minimum address of range
      length - number of addresses in range
      Returns:
      created SourceMapEntry
      Throws:
      AddressOverflowException - if baseAddr + length-1 overflows
      LockException - if invoked without exclusive access
      IllegalArgumentException - if the range of the new entry intersects, but does not equal, the range of an existing entry or if sourceFile was not previously added to the program.
      AddressOutOfBoundsException - if the range of the new entry contains addresses that are not in a defined memory block
    • intersectsSourceMapEntry

      boolean intersectsSourceMapEntry(AddressSetView addrs)
      Returns true precisely when at least one Address in addrs has source map information.
      Parameters:
      addrs - addresses to check
      Returns:
      true when at least one address has source map info
    • addSourceFile

      boolean addSourceFile(SourceFile sourceFile) throws LockException
      Adds a SourceFile to this manager. A SourceFile must be added before it can be associated with any source map information.
      Parameters:
      sourceFile - source file to add (can't be null)
      Returns:
      true if this manager did not already contain sourceFile
      Throws:
      LockException - if invoked without exclusive access
    • removeSourceFile

      boolean removeSourceFile(SourceFile sourceFile) throws LockException
      Removes a SourceFile from this manager. Any associated SourceMapEntrys will also be removed.
      Parameters:
      sourceFile - source file to remove
      Returns:
      true if sourceFile was in the manager
      Throws:
      LockException - if invoked without exclusive access
    • containsSourceFile

      boolean containsSourceFile(SourceFile sourceFile)
      Returns true precisely when this manager contains sourceFile.
      Parameters:
      sourceFile - source file
      Returns:
      true if source file already added
    • getAllSourceFiles

      List<SourceFile> getAllSourceFiles()
      Returns a List containing all SourceFiles of the program.
      Returns:
      source file list
    • getMappedSourceFiles

      List<SourceFile> getMappedSourceFiles()
      Returns a List containing SourceFiles which are mapped to at least one address in the program
      Returns:
      mapped source file list
    • transferSourceMapEntries

      void transferSourceMapEntries(SourceFile source, SourceFile target) throws LockException
      Changes the source map so that any SourceMapEntry associated with source is associated with target instead. Any entries associated with target before invocation will still be associated with target after invocation. source will not be associated with any entries after invocation (unless source and target are the same). Line number information is not changed.
      Parameters:
      source - source file to get info from
      target - source file to move info to
      Throws:
      LockException - if invoked without exclusive access
      IllegalArgumentException - if source or target has not been added previously
    • getSourceMapEntryIterator

      SourceMapEntryIterator getSourceMapEntryIterator(Address address, boolean forward)
      Returns a SourceMapEntryIterator starting at address.
      Parameters:
      address - starting address
      forward - direction of iterator (true = forward)
      Returns:
      iterator
    • getSourceMapEntries

      List<SourceMapEntry> getSourceMapEntries(SourceFile sourceFile, int minLine, int maxLine)
      Returns the sorted list of SourceMapEntrys for sourceFile with line number between minLine and maxLine, inclusive.
      Parameters:
      sourceFile - source file
      minLine - minimum line number
      maxLine - maximum line number
      Returns:
      source map entries
    • getSourceMapEntries

      default List<SourceMapEntry> getSourceMapEntries(SourceFile sourceFile, int lineNumber)
      Returns the sorted list of SourceMapEntrys for sourceFile with line number equal to lineNumber.
      Parameters:
      sourceFile - source file
      lineNumber - line number
      Returns:
      source map entries
    • getSourceMapEntries

      default List<SourceMapEntry> getSourceMapEntries(SourceFile sourceFile)
      Returns a sorted of list all SourceMapEntrys in the program corresponding to sourceFile.
      Parameters:
      sourceFile - source file
      Returns:
      source map entries
    • removeSourceMapEntry

      boolean removeSourceMapEntry(SourceMapEntry entry) throws LockException
      Removes a SourceMapEntry from this manager.
      Parameters:
      entry - entry to remove
      Returns:
      true if entry was in the manager
      Throws:
      LockException - if invoked without exclusive access