class DEBUGGER__::Session

def process_event evt

Experimental RBS support (using type sampling data from the type_fusion project).

def process_event: ((Array[DEBUGGER__::ThreadClient] | Array[NilClass]) evt) -> Thread::Queue?

This signature was generated using 555 samples from 6 applications.

def process_event evt
  # variable `@internal_info` is only used for test
  tc, output, ev, @internal_info, *ev_args = evt
  output.each{|str| @ui.puts str} if ev != :suspend
  # special event, tc is nil
  # and we don't want to set @tc to the newly created thread's ThreadClient
  if ev == :thread_begin
    th = ev_args.shift
    q = ev_args.shift
    on_thread_begin th
    q << true
    return
  end
  @tc = tc
  case ev
  when :init
    enter_subsession
    wait_command_loop
  when :load
    iseq, src = ev_args
    on_load iseq, src
    request_tc :continue
  when :trace
    trace_id, msg = ev_args
    if t = @tracers.values.find{|t| t.object_id == trace_id}
      t.puts msg
    end
    request_tc :continue
  when :suspend
    enter_subsession if ev_args.first != :replay
    output.each{|str| @ui.puts str} unless @ui.ignore_output_on_suspend?
    case ev_args.first
    when :breakpoint
      bp, i = bp_index ev_args[1]
      clean_bps unless bp
      @ui.event :suspend_bp, i, bp, @tc.id
    when :trap
      @ui.event :suspend_trap, sig = ev_args[1], @tc.id
      if sig == :SIGINT && (@intercepted_sigint_cmd.kind_of?(Proc) || @intercepted_sigint_cmd.kind_of?(String))
        @ui.puts "#{@intercepted_sigint_cmd.inspect} is registered as SIGINT handler."
        @ui.puts "`sigint` command execute it."
      end
    else
      @ui.event :suspended, @tc.id
    end
    if @displays.empty?
      wait_command_loop
    else
      request_tc [:eval, :display, @displays]
    end
  when :result
    raise "[BUG] not in subsession" if @subsession_stack.empty?
    case ev_args.first
    when :try_display
      failed_results = ev_args[1]
      if failed_results.size > 0
        i, _msg = failed_results.last
        if i+1 == @displays.size
          @ui.puts "canceled: #{@displays.pop}"
        end
      end
    when :method_breakpoint, :watch_breakpoint
      bp = ev_args[1]
      if bp
        add_bp(bp)
        show_bps bp
      else
        # can't make a bp
      end
    when :trace_pass
      obj_id = ev_args[1]
      obj_inspect = ev_args[2]
      opt = ev_args[3]
      add_tracer ObjectTracer.new(@ui, obj_id, obj_inspect, **opt)
    else
      stop_all_threads
    end
    wait_command_loop
  when :protocol_result
    process_protocol_result ev_args
    wait_command_loop
  end
end