Question

I am currently working on a program which compares two control - flow graphs with each other(the graphs are generated with Soot). These graphs belong to two different classes; so one cfg for each.

Currently I am using the following to load classes:

   SootClass sClassNew = Scene.v().loadClassAndSupport("Calc");     
   sClassNew.setApplicationClass();

   SootClass sClassOld = Scene.v().loadClassAndSupport("Calc2");        
   sClassOld.setApplicationClass()

This works if I add a folder with classes Calc.java and Calc2.java by right-clicking on the project | Java Build Path | Add External Class folder| choose the folder.

Unfortunately this is not exactly what I want since:

  1. The two classes will have the same name since they are different versions of each other. In other words, one class is an updated version of the other.
  2. When the program is executed, I want to make the user capable of choosing the files so that a cfg is built. Therefore, I must eliminate the above steps so as to add the classes and need a way to add them at run-time.

An important note is that Soot will only load files from JAR files and directories found on Soot's classpath. Does anyone have an idea how I can solve problems these two problems please?

Was it helpful?

Solution

Soot is not really set up to deal with this. It's main data structure is the Scene, in which it holds all classes it reasons about and the scene can only hold exactly one class instance per class name - there can be no two different versions.

Having said that, we have recently built an extension to Soot called Reviser (currently under submission): https://github.com/StevenArzt/reviser Reviser incrementally updates a program's inter-procedural control flow graph and the induced IFDS/IDE analysis information. To make this work, we had to poke around with Soot's class-loading mechanism quite a bit, though; this is far from trivial. If you are interested in the details please send a personal mail to Steven Arzt and myself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top