Package ghidra.trace.database.bookmark

# Class DBTraceBookmarkManager

java.lang.Object
ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager<DBTraceBookmarkSpace>
ghidra.trace.database.bookmark.DBTraceBookmarkManager

All Implemented Interfaces:
  `ErrorHandler`, `DBTraceManager`, `DBTraceDelegatingManager<DBTraceBookmarkSpace>`, `TraceBookmarkManager`, `TraceBookmarkOperations`

public class DBTraceBookmarkManager extends AbstractDBTraceSpaceBasedManager<DBTraceBookmarkSpace> implements TraceBookmarkManager, DBTraceDelegatingManager<DBTraceBookmarkSpace>

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager

  `AbstractDBTraceSpaceBasedManager.DBTraceSpaceEntry`

  ## Nested classes/interfaces inherited from interface ghidra.trace.database.space.DBTraceDelegatingManager

  `DBTraceDelegatingManager.ExcConsumer<T,E extends Throwable>, DBTraceDelegatingManager.ExcFunction<T,R,E extends Throwable>, DBTraceDelegatingManager.ExcPredicate<T,E extends Throwable>, DBTraceDelegatingManager.ExcSupplier<T,E extends Throwable>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final long`
  `MEM_KEY_MASK`
  `protected static final int`
  `MEM_KEY_SHIFT`
  `static final String`
  `NAME`
  `protected static final int`
  `SPACE_ID_MASK`
  For non-register space: `+---12----+----52----+ | SpaceID | Key | +---------+----------+`
  `protected static final int`
  `SPACE_ID_SHIFT`
  `protected final Map<String,DBTraceBookmarkType>`
  `typesByName`
  `protected final Collection<DBTraceBookmarkType>`
  `typesView`

  ### Fields inherited from class ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager

  `baseLanguage, dbh, lock, name, NO_ADDRESS_SPACE, regSpacesByContainer, spaces, spaceStore, spacesView, threadManager, trace`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DBTraceBookmarkManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, Language baseLanguage, DBTrace trace, DBTraceThreadManager threadManager)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DBTraceBookmark`
  `addBookmark(Lifespan lifespan, Address address, TraceBookmarkType type, String category, String comment)`
  Add a bookmark at the given location.
  `protected DBTraceBookmarkSpace`
  `createSpace(AddressSpace space, AbstractDBTraceSpaceBasedManager.DBTraceSpaceEntry ent)`
  `DBTraceBookmarkType`
  `defineBookmarkType(String typeName, Icon icon, Color color, int priority)`
  Define (or redefine) a bookmark type.
  `Collection<? extends DBTraceBookmark>`
  `getAllBookmarks()`
  `DBTraceBookmark`
  `getBookmark(long id)`
  `DBTraceBookmarkSpace`
  `getBookmarkRegisterSpace(TraceStackFrame frame, boolean createIfAbsent)`
  `DBTraceBookmarkSpace`
  `getBookmarkRegisterSpace(TraceThread thread, boolean createIfAbsent)`
  `Collection<? extends DBTraceBookmark>`
  `getBookmarksAdded(long from, long to)`
  `Iterable<? extends DBTraceBookmark>`
  `getBookmarksAt(long snap, Address address)`
  `Collection<DBTraceBookmark>`
  `getBookmarksByType(String typeName)`
  `Iterable<? extends DBTraceBookmark>`
  `getBookmarksEnclosed(Lifespan lifespan, AddressRange range)`
  `Iterable<? extends DBTraceBookmark>`
  `getBookmarksIntersecting(Lifespan lifespan, AddressRange range)`
  `DBTraceBookmarkSpace`
  `getBookmarkSpace(AddressSpace space, boolean createIfAbsent)`
  `Collection<? extends DBTraceBookmark>`
  `getBookmarksRemoved(long from, long to)`
  `DBTraceBookmarkType`
  `getBookmarkType(String typeName)`
  `Set<String>`
  `getCategoriesForType(TraceBookmarkType type)`
  Get all the categories used for a given type
  `Collection<? extends DBTraceBookmarkType>`
  `getDefinedBookmarkTypes()`
  Get the defined bookmark types.
  `DBTraceBookmarkSpace`
  `getForSpace(AddressSpace space, boolean createIfAbsent)`
  `DBTraceBookmarkType`
  `getOrDefineBookmarkType(String typeName)`
  `boolean`
  `isDefinedType(String type)`
  `protected static long`
  `packId(long key, AddressSpace space)`
  `Lock`
  `readLock()`
  `protected static long`
  `unpackKey(long id)`
  `protected static AddressSpace`
  `unpackSpace(long id, AddressFactory addressFactory)`
  `protected static int`
  `unpackSpaceId(long id)`
  `Lock`
  `writeLock()`

  ### Methods inherited from class ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager

  `dbError, get, getActiveSpaces, getBaseLanguage, getForRegisterSpace, getForRegisterSpace, getForRegisterSpace, getLock, getSpaceByName, getTabledSpaces, getTrace, invalidateCache, loadSpaces, tableName`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.trace.database.space.DBTraceDelegatingManager

  `checkIsInMemory, delegateAddressSet, delegateAny, delegateCollection, delegateDeleteB, delegateDeleteV, delegateFirst, delegateHashSet, delegateRead, delegateRead, delegateReadB, delegateReadI, delegateReadI, delegateReadOr, delegateWrite, delegateWriteAll, delegateWriteI, delegateWriteV`

- ## Field Details

  - ### NAME

    public static final String NAME
    See Also:
      - Constant Field Values

  - ### SPACE_ID_MASK

    protected static final int SPACE_ID_MASK
    For non-register space: `+---12----+----52----+ | SpaceID | Key | +---------+----------+`
    See Also:
      - Constant Field Values

  - ### SPACE_ID_SHIFT

    protected static final int SPACE_ID_SHIFT
    See Also:
      - Constant Field Values

  - ### MEM_KEY_MASK

    protected static final long MEM_KEY_MASK
    See Also:
      - Constant Field Values

  - ### MEM_KEY_SHIFT

    protected static final int MEM_KEY_SHIFT
    See Also:
      - Constant Field Values

  - ### typesByName

    protected final Map<String,DBTraceBookmarkType> typesByName

  - ### typesView

    protected final Collection<DBTraceBookmarkType> typesView

- ## Constructor Details

  - ### DBTraceBookmarkManager

    public DBTraceBookmarkManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, Language baseLanguage, DBTrace trace, DBTraceThreadManager threadManager) throws VersionException, IOException
    Throws:
      `VersionException`
      `IOException`

- ## Method Details

  - ### packId

    protected static long packId(long key, AddressSpace space)

  - ### unpackSpaceId

    protected static int unpackSpaceId(long id)

  - ### unpackKey

    protected static long unpackKey(long id)

  - ### unpackSpace

    protected static AddressSpace unpackSpace(long id, AddressFactory addressFactory)

  - ### createSpace

    protected DBTraceBookmarkSpace createSpace(AddressSpace space, AbstractDBTraceSpaceBasedManager.DBTraceSpaceEntry ent) throws VersionException, IOException
    Specified by:
      `createSpace` in class `AbstractDBTraceSpaceBasedManager<DBTraceBookmarkSpace>`
    Throws:
      `VersionException`
      `IOException`

  - ### getBookmarkSpace

    public DBTraceBookmarkSpace getBookmarkSpace(AddressSpace space, boolean createIfAbsent)
    Specified by:
      `getBookmarkSpace` in interface `TraceBookmarkManager`

  - ### getBookmarkRegisterSpace

    public DBTraceBookmarkSpace getBookmarkRegisterSpace(TraceThread thread, boolean createIfAbsent)
    Specified by:
      `getBookmarkRegisterSpace` in interface `TraceBookmarkManager`

  - ### getBookmarkRegisterSpace

    public DBTraceBookmarkSpace getBookmarkRegisterSpace(TraceStackFrame frame, boolean createIfAbsent)
    Specified by:
      `getBookmarkRegisterSpace` in interface `TraceBookmarkManager`

  - ### getForSpace

    public DBTraceBookmarkSpace getForSpace(AddressSpace space, boolean createIfAbsent)
    Specified by:
      `getForSpace` in interface `DBTraceDelegatingManager<DBTraceBookmarkSpace>`
    Overrides:
      `getForSpace` in class `AbstractDBTraceSpaceBasedManager<DBTraceBookmarkSpace>`

  - ### readLock

    public Lock readLock()
    Specified by:
      `readLock` in interface `DBTraceDelegatingManager<DBTraceBookmarkSpace>`

  - ### writeLock

    public Lock writeLock()
    Specified by:
      `writeLock` in interface `DBTraceDelegatingManager<DBTraceBookmarkSpace>`

  - ### getOrDefineBookmarkType

    public DBTraceBookmarkType getOrDefineBookmarkType(String typeName)

  - ### isDefinedType

    public boolean isDefinedType(String type)

  - ### defineBookmarkType

    public DBTraceBookmarkType defineBookmarkType(String typeName, Icon icon, Color color, int priority)
    Description copied from interface: `TraceBookmarkManager`
    Define (or redefine) a bookmark type. Bookmark type metadata are not stored in the database. To customize these things, a plugin must call this method for every opened program
    Specified by:
      `defineBookmarkType` in interface `TraceBookmarkManager`
    Parameters:
      `typeName` - a name to uniquely identify the type
      `icon` - an icon for displaying the mark (usually in the listing margin)
      `color` - a color for displaying the mark (usually in the listing background)
      `priority` - a priority to determine which mark is displayed when multiple are present at the same location
    Returns:
      the newly-defined type

  - ### getDefinedBookmarkTypes

    public Collection<? extends DBTraceBookmarkType> getDefinedBookmarkTypes()
    Description copied from interface: `TraceBookmarkManager`
    Get the defined bookmark types.
    Specified by:
      `getDefinedBookmarkTypes` in interface `TraceBookmarkManager`
    Returns:
      the types

  - ### getBookmarkType

    public DBTraceBookmarkType getBookmarkType(String typeName)
    Specified by:
      `getBookmarkType` in interface `TraceBookmarkManager`

  - ### getBookmark

    public DBTraceBookmark getBookmark(long id)
    Specified by:
      `getBookmark` in interface `TraceBookmarkManager`

  - ### getBookmarksByType

    public Collection<DBTraceBookmark> getBookmarksByType(String typeName)

  - ### getCategoriesForType

    public Set<String> getCategoriesForType(TraceBookmarkType type)
    Description copied from interface: `TraceBookmarkOperations`
    Get all the categories used for a given type
    Specified by:
      `getCategoriesForType` in interface `TraceBookmarkOperations`
    Parameters:
      `type` - the bookmark type
    Returns:
      the set of categories

  - ### addBookmark

    public DBTraceBookmark addBookmark(Lifespan lifespan, Address address, TraceBookmarkType type, String category, String comment)
    Description copied from interface: `TraceBookmarkOperations`
    Add a bookmark at the given location. The category need not be created explicitly beforehand. It will be created implicitly if it does not already exist.
    Specified by:
      `addBookmark` in interface `TraceBookmarkOperations`
    Parameters:
      `lifespan` - the span of snaps to bookmark
      `address` - the address to bookmark
      `type` - the type of the bookmark
      `category` - a category for the bookmark
      `comment` - a comment to add to the bookmark
    Returns:
      the new bookmark

  - ### getAllBookmarks

    public Collection<? extends DBTraceBookmark> getAllBookmarks()
    Specified by:
      `getAllBookmarks` in interface `TraceBookmarkOperations`

  - ### getBookmarksAt

    public Iterable<? extends DBTraceBookmark> getBookmarksAt(long snap, Address address)
    Specified by:
      `getBookmarksAt` in interface `TraceBookmarkOperations`

  - ### getBookmarksEnclosed

    public Iterable<? extends DBTraceBookmark> getBookmarksEnclosed(Lifespan lifespan, AddressRange range)
    Specified by:
      `getBookmarksEnclosed` in interface `TraceBookmarkOperations`

  - ### getBookmarksIntersecting

    public Iterable<? extends DBTraceBookmark> getBookmarksIntersecting(Lifespan lifespan, AddressRange range)
    Specified by:
      `getBookmarksIntersecting` in interface `TraceBookmarkOperations`

  - ### getBookmarksAdded

    public Collection<? extends DBTraceBookmark> getBookmarksAdded(long from, long to)
    Specified by:
      `getBookmarksAdded` in interface `TraceBookmarkManager`

  - ### getBookmarksRemoved

    public Collection<? extends DBTraceBookmark> getBookmarksRemoved(long from, long to)
    Specified by:
      `getBookmarksRemoved` in interface `TraceBookmarkManager`