Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created June 1, 2015 22:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save myronmarston/6ce142303cd40b642361 to your computer and use it in GitHub Desktop.
Save myronmarston/6ce142303cd40b642361 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment