A tool that allows you to query a call-graph.
This tool accepts the call-graph as a CSV (e.g. generated by viz) with just a source
and target
column.
$ analyzer dot INPUTFILE [-o|--out FILE] [--sink SINK] [--source SOURCE]
Creates a visualization of the call graph in GraphViz DOT format.
The --sink
flag specifies a filter that limits paths shown in the graph to those that terminate in the specified function. For instance, if you wanted to generate a call graph of all paths that terminate in MyApp.Repo.all/1
from an out.csv
file, you would write:
$ analyzer dot out.csv --sink MyApp.all/1
Multiple --sink
s can be specified and are permitted and are "OR"ed together. For instance if you wanted to generate a call graph of all paths that terminate in MyApp.Repo.all/1
or MyApp.Repo.get/2
, you would write:
$ analyzer dot out.csv --sink MyApp.all/1 --sink MyApp.Repo.get/2
The --source
flag specifies a filter that limits paths shown in the graph to those that begin with the specified function. For instance if you wanted to generate a call graph of all paths beginning at MyApp.Feature.do_thing/2
, you would write:
$ analyzer dot out.csv --source MyApp.Feature.do_thing/2
Multiple --source
s can be specified; multiple of the same or "OR"ed together.
The --source
and --sink
flags can be combined to limit the output to paths from sources to sinks. For instance, if you wanted to generate a call graph of all paths from MyApp.Feature.do_thing/2
to MyApp.Repo.all/1
, you would write:
$ analyzer dot out.csv --source MyApp.Feature.do_thing/2 --sink MyApp.Repo.all/1
Order of the flags does not matter.
$ analyzer paths INPUTFILE SOURCE SINK
Lists all of the code paths from SOURCE
to SINK
. Each list is specified by a series of lines, each line containing the name of a single function, starting at SOURCE
and ending at SINK
.
$ analyzer callers INPUTFILE CALLEE.
Lists all of the functions that call CALLEE
.
$ analyzer dependents INPUTFILE DEPENDENCY
Lists all of the functions that call DEPENDENCY
, recursively.
$ analyzer callees INPUTFILE CALLER
Lists all of the functions that CALLER
calls.
$ analyzer dependencies INPUTFILE DEPENDENT
Lists all of the functions DEPENDENT
calls, recursively.
This project is written in Haskell and uses Stack. Once you have Stack installed and the project cloned to your machine, you should be able to build the project by running stack build
in the project directory. To install the project to your ~/.local/bin
, run stack install
.