[erlang-questions] Trunkated stacktrace

Vans S vans_163@REDACTED
Tue Nov 1 17:09:19 CET 2016


Increase the stack trace depth. 8 is default.  No serious drawbacks I can think of. Indeed 8 is often too little.

On Tuesday, November 1, 2016 11:25 AM, Håkan Mattsson <hm@REDACTED> wrote:



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


_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list