[Soot-list] Problem in Call graph construction

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Wed Nov 17 08:07:19 EST 2010


Hi Asif.

There is several problems with your code, which arise that you are
using Soot in a rather "manual" way instead of just letting it run its
pre-defined configuration passes.


The easiest way to run CHA is to simply enable it through the
respective phase options:
http://www.sable.mcgill.ca/soot/tutorial/phase/index.html

Your main method should just access the PackManager through
PackManager.v() and add a SceneTransformer to the "wjtp" pack. This
SceneTransformer will then be run just after the CHA has finished, so
that you can access information from the CHA.

In the end, your main method should call Soot's main method with the
original argument array.

To then run the analysis, just call your main method with -w as an
argument (to enable all the w* packs) and with InheritanceTest as an
argument, to analyze your class.

Eric

--
Dr. Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



On 16 November 2010 15:41, Asif Iqbal <iqbala24 at mcmaster.ca> wrote:
> Hi Eric and others,
> I am trying to generate call graph for a simple Java class. Below is my code
> snippet:
>         .....
> Scene.v().setSootClassPath(Scene.v().getSootClassPath() + ":" +
>                 ".:" +
>                  "/Developer/Projects/SootCallGraph");
>                  System.out.println(Scene.v().getSootClassPath());
>
>         SootClass sootClass =
> Scene.v().loadClassAndSupport("InheritanceTest");
>         sootClass.setApplicationClass();
>         Scene.v().setMainClass(sootClass);
>         CHATransformer.v().transform();
>         String [] opts = {"-W", "InheritanceTest" };
>         String[] args = {"-f", "X", "InheritanceTest"};
>         Main.main(opts);
>         //Main.main(args);
> .....
> At the line Main.main(opts) I get the following exception:
> Exception in thread "main" java.lang.RuntimeException: This operation
> requires resolving level BODIES but java.lang.Object is at resolving level
> SIGNATURES
> If you are extending Soot, try to add the following call before calling
> soot.Main.main(..):
> Scene.v().addBasicClass(java.lang.Object,BODIES);
> Otherwise, try whole-program mode (-w).
> Do you have any idea what is causing this ? Note that instead
> of Main.main(opts) if I use the commented line Main.main(args) then it works
> and successfully generates the xml. So is there any problem in the whole
> program mode ?
> Sincerely,
> Asif Iqbal
> Graduate Student
> Department of Computing and Software
> McMaster University
> Hamilton, ON
> Canada L8S4K1
> iqbala24 at mcmaster.ca
> Cell: +1 905 746-7459
>
>
>
>


More information about the Soot-list mailing list