/** * Returns a ShimpleBody constructed from b, using default phase options. **/ public ShimpleBody newBody(Body b) { Map<String, String> options = PhaseOptions.v().getPhaseOptions(PHASE); return new ShimpleBody(b, options); }
/** Returns a BafBody constructed from b. */ public BafBody newBody(JimpleBody b, String phase) { Map<String, String> options = PhaseOptions.v().getPhaseOptions(phase); return new BafBody(b, options); } }
/** * Returns an empty ShimpleBody associated with method m, using default phase options. **/ public ShimpleBody newBody(SootMethod m) { Map<String, String> options = PhaseOptions.v().getPhaseOptions(PHASE); return new ShimpleBody(m, options); }
public Map<String, String> getPhaseOptions(String phaseName) { return getPhaseOptions(getPM().getPhase(phaseName)); }
public final void apply() { Map<String, String> options = PhaseOptions.v().getPhaseOptions(this); if (!PhaseOptions.getBoolean(options, "enabled")) { return; } internalApply(); }
public final void apply(Body b) { Map<String, String> options = PhaseOptions.v().getPhaseOptions(this); if (!PhaseOptions.getBoolean(options, "enabled")) { return; } internalApply(b); }
protected void internalApply(Body b) { applyPhaseOptions((JimpleBody) b, PhaseOptions.v().getPhaseOptions(getPhaseName())); } }
protected void internalApply(Body b) { applyPhaseOptions((JimpleBody) b, PhaseOptions.v().getPhaseOptions(getPhaseName())); } }
private void checkEnabled(Transform t) { Map<String, String> options = PhaseOptions.v().getPhaseOptions(t); if (PhaseOptions.getBoolean(options, "enabled")) { // Enabling this one will disable all the others PhaseOptions.v().setPhaseOption(t, "enabled:true"); } } }
protected void internalApply() { LinkedList<Transform> enableds = new LinkedList<Transform>(); for (Iterator<Transform> tIt = this.iterator(); tIt.hasNext();) { final Transform t = tIt.next(); Map<String, String> opts = PhaseOptions.v().getPhaseOptions(t); if (!PhaseOptions.getBoolean(opts, "enabled")) { continue; } enableds.add(t); } if (enableds.size() == 0) { logger .debug("" + "Exactly one phase in the pack " + getPhaseName() + " must be enabled. Currently, none of them are."); throw new CompilationDeathException(CompilationDeathException.COMPILATION_ABORTED); } if (enableds.size() > 1) { logger.debug( "" + "Only one phase in the pack " + getPhaseName() + " may be enabled. The following are enabled currently: "); for (Transform t : enableds) { logger.debug("" + " " + t.getPhaseName()); } throw new CompilationDeathException(CompilationDeathException.COMPILATION_ABORTED); } for (Transform t : enableds) { t.apply(); } }
AllocNode(PAG pag, Object newExpr, Type t, SootMethod m) { super(pag, t); this.method = m; if (t instanceof RefType) { RefType rt = (RefType) t; if (rt.getSootClass().isAbstract()) { boolean usesReflectionLog = new CGOptions(PhaseOptions.v().getPhaseOptions("cg")).reflection_log() != null; if (!usesReflectionLog) { throw new RuntimeException("Attempt to create allocnode with abstract type " + t); } } } this.newExpr = newExpr; if (newExpr instanceof ContextVarNode) { throw new RuntimeException(); } pag.getAllocNodeNumberer().add(this); }
private void preProcessDAVA() { if (Options.v().output_format() == Options.output_format_dava) { Map<String, String> options = PhaseOptions.v().getPhaseOptions("db"); boolean isSourceJavac = PhaseOptions.getBoolean(options, "source-is-javac"); if (!isSourceJavac) { /* * It turns out that the exception attributes of a method i.e. those exceptions that a method can throw are only * checked by the Java compiler and not the JVM * * Javac does place this information into the attributes but other compilers dont hence if the source is not javac * then we have to do this fancy analysis to find all the potential exceptions that might get thrown * * BY DEFAULT the option javac of db is set to true so we assume that the source is javac * * See ThrowFinder for more details */ if (DEBUG) { System.out.println("Source is not Javac hence invoking ThrowFinder"); } ThrowFinder.v().find(); } else { if (DEBUG) { System.out.println("Source is javac hence we dont need to invoke ThrowFinder"); } } PackageNamer.v().fixNames(); } }
/** * @ast method * @aspect AnnotationsCodegen * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AnnotationsCodegen.jrag:83 */ public void addSourceOnlyAnnotations(Collection c) { if(new soot.options.JBOptions(soot.PhaseOptions.v().getPhaseOptions("jb")). preserve_source_annotations()) { for(int i = 0; i < getNumModifier(); i++) { if(getModifier(i) instanceof Annotation) { Annotation a = (Annotation)getModifier(i); if(!a.isRuntimeVisible() && !a.isRuntimeInvisible()) { soot.tagkit.VisibilityAnnotationTag tag = new soot.tagkit.VisibilityAnnotationTag(soot.tagkit.AnnotationConstants.SOURCE_VISIBLE); ArrayList elements = new ArrayList(1); a.appendAsAttributeTo(elements); tag.addAnnotation((soot.tagkit.AnnotationTag)elements.get(0)); c.add(tag); } } } } } /**
public OnFlyCallGraphBuilder(ContextManager cm, ReachableMethods rm) { this.cm = cm; this.rm = rm; worklist = rm.listener(); options = new CGOptions(PhaseOptions.v().getPhaseOptions("cg")); if (!options.verbose()) { logger.debug("" + "[Call Graph] For information on where the call graph may be incomplete," + "use the verbose option to the cg phase."); } if (options.reflection_log() == null || options.reflection_log().length() == 0) { if (options.types_for_invoke() && new SparkOptions(PhaseOptions.v().getPhaseOptions("cg.spark")).enabled()) { reflectionModel = new TypeBasedReflectionModel(); } else { reflectionModel = new DefaultReflectionModel(); } } else { reflectionModel = new TraceBasedReflectionModel(); } this.fh = Scene.v().getOrMakeFastHierarchy(); }
public void apply() { Map<String, String> options = PhaseOptions.v().getPhaseOptions(phaseName); if (PhaseOptions.getBoolean(options, "enabled")) { if (Options.v().verbose()) { logger.debug("" + "Applying phase " + phaseName + " to the scene."); } } if (DEBUG) { PhaseDumper.v().dumpBefore(getPhaseName()); } ((SceneTransformer) t).transform(phaseName, options); if (DEBUG) { PhaseDumper.v().dumpAfter(getPhaseName()); } }
public void apply(Body b) { Map<String, String> options = PhaseOptions.v().getPhaseOptions(phaseName); if (PhaseOptions.getBoolean(options, "enabled")) { if (Options.v().verbose()) { logger.debug("" + "Applying phase " + phaseName + " to " + b.getMethod() + "."); } } if (DEBUG) { PhaseDumper.v().dumpBefore(b, getPhaseName()); } ((BodyTransformer) t).transform(b, phaseName, options); if (DEBUG) { PhaseDumper.v().dumpAfter(b, getPhaseName()); } }
public void autoSetOptions() { // when no-bodies-for-excluded is enabled, also enable phantom refs if (Options.v().no_bodies_for_excluded()) { Options.v().set_allow_phantom_refs(true); } // when reflection log is enabled, also enable phantom refs CGOptions cgOptions = new CGOptions(PhaseOptions.v().getPhaseOptions("cg")); String log = cgOptions.reflection_log(); if ((log != null) && (log.length() > 0)) { Options.v().set_allow_phantom_refs(true); } // if phantom refs enabled, ignore wrong staticness in type assigner if (Options.v().allow_phantom_refs()) { Options.v().set_wrong_staticness(Options.wrong_staticness_fix); } } }
public void handleNewAnalysis(Transform t, Body b) { // here save current phase name and only send if actual data flow analysis exists if (PhaseOptions.getBoolean(PhaseOptions.v().getPhaseOptions(t.getPhaseName()), "enabled")) { String name = t.getPhaseName() + " for method: " + b.getMethod().getName(); currentPhaseName(name); currentPhaseEnabled(true); doneCurrent(false); } else { currentPhaseEnabled(false); setInteractThisAnalysis(false); } }
protected void internalApply() { CGOptions options = new CGOptions(PhaseOptions.v().getPhaseOptions(this)); if (!Scene.v().hasCustomEntryPoints()) { if (!options.implicit_entry()) { Scene.v().setEntryPoints(EntryPoints.v().application()); } if (options.all_reachable()) { List<SootMethod> entryPoints = new ArrayList<SootMethod>(); entryPoints.addAll(EntryPoints.v().all()); entryPoints.addAll(EntryPoints.v().methodsOfApplicationClasses()); Scene.v().setEntryPoints(entryPoints); } } super.internalApply(); ClinitElimTransformer trimmer = new ClinitElimTransformer(); if (options.trim_clinit()) { for (SootClass cl : Scene.v().getClasses(SootClass.BODIES)) { for (SootMethod m : cl.getMethods()) { if (m.isConcrete() && m.hasActiveBody()) { trimmer.transform(m.getActiveBody()); } } } } } }
public TypeConstants(Singletons.Global g) { int jdkver = new CGOptions(PhaseOptions.v().getPhaseOptions("cg")).jdkver();