[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange exception in VTA



Hi!

Today I tried invoking a VTA on a simple Hello World program. First that
did not work since Soot required the switch "--analyze-context" to be
set. So I just emulated the functionality of that switch (see below):

		//include JRE into classpath
	
soot.Scene.v().setSootClassPath("D:\\Apps\\Coding\\Java\\J2SDK\\sdk1.4.1
_01\\jre\\lib\\rt.jar;.");

		//add class
		soot.Scene.v().loadClassAndSupport( "Hello" );

		//make it an application class		
		((soot.SootClass)
soot.Scene.v().getClasses().getFirst()).setApplicationClass();

		//apply CHA
		InvokeGraph graph =
ClassHierarchyAnalysis.newInvokeGraph();

		//simulate switch --analyze-context (whatever that
means?)
		java.util.Iterator contextClassesIt =
Scene.v().getContextClasses().snapshotIterator();
		while (contextClassesIt.hasNext())
	
((SootClass)contextClassesIt.next()).setLibraryClass();

            //apply VTA	
		VariableTypeAnalysis VTA = new VariableTypeAnalysis(
graph );

But the last step leads to:

Exception in thread "main" java.lang.RuntimeException: Site is not part
of invoke graph!
        at
soot.jimple.toolkits.invoke.InvokeGraph.getTargetsOf(InvokeGraph.java:21
5)
        at
soot.jimple.toolkits.invoke.VTATypeGraph.<init>(VTATypeGraph.java:351)
        at
soot.jimple.toolkits.invoke.VariableTypeAnalysis.<init>(VariableTypeAnal
ysis.java:159)
        at Test.main(Test.java:14)

Does anyone have a clue what's going wrong? Did I forget some
initialization or sth.?

Thank you very much,
Eric

------------------------------------------------------------
Eric Bodden
CS-DIP full time student @ University of Kent at Canterbury
UKC internal phone: 5095
ICQ UIN: 12656220, secure mail on demand
Website: http://www.bodden.de