With the addition of line and file in stacktraces, it became important to support both line and file in the Erlang Abstract Format.<div><br></div><div><a href="http://www.erlang.org/doc/apps/erts/absform.html">http://www.erlang.org/doc/apps/erts/absform.html</a></div>
<div><br></div><div>Line numbers are supported since day one but I could not find a way to inject the file in the Erlang Abstract Format. For instance, the representation for doing a call to an Atom with Args on line 10 would be:</div>
<div><br></div><div><font face="'courier new', monospace"> { call, 10, Atom, Args }</font></div><div><font face="'courier new', monospace"><br></font></div><div>In case there is an exception using the representation above, both line and file appear correctly in stacktrace. The following format also works:</div>
<div><font face="'courier new', monospace"><br></font></div><div><span style="font-family:'courier new',monospace"> { call, [{line,10}], Atom, Args }</span></div><div><span style="font-family:'courier new',monospace"><br>
</span></div><div>However, I could not find a way to inject the file. I have tried both formats below but both makes the stacktrace not appear at all:</div><div><br></div><div><span style="font-family:'courier new',monospace"> { call, [{file,"sample.erl"},{line,10}], Atom, Args }</span></div>
<div><span style="font-family:'courier new',monospace"><br></span></div><div><span style="font-family:'courier new',monospace"> { call, [{line,{</span><span style="font-family:'courier new',monospace">"sample.erl",</span><span style="font-family:'courier new',monospace">10}}], Atom, Args }</span></div>
<div><br></div><div>Does anyone know if it is possible to pass the file to the Erlang Abstract Format? This feature would be useful for transforms and languages like LFE. When you use macros, it is better if the stacktrace points to the place where the quote was generated instead of the place the quoted syntax was inserted.</div>
<div><div><div><br></div><div><br></div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b><span style="border-collapse:separate;font-family:arial;font-weight:normal"><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b>José Valim</b></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><div><span style="font-family:verdana,sans-serif;font-size:x-small"><a href="http://www.plataformatec.com.br/" style="color:rgb(42,93,176)" target="_blank">www.plataformatec.com.br</a></span></div>
<div><span style="font-family:verdana,sans-serif;font-size:x-small">Founder and Lead Developer</span></div></span></div></span></b></span><br>
</div></div>