Re: [abc-users] adding jimple

From: Amjad Nusayr <anusayr_at_cs.nmsu.edu>
Date: Mon, 20 Apr 2009 16:19:54 -0600

Apologies I was not clear in my last email. Here is what i have
===============
myFoo= helperClass.getMethod("int myFoo()");
Local result=localgen.generateLocal(IntType.v(),"var1");
InvokeExpr incExpr= Jimple.v().newStaticInvokeExpr(myFoo.makeRef());
===============

My problem is that I cant seem to get the return value into the Local
*result*. Should I be using something else??

Amjad

Eric Bodden wrote:
> You just have to add a fresh Local to the method's Body. Then you
> assign the result to the Local and pass the local as an arument to the
> EqExpr.
>
> Eric
>
> 2009/4/20 Amjad Nusayr <anusayr_at_cs.nmsu.edu>:
>
>> Thanks Eric,
>> Another quick question. The method I'm calling returns an integer, How can I
>> store the return value from my invocation? I want to use it in a "EqExpr"
>> that compares it to an int.
>>
>> Amjad
>>
>> Eric Bodden wrote:
>>
>>> Hi Amjad.
>>>
>>> You have to make Soot aware of your helper class, using your AbcExtension.
>>> See:
>>>
>>> AbcExtension.addBasicClassesToSoot()
>>>
>>> Eric
>>>
>>> 2009/4/20 Amjad Nusayr <anusayr_at_cs.nmsu.edu>:
>>>
>>>
>>>> Hi,
>>>> I trying to add jimple stmts to the IR code generated in abc using
>>>> MyResidue.codeGen method. The jimple code I writing should call a method
>>>> from a helper class I created.
>>>> I used the code from this link to aid me.
>>>> http://www.sable.mcgill.ca/soot/tutorial/profiler2/index.html
>>>>
>>>> abc compiles but when run abc with my extension using the following
>>>> command
>>>> line
>>>> +soot -f J -soot -argfile files.lst
>>>>
>>>> I get
>>>> Exception in thread "main" polyglot.util.InternalCompilerError: unhandled
>>>> exception during we
>>>> ving/optimisation
>>>> at abc.main.CompileSequence.runSequence(CompileSequence.java:142)
>>>> at abc.main.Main.run(Main.java:406)
>>>> at abc.main.Main.main(Main.java:144)
>>>> Caused by: polyglot.util.InternalCompilerError: World.aj:29,3-32:4: Error
>>>> during matching
>>>> at
>>>>
>>>> abc.weaving.matching.AdviceApplication.doShadows(AdviceApplication.java:209)
>>>> at abc.main.AbcExtension.findMethodShadows(AbcExtension.java:541)
>>>> at abc.bbs.AbcExtension.findMethodShadows(AbcExtension.java:230)
>>>> at
>>>>
>>>> abc.weaving.matching.AdviceApplication.doMethod(AdviceApplication.java:275)
>>>> at
>>>>
>>>> abc.weaving.matching.AdviceApplication.computeAdviceLists(AdviceApplication.java:3
>>>> 2)
>>>> at
>>>>
>>>> abc.weaving.aspectinfo.GlobalAspectInfo.computeAdviceLists(GlobalAspectInfo.java:4
>>>> 2)
>>>> at abc.main.CompileSequence.weave(CompileSequence.java:447)
>>>> at abc.main.CompileSequence.runSequence(CompileSequence.java:115)
>>>> ... 2 more
>>>> Caused by: java.lang.ExceptionInInitializerError
>>>> at
>>>> abc.bbs.weaving.aspectinfo.ProbabilityD.matchesAt(ProbabilityD.java:52)
>>>> at
>>>> abc.weaving.aspectinfo.ShadowPointcut.matchesAt(ShadowPointcut.java:38)
>>>> at abc.weaving.aspectinfo.AndPointcut.matchesAt(AndPointcut.java:65)
>>>> at abc.weaving.aspectinfo.AndPointcut.matchesAt(AndPointcut.java:65)
>>>> at abc.weaving.aspectinfo.AndPointcut.matchesAt(AndPointcut.java:65)
>>>> at
>>>> abc.weaving.matching.AdviceApplication$2.run(AdviceApplication.java:115)
>>>> at
>>>>
>>>> abc.weaving.matching.AdviceApplication.doShadows(AdviceApplication.java:192)
>>>> ... 9 more
>>>> Caused by: java.lang.RuntimeException: This operation requires resolving
>>>> level SIGNATURES but
>>>> Helper is at resolving level HIERARCHY
>>>> If you are extending Soot, try to add the following call before calling
>>>> soot.Main.main(..):
>>>> Scene.v().addBasicClass(Helper,SIGNATURES);
>>>> Otherwise, try whole-program mode (-w).
>>>> at soot.SootClass.checkLevel(SootClass.java:121)
>>>> at soot.SootClass.addMethod(SootClass.java:570)
>>>> at soot.coffi.Util.resolveFromClassFile(Util.java:249)
>>>> at soot.CoffiClassSource.resolve(CoffiClassSource.java:39)
>>>> at soot.SootResolver.bringToHierarchy(SootResolver.java:194)
>>>> at soot.SootResolver.bringToSignatures(SootResolver.java:219)
>>>> at soot.SootResolver.processResolveWorklist(SootResolver.java:139)
>>>> at soot.SootResolver.resolveClass(SootResolver.java:124)
>>>> at soot.Scene.loadClass(Scene.java:390)
>>>> at soot.Scene.loadClassAndSupport(Scene.java:375)
>>>> at
>>>>
>>>> abc.bbs.weaving.residues.ProbabilityDResidue.<clinit>(ProbabilityDResidue.java:37)
>>>> ... 16 more
>>>>
>>>>
>>>> Could someone tell me what this means and how to fix it.
>>>>
>>>> thanks
>>>> Amjad
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
>
>
Received on Mon Apr 20 2009 - 23:20:05 BST

This archive was generated by hypermail 2.2.0 : Mon Apr 20 2009 - 23:30:12 BST