[erlang-questions] Trunkated stacktrace

Håkan Mattsson hm@REDACTED
Tue Nov 1 16:25:05 CET 2016


Hi,

Anybody who knows why the stacktrace returned by process_info(Pid,
current_stacktrace) is truncated to 8 items? Is it due to some performance
consideration?

In order to get more usable stacktraces I were thinking of doing this
little fix in our system? Do you foresee any drawbacks with it?

Btw, 8 happens to be the default of the system flag backtrace_depth.

diff --git a/otp/erts/emulator/beam/erl_bif_info.c
b/otp/erts/emulator/beam/erl_bif_info.c
index d7f1e2d..2dc310f 100755
--- a/otp/erts/emulator/beam/erl_bif_info.c
+++ b/otp/erts/emulator/beam/erl_bif_info.c
@@ -1607,7 +1607,7 @@ current_stacktrace(Process* p, Process* rp, Eterm**
hpp)
     Eterm mfa;
     Eterm res = NIL;

-    depth = 8;
+    depth = erts_backtrace_depth;
     sz = offsetof(struct StackTrace, trace) + sizeof(BeamInstr *)*depth;
     s = (struct StackTrace *) erts_alloc(ERTS_ALC_T_TMP, sz);
     s->depth = 0;

/Håkan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161101/f679a748/attachment.htm>


More information about the erlang-questions mailing list