Fancy tools support!

Luke Gorrie luke@REDACTED
Wed Nov 5 12:19:17 CET 2003


"Erik Stenman" <Erik.Stenman@REDACTED> writes:

>  
> 
> Bjorn Gustavsson writes
> > 
> > Luke Gorrie <luke@REDACTED> writes:
> > 
> > [...]
> > >   Cross referencing, e.g.
> > >     %% who_calls(Module, Function, Arity) -> [{M,F,A}]
> > >     %% List all the known callers of Module:Function/Arity.
> > >   Simple enough - of course it can't be perfect what with 
> > 'apply', but
> > >   it can still be much better and more convenient than 'grep'. It's
> > >   very nice to get hyperlinks to all callers of a function at the
> > >   touch of a key in Emacs. (I think Thomas Lindgren has a parse
> > >   transform for adding this to module_info? Jungerl it?)
> > > 
> > 
> > That would be difficult to add, as the Erlang run-time system 
> > does not keep any information about the callers to any given function.
> 
> HiPE keeps this information, but of course only for loaded functions...

How does one extract it?

I was thinking about the loaded vs. unloaded. I think the solution is
to just load everything accessible in the codepath into the BEAM
process while one is developing.

Then, if each module_info gave a list like

  [{function, F, calls, [{M,F,A}]}, ...]

then who_calls(M,F,A) could be implemented as just a 'fold' over every
module's module_info - which could probably be done "instantaneously"
for interactive purposes.

I think Thomas Lindgren said he has a parse-transform that does just
this (written to speed up xref-like tools). That would seem the right
mechanism - though maybe my definition of "runtime support" is a bit
loose :-)

-Luke




More information about the erlang-questions mailing list