Project

General

Profile

Feature #9805

Backtrace for SystemStackError

Added by sawa (Tsuyoshi Sawada) over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:62403]

Description

The following code:

def a; a end
begin
  a
rescue => e
puts  e.backtrace.inspect
end

only returns a single line of backtrace like:

/tmp/scratch:3:in `a'

but this is not helpful when debugging. It would be better if some limit be set by configuration, and the backtrace is displayed as far as possible within the limit, so the case above would become:

/tmp/scratch:3:in `a'
/tmp/scratch:3:in `a'
/tmp/scratch:3:in `a'
... # repeated as many times as the limit set
/tmp/scratch:3:in `a'

I believe the same question was asked here: https://bugs.ruby-lang.org/issues/6216, but the code posted by the poster was unnecessarily long and complex that the intent was not clear to many people.


Related issues

Is duplicate of Ruby master - Feature #6216: SystemStackError backtraces should not be reduced to one lineClosed03/28/2012Actions

History

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

  • Is duplicate of Feature #6216: SystemStackError backtraces should not be reduced to one line added

Updated by nobu (Nobuyoshi Nakada) about 5 years ago

  • Status changed from Open to Closed

Applied in changeset r46502.


Backtrace for SystemStackError

  • eval.c (setup_exception): set backtrace in system stack error other than the pre-allocated sysstack_error. [Feature #6216]
  • proc.c (Init_Proc): freeze the pre-allocated sysstack_error.
  • vm_insnhelper.c (vm_stackoverflow): raise new instance for each times without calling any methods to keep the backtrace with no further stack overflow.

Also available in: Atom PDF