[Soot-list] No Method Source Set for Method <{method signature here}>

Steven Arzt Steven.Arzt at cased.de
Fri Jul 24 12:53:22 EDT 2015


Hi Jason,

 

Normally, you never have to explicitly load a method. Soot will automatically load all methods of all classes on your process-dir for you. These classes are also automatically set as application classes. For your analysis or transformation, you register a BodyTransformer or a SceneTransformer and then call Soot’s main method. Soot will make sure that all application classes are properly loaded before invoking your custom transformers.

 

Soot can be thought of as a compiler pipeline. You put your program in and register different actions that shall be done to it. In Soot, these actions are organized in packs and phases (see http://www.bodden.de/2008/11/26/soot-packs/). The framework handles all the rest such as loading classes, finding dependencies, and so on.

 

There are some special cases in which you need to deviate from this path, but those are rare and then you need to exactly know when to do what. Loading a method body for instance only works if the method can have a body at all. If it’s, for instance, native or abstract and you try to load its body, you’ll get the exception you have reported. That’s what I meant with “inner workings”: Normally, the framework does all these checks and gives you a valid Scene to work with inside your transformers.

 

Best regards,

  Steven

 

Von: Jason Ott [mailto:jott002 at ucr.edu] 
Gesendet: Freitag, 24. Juli 2015 18:46
An: Steven Arzt
Cc: soot-list at cs.mcgill.ca
Betreff: Re: [Soot-list] No Method Source Set for Method <{method signature here}>

 

This is the "inner workings"?  I thought retrieving method bodies was one of the basic functionalities of Soot.  I was looking through the source on Github, and I don't fully understand why Soot can properly retrieve the class, but the method bodies aren't being built properly; while both are concrete.  I don't think I'm misusing Soot by using it in this way.  Is there something more concrete or a more direct path you could direct me to help me understand this problem more fully.

 

On Fri, Jul 24, 2015 at 9:39 AM, Steven Arzt <Steven.Arzt at cased.de> wrote:

Hi Jason,

 

You are really accessing internals of Soot. This is something I would generally avoid unless you have a very thorough understanding of Soot’s inner workings. If you for instance try to load the body of a non-concrete method (which by definition cannot have a body), this will fail. Since you are accessing the loader directly, you have to take care of all of that stuff on your own.

 

Best regards,

  Steven 

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Jason Ott
Gesendet: Freitag, 24. Juli 2015 02:22
An: soot-list at cs.mcgill.ca
Betreff: [Soot-list] No Method Source Set for Method <{method signature here}>

 

I have a thread that identifies a class to bring into the Soot Scene.  I do so through the following method:

protected synchronized SootClass bringClassToScene(String className) {
    SootClass sootClass;
    sootClass = Scene.v().forceResolve(className, SootClass.BODIES);
    sootClass.setApplicationClass();
    return sootClass;
}

Which is invoked by means of: SootClass sootClass = bringClassToScene(className);

 

className is simply a string in the format: "path.to.package.ClassName".

 

I then try to get the active bodies of a method in the class by means of: 

for(SootMethod m : sootClass.getMethods()) {

Body body = m.retrieveActiveBody();

// do other work here

}

 

At which point I get the following error: 

 

java.lang.RuntimeException: No method source set for method <com.android.server.power.PowerManagerService$BinderService: void <init>(com.android.server.power.PowerManagerService)>

Error retrieving active body of: <com.android.server.power.PowerManagerService$BinderService: void <init>(com.android.server.power.PowerManagerService)>

 

I am using Soot with the following arguments:

-cp /path/to/classes/:/path/to/other/classes/:. -f J -w -allow-phantom-refs


I do not understand why Soot cannot fetch the active body of a given method.  This doesn't happen with every method, but I have not been able to discern any pattern.

 

Thanks,

Jason

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150724/59c33c60/attachment.html 


More information about the Soot-list mailing list