Forked from myronmarston/stack_overflow_debugger.rb
Created
December 7, 2017 00:31
-
-
Save zeisler/9d9d30f3cab304c778c4192e3fd561ac to your computer and use it in GitHub Desktop.
Stack overflow debugger (since Ruby doesn't provide the whole stack in this case)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment