No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2023-10-11 17:47:47 -04:00
app Error handling for empty callers and callees 2023-10-11 17:47:47 -04:00
src Implement filtering by sources and sinks for 'dot' command 2023-02-24 12:34:20 -05:00
test Initial commit 2023-01-16 10:27:31 -05:00
.gitignore Initial commit 2023-01-16 10:27:31 -05:00
analyzer.cabal Add 'dot' command 2023-02-23 12:56:03 -05:00
CHANGELOG.md Initial commit 2023-01-16 10:27:31 -05:00
LICENSE Initial commit 2023-01-16 10:27:31 -05:00
package.yaml Add 'dot' command 2023-02-23 12:56:03 -05:00
README.md Update documentation 2023-02-24 12:51:04 -05:00
Setup.hs Initial commit 2023-01-16 10:27:31 -05:00
stack.yaml Finally pull in that option parsing library 2023-02-20 22:49:15 -05:00
stack.yaml.lock Initial commit 2023-01-16 10:27:31 -05:00

analyzer

A tool that allows you to query a call-graph.

Usage

This tool accepts the call-graph as a CSV (e.g. generated by viz) with just a source and target column.

Commands

dot

$ 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 --sinks 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 --sources 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.

paths

$ 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.

callers

$ analyzer callers INPUTFILE CALLEE.

Lists all of the functions that call CALLEE.

dependents

$ analyzer dependents INPUTFILE DEPENDENCY

Lists all of the functions that call DEPENDENCY, recursively.

callees

$ analyzer callees INPUTFILE CALLER

Lists all of the functions that CALLER calls.

dependencies

$ analyzer dependencies INPUTFILE DEPENDENT

Lists all of the functions DEPENDENT calls, recursively.

Building

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.