etnt/edbg

edbg:i/2 fails to find source when beam locates in non standard location

hshibuya-dd opened this issue · 0 comments

Successful case:

% cat simple_test.erl
-module(simple_test).
-include_lib("eunit/include/eunit.hrl").

the_test() ->
    ?assertEqual(2, 1 + 1).

% erlc +debug_info simple_test.erl
% erl 
...
1> edbg:i(simple_test,5).
ok
2>

now, came a cross a project which compile eunit test like this:

% erlc +debug_info -o test/ebin simple_test.erl
% erl -pa test/ebin
...
1> edbg:i(simple_test,5).
** exception error: no match of right hand side value {error,not_found}
     in function  edbg:find_source/1 (src/edbg.erl, line 1411)
     in call from edbg:i/2 (src/edbg.erl, line 466)

this is because filelib:find_source/1 does not support this layout:

2> filelib:find_source(code:which(simple_test)).
{error,not_found}