class DEBUGGER__::Session
def postmortem=(is_enable)
def postmortem=(is_enable) if is_enable unless @postmortem_hook @postmortem_hook = TracePoint.new(:raise){|tp| exc = tp.raised_exception frames = DEBUGGER__.capture_frames(__dir__) exc.instance_variable_set(:@__debugger_postmortem_frames, frames) } at_exit{ @postmortem_hook.disable if CONFIG[:postmortem] && (exc = $!) != nil exc = exc.cause while exc.cause begin @ui.puts "Enter postmortem mode with #{exc.inspect}" @ui.puts exc.backtrace.map{|e| ' ' + e} @ui.puts "\n" enter_postmortem_session exc rescue SystemExit exit! rescue Exception => e @ui = STDERR unless @ui @ui.puts "Error while postmortem console: #{e.inspect}" end end } end if !@postmortem_hook.enabled? @postmortem_hook.enable end else if @postmortem_hook && @postmortem_hook.enabled? @postmortem_hook.disable end end end