[Soot-list] Instrumenting OSGi bundles

Nuno Machado nmachado at gsd.inesc-id.pt
Mon Feb 6 12:10:39 EST 2012


Yes, it works fine now. 
I just didn't know that SIGNATURES value has to be called as SootClass.SIGNATURES, so I was wondering if it was referring to something else, as I was having an error for just having Scene.v().addBasicClass("java.lang.Thread",SIGNATURES)...

Thank you for your help!

Regards,
Nuno


On Feb 6, 2012, at 4:47 PM, Eric Bodden wrote:

> Hi.
> 
> The exception explicitly asks you to try this:
> Scene.v().addBasicClass("java.lang.Thread",SIGNATURES);
> 
> ... before calling soot.Main.main(..).
> 
> Did you try adding this call?
> 
> Eric
> 
> On 6 February 2012 17:30, Nuno Machado <nmachado at gsd.inesc-id.pt> wrote:
>> 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
>> 
>> 
> 
> 
> 
> -- 
> Eric Bodden, Ph.D., http://bodden.de/
> Head of Secure Software Engineering Group at EC SPRIDE
> Principal Investigator in Secure Services at CASED
> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt



More information about the Soot-list mailing list