1

taking a look at the tutorials in Github on how to run Soot on Eclipse to create graphs, it can be easily understood how to make a Control Flow Graph of a class using the existing example code.

However with this already existing example every function called from the Main is depicted as a node, and any internal functionality is not shown in the graph.

I took a look at the documentation but could not find a straightforward explanation on how to also visualise what these called functions do internally (in other words create mini graphs for each function that is called).

I have a feeling that it must be pretty easy but cannot figure out what code must be added or which options must be used when running Soot.

PM2
  • 11
  • 1

1 Answers1

0

I think that what you have obtained so far is a call-graph (graph representing the calls between methods over the entire program). A graph representing the control-flows in a single method is called a Control Flow Graph (CFG). You can see this answer to see how to create a CFG (or an ICFG, which is a combination of the CFGs of all methods in the program and the call-graph).

Alyssandra
  • 106
  • 1
  • 6
  • First of thank you for the answer. The graph I had created was done by following the tutorial "Implementing an intra procedural data flow analysis in Soot" from Git, so I think that what the example creates is an ExceptionalUnitGraph (a CFG) and uses as the Body of the graph the Main method of a class, and after that although it does not interest me yet it performs a specific analysis on it. Taking this into account I do believe that what I want is an ICFG, but thought that maybe it could be obtained by extending the ExceptionalUnitGraph method instead of having to use an extra Soot extension. – PM2 Dec 11 '18 at 10:36
  • You can get an ICFG by using InterproceduralCFG from Heros. Soot depends on Heros anyways, so if you already have Soot, no need to install anything else. All you need to do is to modify your existing code to create a SceneTransformer on the wjtp pack instead of your current BodyTransformer on jtp, and in your transformer, issue a call to `new JimpleBasedInterproceduralCFG()` (or any kind of InterproceduralCFG) like [here](https://github.com/Sable/heros/wiki/Example:-Using-Heros-with-Soot). No need to run the Heros solver, the constructor of JimpleBasedInterproceduralCFG will generate the ICFG. – Alyssandra Dec 11 '18 at 12:52