[erlang-questions] Injecting Line and File in Erlang Abstract Format

José Valim jose.valim@REDACTED
Tue Jan 10 12:39:23 CET 2012


With the addition of line and file in stacktraces, it became important to
support both line and file in the Erlang Abstract Format.

http://www.erlang.org/doc/apps/erts/absform.html

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:

    { call, 10, Atom, Args }

In case there is an exception using the representation above, both line and
file appear correctly in stacktrace. The following format also works:

    { call, [{line,10}], Atom, Args }

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:

    { call, [{file,"sample.erl"},{line,10}], Atom, Args }

    { call, [{line,{"sample.erl",10}}], Atom, Args }

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.


*
José Valim
www.plataformatec.com.br
Founder and Lead Developer
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120110/55034dac/attachment.htm>


More information about the erlang-questions mailing list