wcygan/java-callgraph

 
 

Repository files navigation

Static Call Graph Generator for Java Projects

alt text

You must have Java and Maven installed

$ git clone [email protected]: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

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.

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"

There are command line options that can be used:

OptionUsageExample
-jThe path to a jar file to inspect-j ./output/java-callgraph-driver-1.0-SNAPSHOT.jar
-cThe path to the coverage file to use-c ./output/jacoco.xml
-eThe name of the fuzzer's entrypoint-e "edu.uic.cs398.Main.main([Ljava/lang/String;)V"
-dThe depth to run breadth first search-d 10
-aReport the ancestry of the entrypoint-a
-oThe name of the output file-o example
  • The static call graph generator does not account for methods invoked via reflection.

Georgios Gousios [email protected]
Will Cygan [email protected]

2-clause BSD

About

Program for producing static call graphs for Java Projects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 91.3%
  • Python 5.6%
  • Ruby 3.1%