Exemplo n.º 1
0
 private void processCallEdges() {
   Stmt s = null;
   while (callEdges.hasNext()) {
     Edge e = (Edge) callEdges.next();
     MethodPAG amp = MethodPAG.v(pag, e.tgt());
     amp.build();
     amp.addToPAG(e.tgtCtxt());
     pag.addCallTarget(e);
   }
 }
Exemplo n.º 2
0
  /**
   * Get all call sites of method p
   *
   * @param p, the callee method
   * @return
   */
  public List<RdProgramPoint> getCallSites(SootMethod p) {
    List<RdProgramPoint> csList = new ArrayList<RdProgramPoint>();

    Iterator<Edge> edges = cg.edgesInto(p);
    while (edges.hasNext()) {
      Edge e = edges.next();
      RdProgramPoint cs = new RdProgramPoint(e.srcUnit(), (SootMethod) e.getSrc());
      csList.add(cs);
    }

    return csList;
  }
Exemplo n.º 3
0
  private void dumpTextGraph(SootMethod caller, PrintStream printStream, int level) {

    String indent = indentString(level);
    caller.getTags();
    printStream.printf("%s %s\n", indent, caller.toString());
    Iterator<Edge> iterator = callGraph.edgesOutOf(caller);
    callgraphSet.add(caller);

    // boolean appClass = caller.getDeclaringClass().isApplicationClass();
    boolean systemApi = API.v().isSystemMethod(caller);

    /*
      printStream.printf("%s Declaring method %s: app %s\n", indent,
      caller.toString(), systemApi? "False": "True");
    */

    String subindent = indentString(level + 1);
    Set<Object> calleeSet = new HashSet<Object>();

    while (iterator != null && iterator.hasNext()) {
      Edge edge = iterator.next();
      if (!systemApi) {
        List<Stmt> invokeStmtList = SootUtils.getInvokeStatements(caller, edge.tgt());
        for (Stmt stmt : invokeStmtList) {
          if (calleeSet.contains(stmt)) continue;
          printStream.printf("%s #[%s] ", subindent, stmt);
          SourceLocationTag tag = SootUtils.getSourceLocation(stmt);
          if (tag != null) {
            printStream.printf(": %s", tag.toString());
          }
          printStream.printf("\n");
          calleeSet.add(stmt.toString());
        }
      }

      if (!callgraphSet.contains(edge.tgt())) {
        dumpTextGraph(edge.tgt(), printStream, level + 1);
      } else {
        // already in the call graph, just print it out
        if (calleeSet.contains(edge.tgt())) continue;
        printStream.printf("%s %s\n", subindent, edge.tgt().toString());
        calleeSet.add(edge.tgt());
      }
    }
  }
Exemplo n.º 4
0
 @Override
 public boolean want(Edge e) {
   return !("<clinit>".equals(e.tgt().getName()));
 }