soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.84k stars 706 forks source link

Generate complete call graph #1104

Open scristalli opened 5 years ago

scristalli commented 5 years ago

I'd like to generate a complete call graph for a JAR, i.e. a graph containing all method calls between classes in said JAR. Since Soot by default starts from a single main method as entry point, I used the method described here to specify a list of custom entry points. The system works for a minimal JAR, but for a larger real-world example I would need to extract the names of the classes contained in the JAR, call forceResolve on each of them, and extract all the methods from each class, setting the giant list of all methods as entry points. Is this the recommended way, or is there a cleaner method to achieve the same result?

yuhang-lin commented 5 years ago

I have the same question!

StevenArzt commented 5 years ago

You need to know which methods you want as entry points. If you choose all methods of your JAR as entry points, you will end up with a huge method list and a huge callgraph. However, such an over-approximating approach is ususally not required. Most JARs without a main() method run inside some sort of framework, such as a Java web application. In that case, you can use the platform documentation to identify which methods are actually entry points.