[Soot-list] Soot Instrumentation

Steven Arzt Steven.Arzt at cased.de
Wed Jan 27 11:44:43 EST 2016


Hi desperate student,

 

All the classes that start with J are implementations of the respective interfaces. A Soot user should never reference them explicitly, only the interfaces, e.g., use InvokeExpr instead of JInvokeExpr. To construct instances of these types use Jimple.v().newXXX(). The Jimple singleton class contains factory methods for all the different Jimple language constructs.

 

Now let’s move on to method references. You first need to get hold of the method you want to reference. The SootMethod class has a method called makeRef() to then create a reference. To get a method, use Scene.v().getMethod(). You can also take a SootClass and get the method from there, that’s equivalent.

 

A Value is essentially the base class of everything that can be used as an expression in Soot. It can be some constant, an invoke expression, or a “this” reference. Get a “this” reference, once again grab the SootMethod and then call method.getActiveBody().getThisLocal() on it.

 

Best regards,

  Steven

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Doenerspiesser Doenerspiesser
Gesendet: Mittwoch, 27. Januar 2016 17:04
An: soot-list at CS.McGill.CA
Betreff: [Soot-list] Soot Instrumentation

 

Dear Sir or Madam,

 

i have to use the manual instrumentation function of Soot via java code. There are two problems, which i can´t solve: the constructor of "JStaticInvokeExpr" needs 2 parameter:

-a "SootMethodRef": where can i get this from? its just a interface and there is no class called "soot.SootMethodRefImpl" (i backtracked my jimple code and one "JStaticInvokeExpr" instance had a parameter with this class)

-a List of Values: first should be in my case a this reference- how can i access a this reference dynamically?? "soot.jimple.This.Ref" constructor needs "RefType" as input and "RefType" constructor needs "Singletons.Global" as input. Something like "ThisRef thiss=new ThisRef(new RefType(Singletons.Global));" doesn´t work.

 

Yours sincerely,

 

a desperated student

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20160127/8c2f2c8c/attachment.html 


More information about the Soot-list mailing list