Retrieving the dependencies of a module

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

Retrieving the dependencies of a module

Lutz Behnke
Hi there,

I am trying to find out what other modules the functions in a given
module are calling. Is there a standard mechanism to do so?

I have the following problem:

In one application build with rebar3:

app_one/src/a.erl:
-module(a)
f1() -> b:f2().

in the other application, also build with rebar3:

app_two/src/b.erl:
-module(b)
f2() -> c:f3().


The module c is nowhere defined in either application one, two, or the
dependencies either pulls.

When I run the tests of application two everything works, when I try to
call the code from the module a, I get:

  {failed_to_start_child,b,
           {undef,
               [{c,f3,[],[]},
                {b,f2,1,[{...}|...]},
                {gen_server,init_it,2,[...]},
                {gen_server,init_it,6,...},
                {proc_lib,init_p_do_apply,...}]}}}

application two is specifically my fork of plumtree:
   https://github.com/timadorus/plumtree

Therefore I am trying to understand what is actually placed in the beam,
or what modules are accessed from b (aka plumtree_metadata_hashtree) to
see where the working code in the test is comming from).
I would assume that there is some code_transform going on, but cannot
find any in the rebar configuration.

Any help appreciated.

mfg lutz
--
Lutz Behnke
Hochschule für Angewandte Wissenschaften Hamburg,
Labor für Allgemeine Informatik,

phone: +49 40 42875-8156    mailto:[hidden email]
fax  : +49 40 2803770       http://users.informatik.haw-hamburg.de/~sage
Berliner Tor 7, 20099 Hamburg, Germany
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving the dependencies of a module

Ivan Uemlianin
Does xref do what you need?

     http://erlang.org/doc/apps/tools/xref_chapter.html

Ivan


On 24/07/2018 15:33, Lutz Behnke wrote:

> Hi there,
>
> I am trying to find out what other modules the functions in a given
> module are calling. Is there a standard mechanism to do so?
>
> I have the following problem:
>
> In one application build with rebar3:
>
> app_one/src/a.erl:
> -module(a)
> f1() -> b:f2().
>
> in the other application, also build with rebar3:
>
> app_two/src/b.erl:
> -module(b)
> f2() -> c:f3().
>
>
> The module c is nowhere defined in either application one, two, or the
> dependencies either pulls.
>
> When I run the tests of application two everything works, when I try
> to call the code from the module a, I get:
>
>  {failed_to_start_child,b,
>           {undef,
>               [{c,f3,[],[]},
>                {b,f2,1,[{...}|...]},
>                {gen_server,init_it,2,[...]},
>                {gen_server,init_it,6,...},
>                {proc_lib,init_p_do_apply,...}]}}}
>
> application two is specifically my fork of plumtree:
>   https://github.com/timadorus/plumtree
>
> Therefore I am trying to understand what is actually placed in the
> beam, or what modules are accessed from b (aka
> plumtree_metadata_hashtree) to see where the working code in the test
> is comming from).
> I would assume that there is some code_transform going on, but cannot
> find any in the rebar configuration.
>
> Any help appreciated.
>
> mfg lutz

--
============================================================
Ivan A. Uemlianin PhD
Llaisdy

Ymchwil a Datblygu Technoleg Lleferydd
Speech Technology Research and Development

                     [hidden email]
                         @llaisdy
                          llaisdy.wordpress.com
               github.com/llaisdy
                      www.linkedin.com/in/ivanuemlianin

                         festina lente
============================================================

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

Re: Retrieving the dependencies of a module

Lutz Behnke
Not really. Instead it deepens my confusion, as it reports the same
function as missing in plumtree as it does in my code, despite the CT
tests of plumtree working.

mfg lutz

Am 24.07.2018 um 17:16 schrieb Ivan Uemlianin:

> Does xref do what you need?
>
>      http://erlang.org/doc/apps/tools/xref_chapter.html
>
> Ivan
>
>
> On 24/07/2018 15:33, Lutz Behnke wrote:
>> Hi there,
>>
>> I am trying to find out what other modules the functions in a given
>> module are calling. Is there a standard mechanism to do so?
>>
>> I have the following problem:
>>
>> In one application build with rebar3:
>>
>> app_one/src/a.erl:
>> -module(a)
>> f1() -> b:f2().
>>
>> in the other application, also build with rebar3:
>>
>> app_two/src/b.erl:
>> -module(b)
>> f2() -> c:f3().
>>
>>
>> The module c is nowhere defined in either application one, two, or the
>> dependencies either pulls.
>>
>> When I run the tests of application two everything works, when I try
>> to call the code from the module a, I get:
>>
>>  {failed_to_start_child,b,
>>           {undef,
>>               [{c,f3,[],[]},
>>                {b,f2,1,[{...}|...]},
>>                {gen_server,init_it,2,[...]},
>>                {gen_server,init_it,6,...},
>>                {proc_lib,init_p_do_apply,...}]}}}
>>
>> application two is specifically my fork of plumtree:
>>   https://github.com/timadorus/plumtree
>>
>> Therefore I am trying to understand what is actually placed in the
>> beam, or what modules are accessed from b (aka
>> plumtree_metadata_hashtree) to see where the working code in the test
>> is comming from).
>> I would assume that there is some code_transform going on, but cannot
>> find any in the rebar configuration.
>>
>> Any help appreciated.
>>
>> mfg lutz
>


--
Lutz Behnke
Hochschule für Angewandte Wissenschaften Hamburg,
Labor für Allgemeine Informatik,

phone: +49 40 42875-8156    mailto:[hidden email]
fax  : +49 40 2803770       http://users.informatik.haw-hamburg.de/~sage
Berliner Tor 7, 20099 Hamburg, Germany
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving the dependencies of a module

Lutz Behnke
Please excuse my waste of your time.

It is a classical PEBKAC: tests that are never called cannot fail.

On the plus side: I learned more about xref, especially the fact, that
it analyses the beam file instead of the source code.

Thank you for your help.

mfg lutz

Am 25.07.2018 um 03:07 schrieb Dmitry Belyaev:

> Are you sure the plumtree CT tests are executing the code that xref
> complains about?
>
> Kind regards,
> Dmitry Belyaev
>
> On Wed, Jul 25, 2018 at 5:35 AM, Lutz Behnke <
> [hidden email]> wrote:
>
>> Not really. Instead it deepens my confusion, as it reports the same
>> function as missing in plumtree as it does in my code, despite the CT tests
>> of plumtree working.
>>
>> mfg lutz
>>
>>
>> Am 24.07.2018 um 17:16 schrieb Ivan Uemlianin:
>>
>>> Does xref do what you need?
>>>
>>>       http://erlang.org/doc/apps/tools/xref_chapter.html
>>>
>>> Ivan
>>>
>>>
>>> On 24/07/2018 15:33, Lutz Behnke wrote:
>>>
>>>> Hi there,
>>>>
>>>> I am trying to find out what other modules the functions in a given
>>>> module are calling. Is there a standard mechanism to do so?
>>>>
>>>> I have the following problem:
>>>>
>>>> In one application build with rebar3:
>>>>
>>>> app_one/src/a.erl:
>>>> -module(a)
>>>> f1() -> b:f2().
>>>>
>>>> in the other application, also build with rebar3:
>>>>
>>>> app_two/src/b.erl:
>>>> -module(b)
>>>> f2() -> c:f3().
>>>>
>>>>
>>>> The module c is nowhere defined in either application one, two, or the
>>>> dependencies either pulls.
>>>>
>>>> When I run the tests of application two everything works, when I try to
>>>> call the code from the module a, I get:
>>>>
>>>>   {failed_to_start_child,b,
>>>>            {undef,
>>>>                [{c,f3,[],[]},
>>>>                 {b,f2,1,[{...}|...]},
>>>>                 {gen_server,init_it,2,[...]},
>>>>                 {gen_server,init_it,6,...},
>>>>                 {proc_lib,init_p_do_apply,...}]}}}
>>>>
>>>> application two is specifically my fork of plumtree:
>>>>    https://github.com/timadorus/plumtree
>>>>
>>>> Therefore I am trying to understand what is actually placed in the beam,
>>>> or what modules are accessed from b (aka plumtree_metadata_hashtree) to see
>>>> where the working code in the test is comming from).
>>>> I would assume that there is some code_transform going on, but cannot
>>>> find any in the rebar configuration.
>>>>
>>>> Any help appreciated.
>>>>
>>>> mfg lutz
>>>>
>>>
>>>
>>
>> --
>> Lutz Behnke
>> Hochschule für Angewandte Wissenschaften Hamburg,
>> Labor für Allgemeine Informatik,
>>
>> phone: +49 40 42875-8156    mailto:[hidden email]
>> fax  : +49 40 2803770       http://users.informatik.haw-hamburg.de/~sage
>> Berliner Tor 7, 20099 Hamburg, Germany
>>
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>


--
Lutz Behnke
Hochschule für Angewandte Wissenschaften Hamburg,
Labor für Allgemeine Informatik,

phone: +49 40 42875-8156    mailto:[hidden email]
fax  : +49 40 2803770       http://users.informatik.haw-hamburg.de/~sage
Berliner Tor 7, 20099 Hamburg, Germany
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions