Hi John,
That’s strange, your command-line looks good to me in principle. Your exclusion is not correct, you have to provide package or class names which would probably be something like com.freemarker.*. Soot does not search for substrings here, but for packages. Another option would be not to explicitly exclude these classes, but simply not have them on the Soot classpath. In that case, they will automatically become phantom classes.
The other question is whether you really want to prepend the JVM’s classpath to your Soot classpath using –pp if you are ok with ignoring libraries at some other place. Is there a specific reason for not excluding the JDK as well? As recommended above, I would just remove it from the Soot classpath.
The strange call edge you are experiencing doesn’t sound right to me. Can you provide a minimal working example that provides the same kind of callgraph with similar wrong edges, but has a more manageable size for debugging?
Best regards,
Steven
Hi John,
If the package names are freemarker.*, it’s important to put the asterisk into the exclusion option on the Soot command line as well. Otherwise, Soot will assume that there is a single class called “freemarker” which you would like to exclude.
If your code under analysis references a class which is not on the Soot classpath and –allow-phantom-refs is used, this class will automatically be considered as a phantom. Nothing will be loaded, because Soot cannot know where to load it from. If you exclude a class, its structure (method signatures, etc.) will be loaded, but it will be marked as a library class. If you specify –no-bodies-for-excluded, Soot will not load any bodies for those classes, even if some code tries to access the body. Therefore, not putting the class on the classpath is the most rigorous option for guaranteeing that it will not be loaded.
Your analysis then needs to deal with such cases. If you have a call to a.foo() and the type of the variable “a” refers to a phantom class, there will not be a callgraph edge from the call site to anywhere and thus there will not be an IFDS call edge. There will, however, still be an IFDS call-to-return edge in which you can detect that you are dealing with such an exclusion case and apply e.g., an external library model to make up for the information loss. Depending on your analysis, you might also be able to simply ignore the effects of the method call on your data flow abstraction, that’s something you as the analysis designer need to decide.