Skip to content
Advertisement

Soot – Get JimpleBody from a CFG

I’d like to get UnitGraph from a Java Class. I load it by ClassFile and get the method_info of main(). Then I create a CFG and try to convert it into a UnitGraph. My method is to get JimpleBody of the CFG and then create a UnitGraph. However, I can’t get JimpleBody by invoking cfg.jimplify(...) since it throws the following error:

JavaScript

My code is as follows:

JavaScript

I know there are other ways to create a UnitGraph, such as:

JavaScript

However, in this way, I need to set Scene.v().setSootClassPath(path) for jce.jar and rt.jar, which I don’t want to occur in my code. So if there is another way I can get UnitGraph without setting such a path, please help me.

Advertisement

Answer

Although I still can’t turn method_info into a SootMathod and then get a UnitGraph, I can use Options.v().set_prepend_classpath(true) to avoid set jce.jar and rt.jar dirctly. This also achieves my goal.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement