[Soot-list] Jimple jump to nopStmt

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Wed Apr 6 14:36:15 EDT 2011


Hi Pedro.

I think you may be misinterpreting the source of this error. If I am
correct than this has nothing to do with Nop statements vs. other
statements but rather with the use of insertBefore. The method
insertBefore is a bit special in the following sense. Say you insert a
unit U before a unit V, then the call to insertBefore will redirect to
U all jumps that previously went to V. Usually this is what one wants
but in special situations this may screw up the control flow, which I
believe may be happening in your case. Having said that, it's hard to
tell for sure without seeing your actual code.

There's a method insertBeforeNoRedirect that does the obvious.

HTH,
Eric

On 6 April 2011 12:38, Pedro Louro <pedrolour at gmail.com> wrote:
> Hello!
>
> I´m instrumenting code and I need to insert a jump to a nop Statment.
> The code is something like this:
>
> Stmt nop = Jimple.v().newNopStmt();
> units.insertBefore(nop, target);
> Stmt jump = Jimple.v().newGotoStmt(nop);
> units.insertBefore(jump, units.getPredOf(target));
>
> But when I see what is really inserted I get this:
> goto [?= (branch)]
>
> when I should get this
> goto [?= nop]
>
> and because that it just explodes with this error:
>
> java.lang.reflect.InvocationTargetException
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>        at java.lang.reflect.Method.invoke(Unknown Source)
>        at edu.hkust.leap.Main.run(Main.java:33)
>        at edu.hkust.leap.Main.transform(Main.java:23)
>        at edu.hkust.leap.Main.main(Main.java:17)
> Caused by: java.lang.StackOverflowError
>        at soot.baf.internal.AbstractBranchInst.toString(AbstractBranchInst.java:53)
>        at java.lang.String.valueOf(Unknown Source)
>        at java.lang.StringBuilder.append(Unknown Source)
>        at soot.baf.internal.AbstractBranchInst.toString(AbstractBranchInst.java:53)
>        at java.lang.String.valueOf(Unknown Source)
>        at java.lang.StringBuilder.append(Unknown Source)
>        at soot.baf.internal.AbstractBranchInst.toString(AbstractBranchInst.java:53)
>        at java.lang.String.valueOf(Unknown Source)
>        at java.lang.StringBuilder.append(Unknown Source)
> (...)
>
> If I set the goto to another Stmt it works fine, but not with Nop´s.
> Is there any limitation with this ?
>
> Thanks for the continuous help!
>
> Best Regards
> Pedro Louro
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>



-- 
Dr. Eric Bodden, http://bodden.de/
Principal Investigator in Secure Services at CASED
Coordinator of the CASED Advisory Board of Study Affairs
PostDoc at Software Technology Group, Technische Universität Darmstadt
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt


More information about the Soot-list mailing list