Skip to content

PlanetMacro/CallGraphTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CallGraphTool

Small wrapper around koknat/callGraph to generate static call graphs (and subset-code “prompt” files).

Setup

This repo includes a modified copy of callGraph (GPLv3) at src/callgraphtool/callGraph (see LICENSE).

Install system dependencies required by callGraph (Debian/Ubuntu):

sudo apt-get update
sudo apt-get install -y graphviz libgraphviz-perl

If you don't have sudo, you can install the Perl GraphViz module locally into .perl5/:

curl -L https://cpanmin.us -o /tmp/cpanm
perl /tmp/cpanm --local-lib-contained .perl5 GraphViz

Create and activate the virtual environment:

python3 -m venv .venv
source .venv/bin/activate

Install the package in editable mode:

python -m pip install -e .

Usage

Generate a call graph for a function within a folder (defaults to Python / -language py):

callgraphtool path/to/project my_function

If multiple functions share the same name, you can disambiguate the start function with:

callgraphtool path/to/project relative/path/to/file.rs:my_function

(relative/path/to/file.rs is relative to path/to/project; an absolute path also works.)

By default, outputs are written to results/ in this repo.

Override the language and output path:

callgraphtool path/to/project my_function --language py --output callgraph.svg

Generate a subset-code file (all functions included in the call graph scope of the start function):

callgraphtool path/to/project my_function --subset-code

The subset-code file includes:

  • An indented call tree at the top (as comments)
  • Source: <path>:<line> (<function>) markers above each copied function

When generating .png/.svg/.pdf graphs, the intermediate .dot file is deleted (use --output ... .dot if you want to keep DOT).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors