J3RN / analyzer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

License:Other


Languages

Language:Haskell 100.0%