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

Brian Candler B.Candler@REDACTED
Fri Dec 3 16:48:51 CET 2010


On Fri, Dec 03, 2010 at 07:22:35AM -0800, Thomas Lindgren wrote:
> 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.

I hadn't, because I thought 'stable' was for R8 or similarly early elang.

I've just tried building 'stable' but it fails under R13B3:

erlc +debug_info -o ebin vendor/smart_exceptions.erl
vendor/smart_exceptions.erl:704: illegal guard expression
vendor/smart_exceptions.erl:92: Warning: variable 'Opts' is unused
vendor/smart_exceptions.erl:119: Warning: variable 'Err' is unused
vendor/smart_exceptions.erl:154: Warning: variable 'La' is unused
...
rake aborted!
Command failed with status (1): [erlc +debug_info -o ebin vendor/smart_exce...]
/v/git/rfe/Rakefile:16

That line says:

mapform0(F, C) when constant(C) ->
    C.


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

With 'devel' the .E file contains:

-file("src/my_test.erl", 1).

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

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

module_info() ->
    erlang:get_module_info(my_test).

module_info(X) ->
    erlang:get_module_info(my_test, X).

So it's not transformed very much :-)

> 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.

We concur.

Cheers,

Brian.


More information about the erlang-questions mailing list