Record Class ExecutionSnapshot

java.lang.Object
java.lang.Record
cs1302.tracer.trace.ExecutionSnapshot
Record Components:
stack - The program's stack. Index 0 is the bottommost frame, the last index is the topmost.
statics - Loaded static variables.
heap - The program's heap, a mapping of reference IDs to values.
stdoutSlice - Captured standard output slice.
stderrSlice - Captured standard error slice.
sourcePath - Optional relative source file path for the currently executing line.
stdinConsumed - Cumulative standard input consumed up to this snapshot point.
stdinOffset - Character index reached in standard input up to this snapshot point.
threads - Application thread states, or null for legacy capture.
triggeringThreadId - Thread producing the event, or null for legacy capture.
event - Captured event kind, or null for legacy capture.

public record ExecutionSnapshot(List<ExecutionSnapshot.StackSnapshot> stack, List<ExecutionSnapshot.Field> statics, Map<Long,TraceValue> heap, OutputSlice stdoutSlice, OutputSlice stderrSlice, Optional<String> sourcePath, String stdinConsumed, int stdinOffset, List<ExecutionSnapshot.ThreadSnapshot> threads, Long triggeringThreadId, String event) extends Record
A snapshot of a program's memory state.
  • Constructor Details

  • Method Details

    • materializeOutput

      public ExecutionSnapshot materializeOutput()
      Materializes the output slices of this snapshot into self-contained buffers.
      Returns:
      Snapshot with materialized output slices.
    • withOutput

      public ExecutionSnapshot withOutput(OutputSlice stdout, OutputSlice stderr)
      Copies this snapshot with updated output, preserving all execution metadata.
      Parameters:
      stdout - Updated standard output.
      stderr - Updated standard error.
      Returns:
      Snapshot with the supplied output slices.
    • stdout

      public byte[] stdout()
      Returns captured standard output bytes.
      Returns:
      Byte array of standard output.
    • stderr

      public byte[] stderr()
      Returns captured standard error bytes.
      Returns:
      Byte array of standard error.
    • stdoutLength

      public int stdoutLength()
      Returns the length in bytes of standard output without allocating.
      Returns:
      Standard output length in bytes.
    • stderrLength

      public int stderrLength()
      Returns the length in bytes of standard error without allocating.
      Returns:
      Standard error length in bytes.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • stack

      Returns the value of the stack record component.
      Returns:
      the value of the stack record component
    • statics

      public List<ExecutionSnapshot.Field> statics()
      Returns the value of the statics record component.
      Returns:
      the value of the statics record component
    • heap

      public Map<Long,TraceValue> heap()
      Returns the value of the heap record component.
      Returns:
      the value of the heap record component
    • stdoutSlice

      public OutputSlice stdoutSlice()
      Returns the value of the stdoutSlice record component.
      Returns:
      the value of the stdoutSlice record component
    • stderrSlice

      public OutputSlice stderrSlice()
      Returns the value of the stderrSlice record component.
      Returns:
      the value of the stderrSlice record component
    • sourcePath

      public Optional<String> sourcePath()
      Returns the value of the sourcePath record component.
      Returns:
      the value of the sourcePath record component
    • stdinConsumed

      public String stdinConsumed()
      Returns the value of the stdinConsumed record component.
      Returns:
      the value of the stdinConsumed record component
    • stdinOffset

      public int stdinOffset()
      Returns the value of the stdinOffset record component.
      Returns:
      the value of the stdinOffset record component
    • threads

      Returns the value of the threads record component.
      Returns:
      the value of the threads record component
    • triggeringThreadId

      public Long triggeringThreadId()
      Returns the value of the triggeringThreadId record component.
      Returns:
      the value of the triggeringThreadId record component
    • event

      public String event()
      Returns the value of the event record component.
      Returns:
      the value of the event record component