Skip to content

Instantly share code, notes, and snippets.

@garmoshka-mo
Created June 15, 2017 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garmoshka-mo/c451245b8ecb30abc974f0cca4cb588b to your computer and use it in GitHub Desktop.
Save garmoshka-mo/c451245b8ecb30abc974f0cca4cb588b to your computer and use it in GitHub Desktop.
Make sane backtrace in byebug
Byebug::WhereCommand.class_eval do
def get_backtrace
(context.stack_size-1).downto(0).map do |index|
hash = Byebug::Frame.new(context, index).to_hash
path = hash[:file].gsub(Rails.root.to_s, '')
next if path.match BACKTRACE_TRASH
"#{hash[:mark]} #{path}:#{hash[:line]} #{hash[:call]}"
end.compact
end
def print_backtrace
print get_backtrace.join "\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment