Class: Google::Cloud::Debugger::Snappoint

Inherits:
Breakpoint
  • Object
show all
Defined in:
lib/google/cloud/debugger/snappoint.rb

Overview

Snappoint

A kind of Breakpoint that can be evaluated to capture the state of the program at time of evaluation. This is essentially a Breakpoint with action attrubte set to :CAPTURE

Constant Summary collapse

STACK_EVAL_DEPTH =

Max number of top stacks to collect local variables information

5
MAX_PAYLOAD_SIZE =

Max size of payload a Snappoint collects

32768

Instance Attribute Summary

Attributes inherited from Breakpoint

#action, #app_root, #condition, #create_time, #evaluated_expressions, #evaluated_log_message, #expressions, #final_time, #id, #is_final_state, #labels, #location, #log_level, #log_message_format, #stack_frames, #status, #user_email, #variable_table

Instance Method Summary collapse

Methods inherited from Breakpoint

#check_condition, #complete, #complete?, #eql?, #full_path, #line, #path, #set_error_state, #valid?

Instance Method Details

#evaluate(call_stack_bindings) ⇒ Boolean

Evaluate the breakpoint unless it's already marked as completed. Store evaluted expressions and stack frame variables in @evaluated_expressions, @stack_frames. Mark breakpoint complete if successfully evaluated.

Parameters:

  • call_stack_bindings (Array<Binding>)

    An array of Ruby Binding objects, from the call stack that leads to the triggering of the breakpoints.

Returns:

  • (Boolean)

    True if evaluated successfully; false otherwise.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/google/cloud/debugger/snappoint.rb', line 78

def evaluate call_stack_bindings
  synchronize do
    top_binding = call_stack_bindings[0]

    return false if complete? || !check_condition(top_binding)

    begin
      eval_expressions top_binding
      eval_call_stack call_stack_bindings

      complete
    rescue
      return false
    end
  end

  true
end