Skip to content

Commit

Permalink
Fix Backtrace from collapsing too many recursive frames
Browse files Browse the repository at this point in the history
Recursing through method_missing, be sure to check the sending name
(Location#name) when deciding to collapse the frame, otherwise the
backtrace is super confusing because it lists method_missing for many
different methods.
  • Loading branch information
Evan Phoenix committed Mar 27, 2010
1 parent c7ac644 commit be1fd1f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/common/backtrace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ def show(sep="\n")
lines = []
last_method = nil
last_line = nil
last_name = nil
times = 0

@locations.each do |loc|
if loc.method == last_method and loc.line == last_line
if loc.name == last_name and loc.method == last_method and loc.line == last_line
times += 1
else
lines.last[-1] = times if lines.size > 0
last_method = loc.method
last_line = loc.line
last_name = loc.name

str = loc.describe
max = str.size if str.size > max
Expand Down

0 comments on commit be1fd1f

Please sign in to comment.