[Soot-list] Question about class resolving

Ondrej Lhotak olhotak at uwaterloo.ca
Tue Feb 7 17:18:47 EST 2006


Soot only retrieves all the method bodies that will be run through the
intraprocedural packs AFTER all the interprocedural packs are done. So,
if you look to see which method bodies have been retrieved in an
interprocedural pack, you will only see those that were retrieved
because they were needed by call graph construction, which are those
reachable from the entry points. If test is not specified as the main
class, and therefore an entry point, methods reachable only from
test.main() are not retrieved until after the interprocedural packs.
However, if you need them, there is no harm in retrieving them yourself.
Soot will remember that a method has been retrieved and will not
retrieve it more than once.

Ondrej

On Tue, Feb 07, 2006 at 04:59:37PM -0500, mbatch at cs.mcgill.ca wrote:
> Hello folks,
> 
> I have a simple java test program. Class 'test' subclasses class 'B'.
> Class 'B' subclasses class 'A'. Each has an <init> constructor method, so
> both test and B call super (and A implicitly calls super on
> java.lang.Object).
> 
> I wrote a simple SceneTransformer that iterates over all application
> classes and prints out (for each method in each class) whether an active
> body exists or not.
> 
> If I call soot and pass 'test' as the main class:
> 
> "soot.MySimpleTransformer -main-class test -w A B test"
> 
> Then all methods found have active bodies. However, if I do not specify a
> main class ("soot.MySimpleTransformer -w A B test") I get the resulting
> error:
> 
> Testing SceneTransformer...
> 	Processing A
> <init> has no body
> 	Processing test
> <init> has no body
> main has no body
> toString has active body
> 	Processing B
> <init> has no body
> toString has active body
> <clinit> has no body
> Transforming A...
> Transforming test...
> Transforming B...
> Writing to sootOutput/A.class
> Writing to sootOutput/test.class
> Writing to sootOutput/B.class
> Soot finished on Tue Feb 07 16:43:28 EST 2006
> 
> 
> As you can see there are many methods with no active bodies. Can anybody
> explain to me why this would be so? Why would soot resolve some methods
> and not others in a classfile based on whether the main class is set or
> not? I have attached the java source files.
> 
> Michael Batchelder
> Sable Research Group
> McGill University
> Montreal, PQ



> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list



More information about the Soot-list mailing list