public static boolean isNewInstanceMethod(SootMethod method) { return method.toString().equals("<java.lang.Class: java.lang.Object newInstance()>"); } }
public static boolean isThreadStartMethod(SootMethod method) { return method.toString().equals("<java.lang.Thread: void start()>"); }
/** * Telling if the given method is in the file given by the option "cg.spark geom-verify-name". */ public boolean isValidMethod(SootMethod sm) { if (validMethods != null) { String sig = sm.toString(); if (!validMethods.containsKey(sig)) { return false; } // We mark this method for future inspection validMethods.put(sig, Boolean.TRUE); } return true; }
protected void dumpMethod(SootMethod m, JarOutputStream jarOut) throws IOException { jarOut.putNextEntry(new ZipEntry("" + toFileName(m.toString()) + ".html")); final PrintWriter out = new PrintWriter(jarOut); out.println("<html>"); out.println("This is method " + htmlify(m.toString()) + "<hr>"); for (Iterator it = methodToNodes.get(m).iterator(); it.hasNext();) { out.println(varNode("nodes/", (VarNode) it.next())); } out.println("</html>"); out.flush(); }
/** * Dump the each summary computed by the interprocedural analysis as a separate graph. * * @param prefix * is prepended before method name in output filename * @param drawUnanalysed * do you also want info for the unanalysed methods required by the analysis via summaryOfUnanalysedMethod ? * * @see fillDotGraph */ public void drawAsManyDot(String prefix, boolean drawUnanalysed) { for (SootMethod m : data.keySet()) { DotGraph dot = new DotGraph(m.toString()); dot.setGraphLabel(m.toString()); fillDotGraph("X", data.get(m), dot); File f = new File(SourceLocator.v().getOutputDir(), prefix + m.toString() + DotGraph.DOT_EXTENSION); dot.plot(f.getPath()); } if (drawUnanalysed) { for (SootMethod m : unanalysed.keySet()) { DotGraph dot = new DotGraph(m.toString()); dot.setGraphLabel(m.toString() + " (unanalysed)"); fillDotGraph("X", unanalysed.get(m), dot); File f = new File(SourceLocator.v().getOutputDir(), prefix + m.toString() + "_u" + DotGraph.DOT_EXTENSION); dot.plot(f.getPath()); } } }
protected String varNode(String dirPrefix, VarNode vv) { StringBuffer ret = new StringBuffer(); ret.append("<li><a href=\"" + dirPrefix + "n" + vv.getNumber() + ".html\">"); if (vv.getVariable() != null) { ret.append("" + htmlify(vv.getVariable().toString())); } ret.append("GlobalVarNode"); ret.append("</a><br>"); ret.append("<li>Context: "); ret.append("" + (vv.context() == null ? "null" : htmlify(vv.context().toString()))); ret.append("</a><br>"); if (vv instanceof LocalVarNode) { LocalVarNode lvn = (LocalVarNode) vv; SootMethod m = lvn.getMethod(); if (m != null) { ret.append("<a href=\"../" + toFileName(m.toString()) + ".html\">"); ret.append(htmlify(m.toString()) + "</a><br>"); } } ret.append(htmlify(vv.getType().toString()) + "\n"); return ret.toString(); }
logger.debug(" |- processing " + m.toString() + " (" + nb.get(m) + "-st time)");
+ (mhpself ? " [called from >= 2 threads]" : " [called from <= 1 thread]")); logger.debug( "[transaction-table] Where: " + tn.method.getDeclaringClass().toString() + ":" + tn.method.toString() + ": "); logger.debug("[transaction-table] Orig : " + tn.origLock); logger.debug("[transaction-table] Prep : " + tn.prepStmt);
if (!(vInvokeExpr.getMethod().toString().equals("<java.lang.StringBuffer: java.lang.String toString()>"))) { return; System.out.println("base method is " + tempV.getMethod()); if (!tempV.getMethod().toString().startsWith("<java.lang.StringBuffer: java.lang.StringBuffer append")) { if (DEBUG) { System.out.println("Found a virtual invoke which is not a append" + tempV.getMethod()); if (!((DNewInvokeExpr) base).getMethod().toString().equals("<java.lang.StringBuffer: void <init>()>")) { return;
"[transaction-graph] " + tn.name + " [name=\"" + tn.method.toString() + "\" style=\"setlinewidth(3)\"];"); } else { logger.debug("[transaction-graph] " + tn.name + " [name=\"" + tn.method.toString() + "\" color=cadetblue1 style=\"setlinewidth(1)\"];"); "[transaction-graph] " + tn.name + " [name=\"" + tn.method.toString() + "\" style=\"setlinewidth(3)\"];"); } else { logger.debug("[transaction-graph] " + tn.name + " [name=\"" + tn.method.toString() + "\" color=cadetblue1 style=\"setlinewidth(1)\"];");
public void analyzeAST() { ASTNode AST = (ASTNode) this.getUnits().getFirst(); debug("analyzeAST", "Applying AST analyzes for method" + this.getMethod().toString()); /* * Nomair A. Naeem tranformations on the AST Any AST Transformations added should be added to the applyASTAnalyses method * unless we are want to delay the analysis till for example THE LAST THING DONE */ applyASTAnalyses(AST); /* * Nomair A. Naeem apply structural flow analyses now * */ debug("analyzeAST", "Applying structure analysis" + this.getMethod().toString()); applyStructuralAnalyses(AST); debug("analyzeAST", "Applying structure analysis DONE" + this.getMethod().toString()); /* * Renamer March 28th Nomair A. Naeem. Since there is a chance that the analyze method gets involved multiple times we * dont want renaming done more than once. * * hence removing the call of the renamer from here Also looking ahead i have a feeling that we will be going * interprocedural for the renamer hence i am placing the renamer code inside the interprocedural class */ /* * In the end check 1, if there are labels which can be safely removed 2, int temp; temp=0 to be converted to int temp=0; */ // AST.apply(new ExtraLabelNamesRemover()); // System.out.println("\nEND analyzing method"+this.getMethod().toString()); }
idmap.put(m, id); sub.setGraphLabel(""); label.setLabel("(" + order.get(m) + ") " + m.toString()); label.setAttribute("fontsize", "18"); label.setShape("box");
outputer.println(); outputer.println("<<<<<<<<< Additional Solved Call >>>>>>>>>>"); outputer.println(src.toString()); outputer.println(ie.toString());
logger.debug("Replaced constant base object of Method.invoke() by local in: " + sootMethod.toString());
public void applyBugFixes() { ASTNode AST = (ASTNode) this.getUnits().getFirst(); debug("applyBugFixes", "Applying AST analyzes for method" + this.getMethod().toString()); AST.apply(new ShortcutIfGenerator()); debug("applyBugFixes", "after ShortcutIfGenerator" + G.v().ASTTransformations_modified); AST.apply(new TypeCastingError()); debug("applyBugFixes", "after TypeCastingError" + G.v().ASTTransformations_modified); }
debug("DavaBody", "creating DavaBody for" + body.getMethod().toString()); Dava.v().log("\nstart method " + body.getMethod().toString()); debug("DavaBody", "printing NON EMPTY exception list for " + body.getMethod().toString() + " " + body.getMethod().getExceptions().toString()); Dava.v().log("end method " + body.getMethod().toString());
if (DEBUG) { if (m.getExceptions().size() != 0) { System.out.println("PackManager printing out jimple body exceptions for method " + m.toString() + " " + m.getExceptions().toString());