Full stack trace on exception


#1

Ruby e$B$ONc30$,JaB*$5$l$J$$>l9g!"%9%?%C%/%H%l!<%9$rI=<($7$F$/e(B
e$B$l$^$9$,!"$=$N$H$-!"e(B… 6 levels… e$B$J$I$HESCf$r>JN,$7$F$/$le(B
e$B$^$9!#e(B

% ./ruby -e ‘def m(n) if n == 0 then raise else m(n-1) end end
m(16)’
-e:1:in raise': unhandled exception from -e:1:inm’
from -e:1:in m' from -e:1:inm’
from -e:1:in m' from -e:1:inm’
from -e:1:in m' from -e:1:inm’
from -e:1:in m' ... 6 levels... from -e:1:inm’
from -e:1:in m' from -e:1:inm’
from -e:2:in `’

e$B$3$l$O!“L58B:F5”$G%9%?%C%/%H%l!<%9$,$H$s$G$b$J$/D9$/$J$C$?>le(B
e$B9g$K$O$"$j$,$?$$$N$G$9$,!“I,MW$J>pJs$,1#$l$F$7$^$&$3$H$b$”$je(B
e$B$^$9!#e(B

e$B$=$N$?$a!“A4ItI=<($7$F$[$7$$$H$$$&MW5a$,=P$F$-$F!”$A$g$C$HD4e(B
e$B$Y$?$@$1$G$be(B
[ruby-talk:56054], [ruby-talk:75008], [ruby-list:38810],
[ruby-talk:86343],
[ruby-talk:115962], [ruby-talk:159209], [ruby-core:6572],
[ruby-talk:187642]
e$B$GLdBjDs5/$,$J$5$l$F$$$^$9!#e(B

e$B$G!";W$C$?$N$G$9$,!"H/@8$7$?Nc30$,e(B SystemStackError e$B$G$J$$$He(B
e$B$-$OA4It=P$9$N$O$I$&$G$7$g$&$+!#e(B

Index: eval_error.h

— eval_error.h (e$B%j%S%8%g%se(B 12561)
+++ eval_error.h (e$B:n6H%3%T!<e(B)
@@ -155,6 +155,7 @@
long i;
long len = RARRAY_LEN(errat);
VALUE *ptr = RARRAY_PTR(errat);

  •    int truncate = eclass == rb_eSysStackError;
    

#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
#define TRACE_HEAD 8
@@ -164,7 +165,7 @@
if (TYPE(ptr[i]) == T_STRING) {
warn_printf("\tfrom %s\n", RSTRING_PTR(ptr[i]));
}

  •  if (i == TRACE_HEAD && len > TRACE_MAX) {
    
  •  if (truncate && i == TRACE_HEAD && len > TRACE_MAX) {
    
    warn_printf("\t … %ld levels…\n",
    len - TRACE_HEAD - TRACE_TAIL);
    i = len - TRACE_TAIL;

#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:31014] full stack trace on exception”
on Sun, 17 Jun 2007 17:31:42 +0900, Tanaka A. removed_email_address@domain.invalid
writes:

|Ruby e$B$ONc30$,JaB*$5$l$J$$>l9g!"%9%?%C%/%H%l!<%9$rI=<($7$F$/e(B
|e$B$l$^$9$,!"$=$N$H$-!"e(B… 6 levels… e$B$J$I$HESCf$r>JN,$7$F$/$le(B
|e$B$^$9!#e(B

|e$B$3$l$O!“L58B:F5”$G%9%?%C%/%H%l!<%9$,$H$s$G$b$J$/D9$/$J$C$?>le(B
|e$B9g$K$O$"$j$,$?$$$N$G$9$,!“I,MW$J>pJs$,1#$l$F$7$^$&$3$H$b$”$je(B
|e$B$^$9!#e(B
|
|e$B$=$N$?$a!“A4ItI=<($7$F$[$7$$$H$$$&MW5a$,=P$F$-$F!”$A$g$C$HD4e(B
|e$B$Y$?$@$1$G$be(B
|[ruby-talk:56054], [ruby-talk:75008], [ruby-list:38810], [ruby-talk:86343],
|[ruby-talk:115962], [ruby-talk:159209], [ruby-core:6572], [ruby-talk:187642]
|e$B$GLdBjDs5/$,$J$5$l$F$$$^$9!#e(B
|
|e$B$G!";W$C$?$N$G$9$,!"H/@8$7$?Nc30$,e(B SystemStackError e$B$G$J$$$He(B
|e$B$-$OA4It=P$9$N$O$I$&$G$7$g$&$+!#e(B

e$BBEEv$@$H;W$$$^$9!#$7$P$i$/;n$7$F$$^$7$g$&!#%3%%C%H$7$F$/$@$5$$!#e(B