[Soot-list] Excluded & included not handled correctly?

Michael Faes rolve at trick17.ch
Thu Jan 24 07:31:32 EST 2013


Hi everyone,

I'm having issues using the -no-bodies-for-excluded options together 
with -include and -exclude.

I excluded java. classes but included java.util. classes. What happens 
is that they all end up being phantom. After investigating a bit, I 
found this method in SootResolver:

private void processResolveWorklist() {
   for( int i = SootClass.BODIES; i >= SootClass.HIERARCHY; i-- ) {
     while( !worklist[i].isEmpty() ) {
       SootClass sc = (SootClass) worklist[i].removeFirst();
       if( resolveEverything() ) {
         boolean onlySignatures = sc.isPhantom() || (
             Options.v().no_bodies_for_excluded() &&
             Scene.v().isExcluded(sc) &&
             // ^^^^^^^^^^^^^^^^^^^^^^^^
             !Scene.v().getBasicClasses().contains(sc.getName())
           );
         if( onlySignatures ) {
           bringToSignatures(sc);
           sc.setPhantomClass();
           if(sc.isPhantom()) {
             for( SootMethod m: sc.getMethods() ) {
               m.setPhantom(true);
             }
             for( SootField f: sc.getFields() ) {
               f.setPhantom(true);
             }
           }
         } else bringToBodies(sc);
       } else {
         switch(i) {
           case SootClass.BODIES: bringToBodies(sc); break;
           case SootClass.SIGNATURES: bringToSignatures(sc); break;
           case SootClass.HIERARCHY: bringToHierarchy(sc); break;
         }
       }
     }
   }
}

Notice that on lien 8 it only checks if the class is excluded, not if 
it's also included. But the description of the -exclude option clearly 
states:

 > If you specify both include and exclude options, first the classes
 > from all excluded packages are marked as library classes, then the
 > classes from all included packages are marked as application classes.

Am I correct that this is a bug or am I doing something wrong again?

Thanks for you help.
Michael


More information about the Soot-list mailing list