[Soot-list] Instrumenting OSGi bundles

Nuno Machado nmachado at gsd.inesc-id.pt
Mon Feb 6 11:30:47 EST 2012


Hi Eric,

I now dropped these lines:
	Options.v().set_whole_program(true);
	Options.v().set_app(true);
	Scene.v().setMainClass(appclass);


And the number of analyzed packages indeed decreased. But then I get the following error:

Exception in thread "main" java.lang.RuntimeException: This operation requires resolving level SIGNATURES but java.lang.Thread is at resolving level HIERARCHY
If you are extending Soot, try to add the following call before calling soot.Main.main(..):
Scene.v().addBasicClass(java.lang.Thread,SIGNATURES);
Otherwise, try whole-program mode (-w).
	at soot.SootClass.checkLevel(SootClass.java:121)
	at soot.SootClass.declaresMethod(SootClass.java:326)
	at soot.Scene.grabMethod(Scene.java:348)
	at soot.Scene.getMethod(Scene.java:368)
	at soottest.CalculatorTransformer$MyInstrumenter.addMethodAccept(CalculatorTransformer.java:229)
	at soottest.CalculatorTransformer$MyInstrumenter.internalTransform(CalculatorTransformer.java:137)
	at soot.BodyTransformer.transform(BodyTransformer.java:51)
	at soot.Transform.apply(Transform.java:104)
	at soot.BodyPack.internalApply(BodyPack.java:49)
	at soot.Pack.apply(Pack.java:124)
	at soot.PackManager.runBodyPacks(PackManager.java:774)
	at soot.PackManager.runBodyPacks(PackManager.java:454)
	at soot.PackManager.runBodyPacks(PackManager.java:373)
	at soot.PackManager.runPacks(PackManager.java:350)
	at soot.Main.run(Main.java:198)
	at soot.Main.main(Main.java:141)
	at soottest.CalculatorTransformer.main(CalculatorTransformer.java:118)


The error is because I am creating a static reference as follows:
String methodSig1 ="<" + "java.lang.Thread" +": java.lang.Thread currentThread()>";			
SootMethodRef mr1 = Scene.v().getMethod(methodSig1).makeRef();	       
Value invokeCurrentThread = Jimple.v().newStaticInvokeExpr(mr1);	

So, this means that I should still use whole-program mode? 
Otherwise, how can I add those SIGNATURES? 

Thank you,
Nuno

On Feb 6, 2012, at 3:45 PM, Eric Bodden wrote:

> Hi.
> 
> You don't really want to enable whole-program mode, so get rid of this
> line here:
> 
> 		Options.v().set_whole_program(true);
> 
> That means you can also drop this line:
> 
>> Scene.v().setMainClass(appclass);
> 
>> Just another question: in order to instrument the osgi classes that I need,
>> I have to add a lot of .jar files to the class path, which I don't want to
>> instrument. For that reason, I defined a list of packages to be excluded (as
>> shown in the code above). However, it seems not to be working, as soot still
>> analyzes them and put some instrumented classes in the sootoutput folder. Am
>> I missing something or doing anything wrong?
> 
> That may also have to do with the fact that you currently have the
> whole-program mode enabled. But I am not 100% sure on this one.
> 
> Eric

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120206/ecbbbd1c/attachment-0001.html 


More information about the Soot-list mailing list