diff options
author | Björn Gustavsson <[email protected]> | 2011-03-31 08:40:36 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-08-16 08:58:48 +0200 |
commit | d6dc673a00f6244b03e1e9c849e3267b141c23c7 (patch) | |
tree | 961af3eb4bae03ea19fad53d0f31843b15c2bdb6 /lib/debugger/src/dbg_istk.erl | |
parent | e21b58ac5a016d62bba8117ec09105bcac8b94e8 (diff) | |
download | otp-d6dc673a00f6244b03e1e9c849e3267b141c23c7.tar.gz otp-d6dc673a00f6244b03e1e9c849e3267b141c23c7.tar.bz2 otp-d6dc673a00f6244b03e1e9c849e3267b141c23c7.zip |
Don't include tail-recursive calls in stacktraces
The stacktrace in debugger-generated exceptions should be
as similar to stacktraces in BEAM-generated exceptions as
possible.
Diffstat (limited to 'lib/debugger/src/dbg_istk.erl')
-rw-r--r-- | lib/debugger/src/dbg_istk.erl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/debugger/src/dbg_istk.erl b/lib/debugger/src/dbg_istk.erl index 21365fa4e9..92dc802da4 100644 --- a/lib/debugger/src/dbg_istk.erl +++ b/lib/debugger/src/dbg_istk.erl @@ -31,7 +31,8 @@ {level, %Level mfa, %{Mod,Func,Args|Arity}|{Fun,Args} line, %Line called from - bindings + bindings, + lc %Last call (true|false) }). init() -> @@ -63,7 +64,7 @@ init(Stack) -> push(Bs, #ieval{level=Le,module=Mod,function=Name, arguments=As,line=Li}=Ieval, Lc) -> - Entry = #e{level=Le,mfa={Mod,Name,As},line=Li,bindings=Bs}, + Entry = #e{level=Le,mfa={Mod,Name,As},line=Li,bindings=Bs,lc=Lc}, case get(trace_stack) of false -> Ieval#ieval{level=Le+1}; @@ -141,6 +142,8 @@ delayed_stacktrace(no_args, Ieval) -> [ArityOnly || {ArityOnly,_} <- Stack] end. +stacktrace(N, [#e{lc=true}|T], Acc) -> + stacktrace(N, T, Acc); stacktrace(N, [E|T], []) -> stacktrace(N-1, T, [normalize(E)]); stacktrace(N, [E|T], [{P,_}|_]=Acc) when N > 0 -> |