aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/src/dbg_istk.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-03-31 08:40:36 +0200
committerBjörn Gustavsson <[email protected]>2011-08-16 08:58:48 +0200
commitd6dc673a00f6244b03e1e9c849e3267b141c23c7 (patch)
tree961af3eb4bae03ea19fad53d0f31843b15c2bdb6 /lib/debugger/src/dbg_istk.erl
parente21b58ac5a016d62bba8117ec09105bcac8b94e8 (diff)
downloadotp-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.erl7
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 ->