/**
   * Instruments the Java Path Finder version of the program.
   *
   * @param mainclass
   */
  public static void transformJPFVersion(String mainclass) {
    sharedVars = new HashSet<String>();

    PackManager.v().getPack("wjtp").add(new Transform("wjtp.transformer", new SymbScenePass()));
    PackManager.v().getPack("jtp").add(new Transform("jtp.transformer", new SymbBodyPass()));
    setOptions(mainclass, true);
    Scene.v().loadClassAndSupport(jpfClass);

    try {

      // ** instrument JPF version
      JPF_MODE = true;
      String outpath = getOutputDir();
      sharedAccLogPath = outpath + mainclass + ".accesses";
      String[] args1 = getArgs(mainclass, outpath);

      soot.Main.main(args1);
      System.err.println("***** JPF version generated *****");
      saveSharedAccessesLog();

    } catch (Exception e) {
      System.err.println(">> Exception: " + e.getMessage());
      e.printStackTrace();
    }
  }
  /**
   * Instruments the runtime version of the program.
   *
   * @param mainclass
   */
  public static void transformRuntimeVersion(String mainclass) {
    PackManager.v().getPack("jtp").add(new Transform("jtp.intrumenter", SymbBodyPass.v()));
    setOptions(mainclass, false);

    Scene.v()
        .setSootClassPath(
            System.getProperty("sun.boot.class.path")
                + File.pathSeparator
                + System.getProperty("java.class.path"));

    Scene.v().loadClassAndSupport(runtimeClass);

    try {

      // ** instrument runtime version
      String outpath = getOutputDir();
      String[] args1 = getArgs(mainclass, outpath);

      soot.Main.main(args1);
      System.err.println("***** Runtime version generated *****\n");

      // reset soot parameters
      soot.G.reset();
      bbIdCounter = 0;

    } catch (Exception e) {
      System.err.println(">> Exception: " + e.getMessage());
      e.printStackTrace();
    }
  }
Beispiel #3
0
 public static void main(String[] args) {
   soot.G
       .v()
       .PackManager()
       .getPack("tag")
       .add(new soot.Transform("tag.null", new NullTagAggregator()));
   soot.Main.main(args);
 }
Beispiel #4
0
  public static void main(String[] args) {
    if (args.length == 0) {
      System.out.println("Syntax: java Main -app <main_classfile> [soot options]");
      System.exit(0);
    }

    PackManager.v().getPack("wjtp").add(new Transform("wjtp.profiler", Evaluator.v()));

    // For the transformer to be executed, as it was added as one of
    // whole-program analysis, we need to set whole-program analysis to true.
    soot.options.Options.v().set_whole_program(true);

    // This is to skip analyzing the bodies of excluded classes (e.g., JDK).
    soot.options.Options.v().set_no_bodies_for_excluded(true);

    soot.Main.main(args);
  }
 public static void main(String[] args) {
   CFGViewer viewer = new CFGViewer();
   Transform printTransform = new Transform(phaseFullname, viewer);
   printTransform.setDeclaredOptions(
       "enabled "
           + altClassPathOptionName
           + ' '
           + graphTypeOptionName
           + ' '
           + irOptionName
           + ' '
           + multipageOptionName
           + ' '
           + briefLabelOptionName
           + ' ');
   printTransform.setDefaultOptions(
       "enabled "
           + altClassPathOptionName
           + ": "
           + graphTypeOptionName
           + ':'
           + defaultGraph
           + ' '
           + irOptionName
           + ':'
           + defaultIR
           + ' '
           + multipageOptionName
           + ":false "
           + ' '
           + briefLabelOptionName
           + ":false ");
   PackManager.v().getPack("jtp").add(printTransform);
   args = viewer.parse_options(args);
   if (args.length == 0) {
     usage();
   } else {
     soot.Main.main(args);
   }
 }