wcygan / java-callgraph

Program for producing static call graphs for Java Projects

Home Page:https://github.com/bitslab/java-callgraph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java-callgraph

Static Call Graph Generator for Java Projects

alt text

Table of Contents

Build and Run

You must have Java and Maven installed

$ git clone git@github.com:wcygan/java-callgraph.git
$ cd java-callgraph
$ mvn install

This will produce a target directory with the following jar:

  • javacg-0.1-SNAPSHOT-jar-with-dependencies.jar: This is an executable jar which includes the static call graph generator and all dependencies needed to run this program

Usage

Example

After running mvn install, you can test this program by running the following code in the root directory:

$ java -jar ./target/javacg-0.1-SNAPSHOT-jar-with-dependencies.jar -j ./output/java-callgraph-driver-1.0-SNAPSHOT.jar -o example -e "edu.uic.cs398.Main.main([Ljava/lang/String;)V" -c ./output/jacoco.xml

This program will generate a graph and save it to a file <output-name>.dot which you can use Graphviz to visualize.

Graph Structure

A directed edge in the graph is denoted with two fully qualified method signatures:

"class1.method1(descriptor)" -> "class2.method2(descriptor)"

For example:

"edu.uic.cs398.Main.main([Ljava/lang/String;)V" -> "edu.uic.cs398.Book.Book.magic()V"

Options

There are command line options that can be used:

Option Usage Example
-j The path to a jar file to inspect -j ./output/java-callgraph-driver-1.0-SNAPSHOT.jar
-c The path to the coverage file to use -c ./output/jacoco.xml
-e The name of the fuzzer's entrypoint -e "edu.uic.cs398.Main.main([Ljava/lang/String;)V"
-d The depth to run breadth first search -d 10
-a Report the ancestry of the entrypoint -a
-o The name of the output file -o example

Known Restrictions

  • The static call graph generator does not account for methods invoked via reflection.

Authors

Georgios Gousios gousiosg@gmail.com
Will Cygan wcygan3232@gmail.com

License

2-clause BSD

About

Program for producing static call graphs for Java Projects

https://github.com/bitslab/java-callgraph


Languages

Language:Java 91.3%Language:Python 5.6%Language:Ruby 3.1%