[erlang-questions] Re: Getting line number in backtrace?

Thomas Lindgren thomasl_erlang@REDACTED
Fri Dec 3 16:22:35 CET 2010


Hi Brian,

I'm afraid this library is semi-abandonware at the moment, in that I can't give 
it a lot of timely attention. But, I'll give three comments in decreasing order 
of usefulness.

1. Have you tried using the 'stable' version? I haven't gotten a lot of feedback 
on the 'devel' version, so it may have problems. The main known problem with 
'stable' is that the busy people at OTP _may_ have added new syntax that isn't 
handled well.

2. If you use "erlc -E", you can see the transformed code. Could perhaps be 
helpful. Or perhaps not.

3. My own view is that line numbers are hugely helpful. Ideally, I'd want all 
exceptions to contain that info and the entire call stack decorated. 
Unfortunately, there are some cases where a parse transform is powerless, so it 
would need compiler and/or VM support.

Best,
Thomas


----- Original Message ----
> From: Brian Candler <B.Candler@REDACTED>
> To: erlang-questions@REDACTED
> Sent: Fri, December 3, 2010 3:49:52 PM
> Subject: [erlang-questions] Re: Getting line number in backtrace?
> 
> Robert Virding wrote:
> > Is the smart_exceptions module compiled and put in  a place where erlc can 
>find it?
> 
> It was certainly compiled:
> 
> $ ls -l  ebin/smart_exceptions.beam ebin/mapform0.beam 
> -rw-r--r-- 1 brian brian   1900 2010-12-02 19:51 ebin/mapform0.beam
> -rw-r--r-- 1 brian brian 18936  2010-12-02 19:51 ebin/smart_exceptions.beam
> 
> However I hadn't added "-pa  ebin" to the erlc command line, so it couldn't
> find it. Thank you for  pointing me in the right direction there.
> 
> I can now compile code with the  smart_exceptions transformation, but the
> exception output isn't any  different:
> 
> $ rm ebin/my_test.beam 
> $ rake
> (in /v/git/rfe)
> erlc  -pa ebin +'{parse_transform,smart_exceptions}' +debug_info -o ebin  
>src/my_test.erl
> $ erl +Bc -pa ebin
> Erlang R13B03 (erts-5.7.4) [source]  [64-bit] [smp:2:2] [rq:2] 
>[async-threads:0] [hipe]  [kernel-poll:false]
> 
> Eshell V5.7.4  (abort with ^G)
> 1>  my_test:go().
> {foo,bar}** exception error: no match of right hand side value  {foo,bar}
>      in function  my_test:dostuff/1
>       in call from my_test:go/0
> 2> my_test:dostuff({x,y}).
> {x,y}** exception  error: no match of right hand side value {x,y}
>      in  function  my_test:dostuff/1
> 
> Here's the source:
> 
> $ cat  src/my_test.erl 
> -module(my_test).
> -export([go/0,dostuff/1]).
> 
> go()  ->
>   dostuff({foo,bar}),
>   io:format("The  end~n").
> 
> dostuff(A) ->
>   io:write(A),
>   {foo, baz} =  A,
>    io:format("Finished~n").
> 
> 
> Cheers,
> 
> Brian.
> 
> ________________________________________________________________
> erlang-questions  (at) erlang.org mailing  list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 
> 


      


More information about the erlang-questions mailing list