Class FrameCollector

  • Direct Known Subclasses:
    FrameProcessor

    public class FrameCollector
    extends VariableProcessor
    This type allows the collection of frame data, ie stack frames, watchers and other tracepoint data.
    • Field Detail

      • settings

        protected final Settings settings
        The current settings use my deep.
      • evaluator

        protected final IEvaluator evaluator
        The evaluator that should be used by this callback.
      • variables

        protected final Map<String,​Object> variables
        The variables that have been captured by the callback.
    • Constructor Detail

      • FrameCollector

        public FrameCollector​(Settings settings,
                              IEvaluator evaluator,
                              Map<String,​Object> variables,
                              StackTraceElement[] stack,
                              String methodName)
        Create a frame collector to collect the frame data.
        Parameters:
        settings - the current settings being used by deep
        evaluator - the evaluator to use for this callback
        variables - the variables captured by the callback
        stack - the stack captured by the callback
        methodName - the name of the method we are wrapping, or null if not a method wrapped collection
    • Method Detail

      • selectVariables

        protected Map<String,​Object> selectVariables​(int frameIndex)
        Select from the available captured variables the variables we want to process for this frame. This is mainly here to allow for an easy way for CF to map the variables from their capture Java types to the expected CF types.
        Parameters:
        frameIndex - the index of the frame we are processing
        Returns:
        the variables available at this frame
      • processVars

        protected List<VariableID> processVars​(Map<String,​Object> variables)
        This is where we start the Breadth first search (BFS) of the selected variables.

        Here we are essentially dealing with the BFS nodes and linking to the VariableProcessor to do the processing.

        Parameters:
        variables - the variables to process
        Returns:
        the variable ref used in the snapshot
        See Also:
        VariableProcessor
      • processNode

        protected boolean processNode​(Node node)
        This is where we take a node from BFS queue and process it back onto the queue.

        Essentially, we take a node, we process this node, the add the child nodes back onto the BFS queue.

        Parameters:
        node - the node to process
        Returns:
        true if we should continue to process more nodes, else false.
      • isAppFrame

        protected boolean isAppFrame​(StackTraceElement stackTraceElement)
        An app frame is defined via the settings ISettings.APP_FRAMES_INCLUDES and ISettings.APP_FRAMES_EXCLUDES. This gives a way to tell deep that the frame is part of your app and not part of the framework. This is primarily used as a way to filter frames in the UI.
        Parameters:
        stackTraceElement - the stack frame to process
        Returns:
        true if the class name is in the included packages, and not in the excluded packages, else false.
      • getMethodName

        protected String getMethodName​(StackTraceElement stackTraceElement,
                                       Map<String,​Object> variables,
                                       int frameIndex)
        Get the method name from the stack frame.
        Parameters:
        stackTraceElement - the stack frame to process
        variables - the variables for the frame
        frameIndex - the frame index
        Returns:
        the name of the method
      • processAttributes

        protected Resource processAttributes​(TracePointConfig tracepoint)
        Using the current tracepoint config, create a Resource the can be used as the attributes.

        The basic attributes created are:

        • tracepoint - the id of the tracepoint
        • path - the path of the tracepoint
        • line - the line of the tracepoint
        • stack - the stack type of the tracepoint
        • frame - the frame type of the tracepoint
        • has_watchers - boolean indicating there are watchers
        • has_condition - boolean indicating there is a condition
        Parameters:
        tracepoint - the current config
        Returns:
        the new Resource
      • logTracepoint

        protected void logTracepoint​(String logMsg,
                                     String tracepointId,
                                     String snapshotId)