[Soot-list] Getting jimple methods body

Mike Shah mshah.475 at gmail.com
Wed Oct 16 11:11:37 EDT 2013


Hello,

I am analyzing a series of jimple statements, and if they are methods I
would like to get the methods body.

Here is a chunk of sample code of what I am trying to do.

// If our statement is invoking then I claim we're calling some method
if(stmt.containsInvokeExpr())
      // Check if the scene contains this method
      if(Scene.v().containsMethod(stmt.toString()))
            // I've tried to then get the method two different ways,
settling for the uncomment code below
            //SootMethod method = ((InvokeExpr)stmt).getMethod();
             SootMethod method = Scene.v().getMethod(stmt.toString());
            // Load any supporting classes -- I'm not sure if I need this
step at all, but I thought we may need the class.
             SootClass classWeNeedToLoad = method.getDeclaringClass();

 Scene.v().loadClassAndSupport(classWeNeedToLoad.toString());
            // Then I think I want to get the methods activeBody next so we
can see the stmt's inside of it
            Body jimpleCodeBodyOfMethod = method.getActiveBody();
            // Then finally  Iterate through a chain of units, producing a
new series of jimple stmts

Any help is sincerely appreciated.

Thanks for your time,
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20131016/6cb336d3/attachment.html 


More information about the Soot-list mailing list