Class DBTraceStack

java.lang.Object
ghidra.trace.database.stack.DBTraceStack
All Implemented Interfaces:
DBTraceObjectInterface, TraceStack, TraceObjectInterface, TraceUniqueObject

public class DBTraceStack extends Object implements TraceStack, DBTraceObjectInterface
  • Constructor Details

  • Method Details

    • getThread

      public TraceThread getThread()
      Description copied from interface: TraceStack
      Get the thread whose stack this is
      Specified by:
      getThread in interface TraceStack
      Returns:
      the thread
    • getDepth

      public int getDepth(long snap)
      Description copied from interface: TraceStack
      Get the depth (as recorded) of this stack
      Specified by:
      getDepth in interface TraceStack
      Parameters:
      snap - the snap
      Returns:
      the depth
    • doAddStackFrame

      protected TraceStackFrame doAddStackFrame(long snap, int level)
    • copyFrameAttributes

      protected void copyFrameAttributes(long snap, TraceStackFrame from, TraceStackFrame to)
    • shiftFrameAttributes

      protected void shiftFrameAttributes(long snap, int from, int to, int count, List<TraceStackFrame> frames)
    • clearFrameAttributes

      protected void clearFrameAttributes(long snap, int start, int end, List<TraceStackFrame> frames)
    • setDepth

      public void setDepth(long snap, int depth, boolean atInner)
      Description copied from interface: TraceStack
      Set the depth of the stack by adding or deleting frames to or from the specified end

      Note that pushing new frames onto a stack does not adjust the frame level of any frame-associated managers or spaces, e.g., that returned by TraceMemoryManager.getMemoryRegisterSpace(TraceThread, int, boolean).

      If the experimental object mode is successful, this method should be deleted.

      Specified by:
      setDepth in interface TraceStack
      Parameters:
      snap - the snap
      depth - the desired depth
      atInner - true if frames should be "pushed"
    • doGetFrame

      protected TraceStackFrame doGetFrame(long snap, int level)
    • getFrame

      public TraceStackFrame getFrame(long snap, int level, boolean ensureDepth)
      Description copied from interface: TraceStack
      Get the frame at the given level
      Specified by:
      getFrame in interface TraceStack
      Parameters:
      snap - the snap
      level - the level, where 0 indicates the inner-most frame.
      ensureDepth - true to expand the depth to accomodate the requested frame
      Returns:
      the frame, or null if level exceeds the depth without ensureDepth set
    • doGetFrames

      protected Stream<TraceStackFrame> doGetFrames(long snap)
    • getFrames

      public List<TraceStackFrame> getFrames(long snap)
      Description copied from interface: TraceStack
      Get all (known) frames in this stack
      Specified by:
      getFrames in interface TraceStack
      Parameters:
      snap - the snap (only relevant in the experimental objects mode. Ordinarily, the frames are fixed over the stack's lifetime)
      Returns:
      the list of frames
    • delete

      public void delete()
      Description copied from interface: TraceStack
      Delete this stack and its frames
      Specified by:
      delete in interface TraceStack
    • remove

      public void remove(long snap)
      Description copied from interface: TraceStack
      Remove this stack and its frame rom the given snapshot on
      Specified by:
      remove in interface TraceStack
      Parameters:
      snap - the snapshot key
    • isValid

      public boolean isValid(long snap)
      Description copied from interface: TraceStack
      Check if this stack is valid at the given snap
      Specified by:
      isValid in interface TraceStack
      Parameters:
      snap - the snap
      Returns:
      true if valid
    • getObject

      public TraceObject getObject()
      Description copied from interface: TraceObjectInterface
      Get the object backing this implementation
      Specified by:
      getObject in interface TraceObjectInterface
      Returns:
      the object
    • translateEvent

      public TraceChangeRecord<?,?> translateEvent(TraceChangeRecord<?,?> rec)
      Description copied from interface: DBTraceObjectInterface
      Translate an object event into the interface-specific event

      Both the object event and the interface-specific event, if applicable, will be emitted. If multiple events need to be emitted, then this method may emit them directly via its object's trace. If exactly one event needs to be emitted, then this method should return the translated record. If no translation applies, or if the translated event(s) were emitted directly, this method returns null.

      Specified by:
      translateEvent in interface DBTraceObjectInterface
      Parameters:
      rec - the object event
      Returns:
      the interface-specific event to emit, or null
    • hasFixedFrames

      public boolean hasFixedFrames()
      Description copied from interface: TraceStack
      Check if this stack'sframes are fixed for its lifetime

      This is a transitional method, since the experimental objects mode breaks with the normal stack/frame model. Essentially, this returns true if the normal model is being used, and false if the object-based model is being used.

      Specified by:
      hasFixedFrames in interface TraceStack
      Returns:
      true if fixed, false if object-based (dynamic)