soot.options.Options Java Examples

The following examples show how to use soot.options.Options. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExceptionTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void exceptionControlFlowTestNoJDK1() throws IOException {
	Infoflow infoflow = initInfoflow();
	infoflow.setTaintWrapper(new EasyTaintWrapper(new File("EasyTaintWrapperSource.txt")));
   	infoflow.setSootConfig(new IInfoflowConfig() {
		
		@Override
		public void setSootOptions(Options options) {
			List<String> excludeList = new ArrayList<String>();
			excludeList.add("java.");
			excludeList.add("javax.");
			options.set_exclude(excludeList);
			options.set_prepend_classpath(false);
		}
		
	});
	
	List<String> epoints = new ArrayList<String>();
	epoints.add("<soot.jimple.infoflow.test.ExceptionTestCode: void exceptionControlFlowTest1()>");
	infoflow.computeInfoflow(appPath, null, epoints, sources, sinks);
	checkInfoflow(infoflow, 1);
}
 
Example #2
Source File: CFG.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
private void adjustLineNumberTable()
   {
if (!Options.v().keep_line_number())
    return;
if (method.code_attr == null)
    return;

attribute_info[] attributes = method.code_attr.attributes;

for (attribute_info element : attributes) {
    if (element instanceof LineNumberTable_attribute)
    {
	LineNumberTable_attribute lntattr =
	    (LineNumberTable_attribute)element;
	for (line_number_table_entry element0 : lntattr.line_number_table) {
	    Instruction oldinst = 
		element0.start_inst;
	    Instruction newinst =
		replacedInsns.get(oldinst);
	    if (newinst != null)
		element0.start_inst = newinst;
	}
    }
}
   }
 
Example #3
Source File: PackManager.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void writeOutput() {
      setupJAR();
      if(Options.v().verbose())
          PhaseDumper.v().dumpBefore("output");
      if( Options.v().output_format() == Options.output_format_dava ) {
          postProcessDAVA();
      }
      else if (Options.v().output_format() == Options.output_format_dex
      		|| Options.v().output_format() == Options.output_format_force_dex) {
      	writeOutput(reachableClasses());
      	dexPrinter.print();
      } else {
          writeOutput( reachableClasses() );
          tearDownJAR();
      }
      postProcessXML( reachableClasses() );

if (!Options.v().no_writeout_body_releasing())
	releaseBodies( reachableClasses() );
      if(Options.v().verbose())
          PhaseDumper.v().dumpAfter("output");
  }
 
Example #4
Source File: Scene.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/** Load the set of classes that soot needs, including those specified on the
 *  command-line. This is the standard way of initialising the list of
 *  classes soot should use.
 */
public void loadNecessaryClasses() {
	loadBasicClasses();
    
	for (String name : Options.v().classes()) {
        loadNecessaryClass(name);
    }

    loadDynamicClasses();

    if(Options.v().oaat()) {
    	if(Options.v().process_dir().isEmpty()) {
    		throw new IllegalArgumentException("If switch -oaat is used, then also -process-dir must be given.");
    	}
    } else {
     for( final String path : Options.v().process_dir() ) {
         for (String cl : SourceLocator.v().getClassesUnder(path)) {
         	SootClass theClass = loadClassAndSupport(cl);
         	theClass.setApplicationClass();
         }
     }
    }

    prepareClasses();
    setDoneResolving();
}
 
Example #5
Source File: PackManager.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
private void runWholeProgramPacks() {
    if (Options.v().whole_shimple()) {
        ShimpleTransformer.v().transform();
        getPack("wspp").apply();
        getPack("cg").apply();
        getPack("wstp").apply();
        getPack("wsop").apply();
    } else {
        getPack("wjpp").apply();
        getPack("cg").apply();
        getPack("wjtp").apply();
        getPack("wjop").apply();
        getPack("wjap").apply();
    }
    PaddleHook.v().finishPhases();
}
 
Example #6
Source File: AbstractASMBackend.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Emits the bytecode for all references to inner classes if present
 */
protected void generateInnerClassReferences() {
	if (sc.hasTag("InnerClassAttribute")
			&& !Options.v().no_output_inner_classes_attribute()) {
		InnerClassAttribute ica = (InnerClassAttribute) sc
				.getTag("InnerClassAttribute");
		List<InnerClassTag> sortedTags = new ArrayList<InnerClassTag>(ica.getSpecs());
		Collections.sort(sortedTags, new SootInnerClassComparator());
		for (InnerClassTag ict : sortedTags) {
			String name = slashify(ict.getInnerClass());
			String outerClassName = slashify(ict.getOuterClass());
			String innerName = slashify(ict.getShortName());
			int access = ict.getAccessFlags();
			cv.visitInnerClass(name, outerClassName, innerName, access);
		}
	}
}
 
Example #7
Source File: GraphComparer.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
protected boolean cannotReallyThrowTo(Unit head, Unit tail) {
    if (Options.v().verbose()) 
	G.v().out.println("ExceptionalToClassicCompleteUnitGraphComparer.cannotReallyThrowTo() called.");
    if (super.cannotReallyThrowTo(head, tail)) {
	return true;
    } else {
	// A ClassicCompleteUnitGraph will consider the predecessors
	// of the first trapped Unit as predecessors of the Trap's
	// handler.
	List headsSuccs = exceptional.getSuccsOf(head);
	List tailsTraps = returnHandlersTraps(tail);
	for (Iterator it = tailsTraps.iterator(); it.hasNext(); ) {
	    Trap tailsTrap = (Trap) it.next();
	    Unit tailsFirstTrappedUnit = tailsTrap.getBeginUnit();
	    if (headsSuccs.contains(tailsFirstTrappedUnit)) {
		Collection succsDests = exceptional.getExceptionDests(tailsFirstTrappedUnit);
		if ((! destCollectionIncludes(succsDests, tailsTrap)) ||
		    (! CompleteUnitGraph.mightHaveSideEffects(tailsFirstTrappedUnit))) {
		    return true;
		}
	    }
	}
	return false;
    }
}
 
Example #8
Source File: SourceLocator.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public String getOutputDir() {
    String ret = Options.v().output_dir();
    if( ret.length() == 0 ) {
    	ret = "sootOutput";
     if (Options.v().output_jar())
     	ret += File.separatorChar + "out.jar";
    }
    File dir = new File(ret);

    if (!dir.exists()) {
        try {
            if( !Options.v().output_jar() ) {
                dir.mkdirs();
            }
        } catch (SecurityException se) {
            G.v().out.println("Unable to create " + ret);
            throw new CompilationDeathException(CompilationDeathException.COMPILATION_ABORTED);
        }
    }
    return ret;
}
 
Example #9
Source File: ImplicitFlowTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Test(timeout=300000)
public void implicitFlowTaintWrapperNegativeTest() throws IOException{
	Infoflow infoflow = initInfoflow();
	infoflow.setInspectSinks(false);
	infoflow.setEnableImplicitFlows(true);
	infoflow.setTaintWrapper(new EasyTaintWrapper(Collections.<String, Set<String>>emptyMap()));
   	infoflow.setSootConfig(new IInfoflowConfig() {
		
		@Override
		public void setSootOptions(Options options) {
			options.set_include(Collections.<String>emptyList());
			List<String> excludeList = new ArrayList<String>();
			excludeList.add("java.");
			excludeList.add("javax.");
			options.set_exclude(excludeList);
			options.set_prepend_classpath(false);
		}
		
	});

	List<String> epoints = new ArrayList<String>();
    epoints.add("<soot.jimple.infoflow.test.ImplicitFlowTestCode: void implicitFlowTaintWrapperTest()>");
	infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
	negativeCheckInfoflow(infoflow);
}
 
Example #10
Source File: ImplicitFlowTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Test(timeout=300000)
public void implicitFlowTaintWrapperTest() throws IOException{
	Infoflow infoflow = initInfoflow();
	infoflow.setInspectSinks(false);
	infoflow.setEnableImplicitFlows(true);
	infoflow.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
   	infoflow.setSootConfig(new IInfoflowConfig() {
		
		@Override
		public void setSootOptions(Options options) {
			options.set_include(Collections.<String>emptyList());
			List<String> excludeList = new ArrayList<String>();
			excludeList.add("java.");
			excludeList.add("javax.");
			options.set_exclude(excludeList);
			options.set_prepend_classpath(false);
		}
		
	});

	List<String> epoints = new ArrayList<String>();
    epoints.add("<soot.jimple.infoflow.test.ImplicitFlowTestCode: void implicitFlowTaintWrapperTest()>");
	infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
	checkInfoflow(infoflow, 1);	
}
 
Example #11
Source File: ImplicitFlowTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Test(timeout=300000)
public void callToReturnTest() throws IOException{
	// not yet supported
	Infoflow infoflow = initInfoflow();
	infoflow.setInspectSinks(false);
	infoflow.setEnableImplicitFlows(true);
	infoflow.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
   	infoflow.setSootConfig(new IInfoflowConfig() {
		
		@Override
		public void setSootOptions(Options options) {
			options.set_include(Collections.<String>emptyList());
			List<String> excludeList = new ArrayList<String>();
			excludeList.add("java.");
			excludeList.add("javax.");
			options.set_exclude(excludeList);
			options.set_prepend_classpath(false);
		}
		
	});

	List<String> epoints = new ArrayList<String>();
    epoints.add("<soot.jimple.infoflow.test.ImplicitFlowTestCode: void callToReturnTest()>");
	infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
	checkInfoflow(infoflow, 1);	
}
 
Example #12
Source File: OtherTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Test(timeout=300000)
public void doPrivilegedTest3_NoJDK() {
   	Infoflow infoflow = initInfoflow();
   	infoflow.setSootConfig(new IInfoflowConfig() {
		
		@Override
		public void setSootOptions(Options options) {
			List<String> excludeList = new ArrayList<String>();
			excludeList.add("java.");
			excludeList.add("javax.");
			options.set_exclude(excludeList);
			options.set_prepend_classpath(false);
		}
		
	});
   	List<String> epoints = new ArrayList<String>();
   	epoints.add("<soot.jimple.infoflow.test.OtherTestCode: void doPrivilegedTest3()>");
	infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
	checkInfoflow(infoflow, 1);
	Assert.assertTrue(infoflow.getResults().isPathBetweenMethods(sink, sourceDeviceId));		
}
 
Example #13
Source File: BafASMBackend.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected int getMinJavaVersion(SootMethod method) {
	final BafBody body = getBafBody(method);		
	int minVersion = Options.java_version_1_1;

	for (Unit u : body.getUnits()) {
		if (u instanceof DynamicInvokeInst) {
			return Options.java_version_1_7;
		}
		if (u instanceof PushInst) {
			if (((PushInst) u).getConstant() instanceof ClassConstant) {
				minVersion = Options.java_version_1_5;
			}
		}
	}

	return minVersion;
}
 
Example #14
Source File: ConfigSecuriBench.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Override
	public void setSootOptions(Options options) {
		// explicitly include packages for shorter runtime:
		List<String> includeList = new LinkedList<String>();
		includeList.add("java.lang.*");
		includeList.add("java.util.*");
		includeList.add("java.io.*");
		includeList.add("sun.misc.*");
		includeList.add("java.net.*");
		includeList.add("org.apache.http.*");
		includeList.add("de.test.*");
		includeList.add("soot.*");
		includeList.add("securibench.*");
		includeList.add("javax.servlet.*");
		includeList.add("com.oreilly.servlet.*");
//		includeList.add("java.security.");
//		includeList.add("javax.crypto.");
		options.set_include(includeList);
		options.set_output_format(Options.output_format_none);
	}
 
Example #15
Source File: Scene.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
    * Returns the {@link ThrowAnalysis} to be used by default when
    * constructing CFGs which include exceptional control flow.
    *
    * @return the default {@link ThrowAnalysis}
    */
   public ThrowAnalysis getDefaultThrowAnalysis() 
   {
if( defaultThrowAnalysis == null ) {
    int optionsThrowAnalysis = Options.v().throw_analysis();
    switch (optionsThrowAnalysis) {
    case Options.throw_analysis_pedantic:
	defaultThrowAnalysis = PedanticThrowAnalysis.v();
	break;
    case Options.throw_analysis_unit:
	defaultThrowAnalysis = UnitThrowAnalysis.v();
	break;
    default:
	throw new IllegalStateException("Options.v().throw_analysi() == " +
					Options.v().throw_analysis());
    }
}
return defaultThrowAnalysis;
   }
 
Example #16
Source File: ConfigForPolicyEnforcementPoint.java    From DroidForce with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void setSootOptions(Options options) {
	options.set_validate(true);
	
	Options.v().set_allow_phantom_refs(true);
	Options.v().set_prepend_classpath(false);
	Options.v().set_whole_program(true);
	
	
	//input format
	Options.v().set_src_prec(Options.src_prec_apk);
	//the output is an unsigned apk file
	Options.v().set_output_format(Options.output_format_dex);	
	Options.v().set_process_dir(Collections.singletonList(Settings.instance.apkFile));
	
	options.set_soot_classpath(Settings.instance.bin
			+ File.pathSeparator + Scene.v().defaultClassPath());
	
	Settings.instance.initialiseInstrumentationClasses();
}
 
Example #17
Source File: SimpleLocalDefs.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
SimpleLocalDefs(DirectedGraph<Unit> graph, Local[] locals, boolean omitSSA) {
	if (Options.v().time())
		Timers.v().defsTimer.start();

	final int N = locals.length;
	
	// reassign local numbers
	int[] oldNumbers = new int[N];
	for (int i = 0; i < N; i++) {
		oldNumbers[i] = locals[i].getNumber();
		locals[i].setNumber(i);
	}

	init(graph, locals, omitSSA);

	// restore local numbering
	for (int i = 0; i < N; i++) {
		locals[i].setNumber(oldNumbers[i]);
	}

	if (Options.v().time())
		Timers.v().defsTimer.end();
}
 
Example #18
Source File: CFGViewer.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
private void initialize(Map<String, String> options) {
	if (drawer == null) {
		drawer = new CFGToDotGraph();
		drawer.setBriefLabels(PhaseOptions.getBoolean(options, briefLabelOptionName));
		drawer.setOnePage(!PhaseOptions.getBoolean(options, multipageOptionName));
		drawer.setUnexceptionalControlFlowAttr("color", "black");
		drawer.setExceptionalControlFlowAttr("color", "red");
		drawer.setExceptionEdgeAttr("color", "lightgray");
		drawer.setShowExceptions(Options.v().show_exception_dests());
		ir = CFGIntermediateRep.getIR(PhaseOptions.getString(options, irOptionName));
		graphtype = CFGGraphType.getGraphType(PhaseOptions.getString(options, graphTypeOptionName));

		AltClassLoader.v().setAltClassPath(PhaseOptions.getString(options, altClassPathOptionName));
		AltClassLoader.v().setAltClasses(
				new String[] { "soot.toolkits.graph.ArrayRefBlockGraph", "soot.toolkits.graph.Block",
						"soot.toolkits.graph.Block$AllMapTo", "soot.toolkits.graph.BlockGraph",
						"soot.toolkits.graph.BriefBlockGraph", "soot.toolkits.graph.BriefUnitGraph",
						"soot.toolkits.graph.CompleteBlockGraph", "soot.toolkits.graph.CompleteUnitGraph",
						"soot.toolkits.graph.TrapUnitGraph", "soot.toolkits.graph.UnitGraph",
						"soot.toolkits.graph.ZonedBlockGraph", });
	}
}
 
Example #19
Source File: TypeResolverBV.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
private TypeResolverBV(JimpleBody stmtBody, Scene scene)
{
  this.stmtBody = stmtBody;
  hierarchy = ClassHierarchy.classHierarchy(scene);

  OBJECT = hierarchy.OBJECT;
  NULL = hierarchy.NULL;
  typeVariable(OBJECT);
  typeVariable(NULL);
  
  // hack for J2ME library, reported by Stephen Cheng 
  if (!Options.v().j2me()) {
    typeVariable(hierarchy.CLONEABLE);
    typeVariable(hierarchy.SERIALIZABLE);
  }
}
 
Example #20
Source File: DavaPrinter.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
/**
 *   Prints out the method corresponding to b Body, (declaration and body),
 *   in the textual format corresponding to the IR used to encode b body.
 *
 *   @param out a PrintWriter instance to print to.
 */
private void printTo(Body b, PrintWriter out) {
    b.validate();

    String decl = b.getMethod().getDavaDeclaration();

    {
        out.println("    " + decl);
        for( Iterator<Tag> tIt = b.getMethod().getTags().iterator(); tIt.hasNext(); ) {
            final Tag t = tIt.next();
            if (Options.v().print_tags_in_output()){
                out.println(t);
            }
        }
        out.println("    {");


 /*
   The locals are now printed out from within the toString method of ASTMethodNode
   Nomair A Naeem 10-MARCH-2005
 */
        //printLocalsInBody(b, out);
    }

    printStatementsInBody(b, out);

    out.println("    }");

}
 
Example #21
Source File: AbstractFlowAnalysis.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
/** Constructs a flow analysis on the given <code>DirectedGraph</code>. */
public AbstractFlowAnalysis(DirectedGraph<N> graph)
{
    unitToBeforeFlow = new IdentityHashMap<N,A>(graph.size() * 2 + 1);
    this.graph = graph;
    if (Options.v().interactive_mode()){
        InteractionHandler.v().handleCfgEvent(graph);
    }
}
 
Example #22
Source File: Settings.java    From DroidForce with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void initialiseSoot(){
	if(apkFile == null)
		throw new RuntimeException("There has to be an apk for the analysis");
	
	Options.v().set_allow_phantom_refs(true);
	Options.v().set_validate(true);
	Options.v().set_prepend_classpath(true);
	//no cfg needed
	Options.v().set_whole_program(false);
	
	
	//input format
	Options.v().set_src_prec(Options.src_prec_apk);
	//the output is an unsigned apk file
	Options.v().set_output_format(Options.output_format_dex);
		
	Options.v().set_process_dir(Collections.singletonList(apkFile));
	if (instance.androidJar != null)
		Options.v().set_force_android_jar(instance.androidJar);
	else if (instance.androidPlatforms != null)
		Options.v().set_android_jars(instance.androidPlatforms);
	else
		throw new RuntimeException("Neither single Android JAR not platform "
				+ "directory specified");
	
	//the bin folder has to be added to the classpath in order to
	//use the Java part for the instrumentation (JavaClassForInstrumentation)
	Options.v().set_soot_classpath(instance.bin
			+ File.pathSeparator + instance.androidJar);
	initialiseInstrumentationClasses();
	Scene.v().loadNecessaryClasses();
	addInstrumentedClassToApplicationClass();
}
 
Example #23
Source File: SootResolver.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
/** Returns true if we are resolving all class refs recursively. */
private boolean resolveEverything() {
	if (Options.v().on_the_fly())
		return false;
	return (Options.v().whole_program() || Options.v().whole_shimple()
			|| Options.v().full_resolver() || Options.v().output_format() == Options.output_format_dava);
}
 
Example #24
Source File: JavaClassSource.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public Dependencies resolve( SootClass sc ) {
      if (Options.v().verbose())
          G.v().out.println("resolving [from .java]: " + className);
                  
      IInitialResolver resolver;
      if(Options.v().polyglot())
      	resolver = InitialResolver.v();
      else
      	resolver = JastAddInitialResolver.v();

      if (fullPath != null){
          resolver.formAst(fullPath.getPath(), SourceLocator.v().sourcePath(), className);
      }
      //System.out.println("about to call initial resolver in j2j: "+sc.getName());
      Dependencies references = resolver.resolveFromJavaFile(sc);
      
      /*
       * 1st March 2006
       * Nomair
       * This seems to be a good place to calculate all the
       * AST Metrics needed from Java's AST
       */
if(Options.v().ast_metrics()){
	//System.out.println("CALLING COMPUTEASTMETRICS!!!!!!!");
	Node ast = InitialResolver.v().getAst();
	if(ast==null) {
		G.v().out.println("No compatible AST available for AST metrics. Skipping. Try -polyglot option.");
	} else {
		ComputeASTMetrics metrics = new ComputeASTMetrics(ast);
		metrics.apply();
	}
}
      
      return references;
  }
 
Example #25
Source File: Main.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
private void postCmdLineCheck() {
    if (Options.v().classes().isEmpty()
    && Options.v().process_dir().isEmpty()) {
        throw new CompilationDeathException(
            CompilationDeathException.COMPILATION_ABORTED,
            "No input classes specified!");
    }
}
 
Example #26
Source File: Debug.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public static void printDbg (String s, Object...objects) {
  DEXPLER_DEBUG = Options.v().verbose();
  if (DEXPLER_DEBUG) {
    for (Object o: objects) {
        if (o == null)
            s += "null";
        else
            s += o.toString();
    }
    System.out.println (s);
  }
    
}
 
Example #27
Source File: DexPrinter.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public void print() {
	String outputDir = SourceLocator.v().getOutputDir();
	try {
		if (originalApk != null
				&& Options.v().output_format() != Options.output_format_force_dex) {
			printApk(outputDir, originalApk);
		} else {
			String fileName = outputDir + File.separatorChar + CLASSES_DEX;
			G.v().out.println("Writing dex to: " + fileName);
			writeTo(fileName);
		}
	} catch (IOException e) {
		throw new CompilationDeathException("I/O exception while printing dex", e);
	}
}
 
Example #28
Source File: Debug.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public static void printDbg (String s, Object...objects) {
  TODEX_DEBUG = Options.v().verbose();
  if (TODEX_DEBUG) {
    for (Object o: objects) {
      s += o.toString();
    }
    System.out.println (s);
  }
    
}
 
Example #29
Source File: AsmMethodSource.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
void setUnit(AbstractInsnNode insn, Unit u) {
	if (Options.v().keep_line_number() && lastLineNumber >= 0) {
		Tag lineTag = u.getTag("LineNumberTag");
		if (lineTag == null) {
			lineTag = new LineNumberTag(lastLineNumber);
			u.addTag(lineTag);
		}
		else if (((LineNumberTag) lineTag).getLineNumber() != lastLineNumber)
			throw new RuntimeException("Line tag mismatch");
	}
	
	Unit o = units.put(insn, u);
	if (o != null)
		throw new AssertionError(insn.getOpcode() + " already has a unit, " + o);
}
 
Example #30
Source File: ReflInliner.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) {
	PackManager.v().getPack("wjpp").add(new Transform("wjpp.inlineReflCalls", new ReflectiveCallsInliner()));		
	Scene.v().addBasicClass(Object.class.getName());
	Scene.v().addBasicClass(SootSig.class.getName(),SootClass.BODIES);
	Scene.v().addBasicClass(UnexpectedReflectiveCall.class.getName(),SootClass.BODIES);
	Scene.v().addBasicClass(IUnexpectedReflectiveCallHandler.class.getName(),SootClass.BODIES);
	Scene.v().addBasicClass(DefaultHandler.class.getName(),SootClass.BODIES);
	Scene.v().addBasicClass(OpaquePredicate.class.getName(),SootClass.BODIES);
	Scene.v().addBasicClass(ReflectiveCalls.class.getName(),SootClass.BODIES);
	ArrayList<String> argList = new ArrayList<String>(Arrays.asList(args));
	argList.add("-w");
	argList.add("-p");
	argList.add("cg");
	argList.add("enabled:false");
	argList.add("-app");
	
	Options.v().set_keep_line_number(true);
	
	G.v().out.println("TamiFlex Booster Version "+ReflInliner.class.getPackage().getImplementationVersion());
	try {
		soot.Main.main(argList.toArray(new String[0]));
	} catch(CompilationDeathException e) {
		G.v().out.println("\nERROR: "+e.getMessage()+"\n");
		G.v().out.println("The command-line options are described at:\n" +
				"http://www.sable.mcgill.ca/soot/tutorial/usage/index.html");
		if(Options.v().verbose()) {
			throw e;
		} else {
			G.v().out.println("Use -verbose to see stack trace.");
		}
		G.v().out.println();
		usage();
	}
}