/** Verifies a few sanity conditions on the contents on this body. */ public void validate() { List<ValidationException> exceptionList = new ArrayList<ValidationException>(); validate(exceptionList); if (!exceptionList.isEmpty()) { throw exceptionList.get(0); } }
/** * 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(); printStatementsInBody(b, out); } }
/** * 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(" }"); }
inlineRelectiveCalls(m, classForNameClassNames, ReflectionTraceInfo.Kind.ClassForName); if (Options.v().validate()) { b.validate(); inlineRelectiveCalls(m, classNewInstanceClassNames, ReflectionTraceInfo.Kind.ClassNewInstance); if (Options.v().validate()) { b.validate(); inlineRelectiveCalls(m, constructorNewInstanceSignatures, ReflectionTraceInfo.Kind.ConstructorNewInstance); if (Options.v().validate()) { b.validate(); inlineRelectiveCalls(m, methodInvokeSignatures, ReflectionTraceInfo.Kind.MethodInvoke); if (Options.v().validate()) { b.validate(); inlineRelectiveCalls(m, fieldSetSignatures, ReflectionTraceInfo.Kind.FieldSet); if (Options.v().validate()) { b.validate(); inlineRelectiveCalls(m, fieldGetSignatures, ReflectionTraceInfo.Kind.FieldGet); if (Options.v().validate()) { b.validate();
PackManager.v().getPack("jtp").apply(body); if (Options.v().validate()) { body.validate();
newBody.validate();
body.validate();
body.validate();
body.validate();
body.validate();
body.validate();
body.validate(); } catch (soot.validation.ValidationException e) { System.out.println("Unable to validate method body. Possible NullPointerException?");
mainMethod.getActiveBody().validate();
mainMethod.getActiveBody().validate();
b.getUnits().add(retStmt); b.validate();
/** * Patch android.app.Activity getApplication method in order to return the * singleton Application instance created in the dummyMainMethod. */ private void patchActivityImplementation() { SootClass scApplicationHolder = createOrGetApplicationHolder(); SootClass sc = Scene.v().getSootClassUnsafe("android.app.Activity"); if (sc == null || sc.resolvingLevel() < SootClass.SIGNATURES || scApplicationHolder == null) return; sc.setLibraryClass(); SootMethod smRun = sc.getMethodUnsafe("android.app.Application getApplication()"); if (smRun == null || (smRun.hasActiveBody() && !isStubImplementation(smRun.getActiveBody()))) return; smRun.setPhantom(false); smRun.addTag(new FlowDroidEssentialMethodTag()); Body b = Jimple.v().newBody(smRun); smRun.setActiveBody(b); // add "this" local Local thisLocal = Jimple.v().newLocal("this", sc.getType()); b.getLocals().add(thisLocal); b.getUnits().add(Jimple.v().newIdentityStmt(thisLocal, Jimple.v().newThisRef(sc.getType()))); SootFieldRef appStaticFieldRef = scApplicationHolder.getFieldByName("application").makeRef(); // creating local to store the mApplication field Local targetLocal = Jimple.v().newLocal("retApplication", appStaticFieldRef.type()); b.getLocals().add(targetLocal); b.getUnits().add(Jimple.v().newAssignStmt(targetLocal, Jimple.v().newStaticFieldRef(appStaticFieldRef))); Unit retStmt = Jimple.v().newReturnStmt(targetLocal); b.getUnits().add(retStmt); b.validate(); }