Skip to content

Instantly share code, notes, and snippets.

@zeisler
zeisler / stack_overflow_debugger.rb
Created December 7, 2017 00:31 — forked from myronmarston/stack_overflow_debugger.rb
Stack overflow debugger (since Ruby doesn't provide the whole stack in this case)
max_stack_frames = 500
TooManyStackFrames = Class.new(StandardError)
TracePoint.new(:call) do |tp|
if caller.size >= max_stack_frames
raise TooManyStackFrames, "Stack has exceeded #{max_stack_frames} frames"
end
end.enable