예제 #1
0
 private void printUsage() {
   printWelcome();
   MP.printMessage(EC.TLC_USAGE);
 }
예제 #2
0
 /**
  * Print out an error message, with usage hint
  *
  * @param msg, message to print TODO remove this method and replace the calls
  */
 private void printErrorMsg(String msg) {
   printWelcome();
   MP.printError(EC.WRONG_COMMANDLINE_PARAMS_TLC, msg);
 }
예제 #3
0
 /** Prints the welcome message once per instance */
 private void printWelcome() {
   if (!this.welcomePrinted) {
     this.welcomePrinted = true;
     MP.printMessage(EC.TLC_VERSION, TLCGlobals.versionOfTLC);
   }
 }
예제 #4
0
  /** The processing method */
  public void process() {
    ToolIO.cleanToolObjects(TLCGlobals.ToolId);
    // UniqueString.initialize();

    // a JMX wrapper that exposes runtime statistics
    TLCStandardMBean modelCheckerMXWrapper = TLCStandardMBean.getNullTLCStandardMBean();

    // SZ Feb 20, 2009: extracted this method to separate the
    // parameter handling from the actual processing
    try {
      // Initialize:
      if (fromChkpt != null) {
        // We must recover the intern var table as early as possible
        UniqueString.internTbl.recover(fromChkpt);
      }
      if (cleanup && fromChkpt == null) {
        // clean up the states directory only when not recovering
        FileUtil.deleteDir(TLCGlobals.metaRoot, true);
      }
      FP64.Init(fpIndex);

      // Start checking:
      if (isSimulate) {
        // random simulation
        RandomGenerator rng = new RandomGenerator();
        if (noSeed) {
          seed = rng.nextLong();
          rng.setSeed(seed);
        } else {
          rng.setSeed(seed, aril);
        }
        MP.printMessage(EC.TLC_MODE_SIMU, String.valueOf(seed));
        Simulator simulator =
            new Simulator(
                mainFile,
                configFile,
                null,
                deadlock,
                traceDepth,
                Long.MAX_VALUE,
                rng,
                seed,
                true,
                resolver,
                specObj);
        // The following statement moved to Spec.processSpec by LL on 10 March 2011
        //                MP.printMessage(EC.TLC_STARTING);
        instance = simulator;
        simulator.simulate();
      } else {
        // model checking
        MP.printMessage(EC.TLC_MODE_MC);

        AbstractChecker mc = null;
        if (TLCGlobals.DFIDMax == -1) {
          mc =
              new ModelChecker(
                  mainFile,
                  configFile,
                  dumpFile,
                  deadlock,
                  fromChkpt,
                  resolver,
                  specObj,
                  (long) fpMemSize,
                  fpBits);
          TLCGlobals.mainChecker = (ModelChecker) mc;
          modelCheckerMXWrapper = new ModelCheckerMXWrapper((ModelChecker) mc);
        } else {
          mc =
              new DFIDModelChecker(
                  mainFile, configFile, dumpFile, deadlock, fromChkpt, true, resolver, specObj);
        }
        // The following statement moved to Spec.processSpec by LL on 10 March 2011
        //                MP.printMessage(EC.TLC_STARTING);
        instance = mc;
        mc.modelCheck();
      }
    } catch (Throwable e) {
      if (e instanceof StackOverflowError) {
        System.gc();
        MP.printError(EC.SYSTEM_STACK_OVERFLOW, e);
      } else if (e instanceof OutOfMemoryError) {
        System.gc();
        MP.printError(EC.SYSTEM_OUT_OF_MEMORY, e);
      } else if (e instanceof RuntimeException) {
        // SZ 29.07.2009
        // printing the stack trace of the runtime exceptions
        MP.printError(EC.GENERAL, e);
        // e.printStackTrace();
      } else {
        MP.printError(EC.GENERAL, e);
      }
    } finally {
      modelCheckerMXWrapper.unregister();
      MP.printMessage(EC.TLC_FINISHED);
      MP.flush();
    }
  }