Getting line number in backtrace?

Brian Candler <>
Thu Dec 2 20:59:07 CET 2010


P.S. I did try git://github.com/thomasl/smart_exceptions.git but couldn't
get it to work.

Here's my test program:

------------------------------------
-module(my_test).
-export([go/0]).

go() ->
  dostuff(),
  io:format("The end~n").

dostuff() ->
  A1 = {foo,bar},
  io:write(A1),
  {foo, baz} = A1,
  io:format("Finished~n").
------------------------------------

And here's what I got trying to compile it using the 'devel' version of
smart_exceptions (under R13B3)

$ erlc +'{parse_transform,smart_exceptions}' -o ebin src/my_test.erl
src/my_test.erl:none: error in parse transform 'smart_exceptions': {undef,
                                              [{smart_exceptions,
                                                parse_transform,
                                                [[{attribute,1,file,
                                                   {"src/my_test.erl",1}},
                                                  {attribute,1,module,my_test},
                                                  {attribute,2,export,
                                                   [{go,0}]},
                                                  {function,4,go,0,
                                                   [{clause,4,[],[],
                                                     [{call,5,
                                                       {atom,5,dostuff},
                                                       []},
                                                      {call,6,
                                                       {remote,6,
                                                        {atom,6,io},
                                                        {atom,6,format}},
                                                       [{string,6,
                                                         "The end~n"}]}]}]},
                                                  {function,8,dostuff,0,
                                                   [{clause,8,[],[],
                                                     [{match,9,
                                                       {var,9,'A1'},
                                                       {tuple,9,
                                                        [{atom,9,foo},
                                                         {atom,9,bar}]}},
                                                      {call,10,
                                                       {remote,10,
                                                        {atom,10,io},
                                                        {atom,10,write}},
                                                       [{var,10,'A1'}]},
                                                      {match,11,
                                                       {tuple,11,
                                                        [{atom,11,foo},
                                                         {atom,11,baz}]},
                                                       {var,11,'A1'}},
                                                      {call,12,
                                                       {remote,12,
                                                        {atom,12,io},
                                                        {atom,12,format}},
                                                       [{string,12,
                                                         "Finished~n"}]}]}]},
                                                  {eof,13}],
                                                 [report_warnings,
                                                  report_errors,
                                                  {cwd,"/v/git/rfe"},
                                                  {outdir,"/v/git/rfe/ebin"},
                                                  {parse_transform,
                                                   smart_exceptions}]]},
                                               {compile,
                                                '-foldl_transform/2-anonymous-2-',
                                                2},
                                               {compile,foldl_transform,2},
                                               {compile,
                                                '-internal_comp/4-anonymous-1-',
                                                2},
                                               {compile,fold_comp,3},
                                               {compile,internal_comp,4},
                                               {compile,internal,3}]}

Regards,

Brian.


More information about the erlang-questions mailing list