示例#1
0
  private void processFile(File inputFile) {
    SystemSetup setup = SystemSetup.buildConfig(systemConfigFile);
    if (setup == null) {
      setup = SystemSetup.getDefaultConfig();
    }

    TraceReader traceReader = (TraceReader) DToolReader.newDToolReader(inputFile, setup);
    if (traceReader == null) {
      LoggingUtils.getLogger().warning("traceReader is null.");
      return;
    }

    UnitBuilder builder = UnitBuilderFactory.newUnitBuilder(traceUnitName, instructionDecoder);
    DottyTraceUnit dotty = new DottyTraceUnit();

    String inst = null;
    // long totalInstructions = 0l;
    while ((inst = traceReader.nextInstruction()) != null) {
      Integer address = traceReader.getAddress();
      builder.nextInstruction(address, inst);
      processTraceUnit(builder, dotty);
    }
    builder.close();
    processTraceUnit(builder, dotty);

    File outputFile = new File(outputFolder, inputFile.getName() + "." + traceUnitName + ".dotty");
    IoUtils.write(outputFile, dotty.generateDot());
  }