xref doesn't show all the calls

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

xref doesn't show all the calls

Gonchar Denis
Hi, all.

I noticed that xref doesn't detect some of the calls.

here is the simple test module:

-module(test).
-compile(export_all).

test()->
lists:reverse([]),
lists:keyfind(a,1,[]).

and xref query to get the calls from the module:

1> c(test,[debug_info]).
{ok,test}
2> xref:start(s).
{ok,<0.41.0>}
3> xref:add_directory(s,".").
{ok,[test]}
4> xref:q(s, "E | test:Mod").
{ok,[{{test,test,0},{lists,reverse,1}}]}
5> xref:stop(s).
stopped

can anyone explain why xref doesn't detect lists:keyfind/3 call?

Regards,
Denis


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: xref doesn't show all the calls

Matthias Lang
On 02. September 2016, Gonchar Denis wrote:

> I noticed that *xref* doesn't detect some of the calls.
...
> lists:reverse([]),
> lists:keyfind(a,1,[]).
...
> *4>* xref:q(s, "E | test:Mod").
> {ok,[{{test,test,0},{lists,reverse,1}}]}
...
> can anyone explain why *xref* doesn't detect* lists:keyfind/3* call?

Clue:

2> erlang:is_builtin(lists, keyfind, 3).
true
3> erlang:is_builtin(lists, reverse, 1).
false

use the 'builtins' option in xref.

---

Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1> c(test,[debug_info]).
{ok,test}
2> xref:start(s).
{ok,<0.41.0>}
3> xref:add_directory(s,".", [builtins]).
{error,xref_base,{invalid_options,[builtins]}}
4> xref:add_directory(s,".", [{builtins, true}]).
Skipping ./a.beam (no debug information)
{ok,[test]}
5> xref:q(s, "E | test:Mod").
{ok,[{{test,test,0},{lists,keyfind,3}},
     {{test,test,0},{lists,reverse,1}}]}


Matt
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions