public AbstractId(string verb_name, int version, string abstract_only, PoundDefines poundDefines = null, string concrete = null) { this.verb_name = verb_name; this.version = version + MASTER_VERSION; this.abstract_only = abstract_only; this.poundDefines = poundDefines == null?PoundDefines.empty() : poundDefines; this.concrete = concrete; }
void parseArgs(string[] args) { this.args = args; argi = 0; while (argi < args.Count()) { string next = takeArg("option or verb"); // Should always succeed due to while condition. if (next.StartsWith("-")) { if (next.Equals("--ironRoot")) { if (this.ironRoot != null) { usage("ironRoot set after use"); } this.ironRoot = takeArg("value for ironRoot"); } else if (next.Equals("-j") || next.Equals("--jobs")) { this.jobParallelism = Int32.Parse(takeArg("value for jobs")); } else if (next.Equals("--localcache")) { BuildEngine.theEngine.setLocalCache(takeArg("path for localcache")); } else if (next.ToLower().Equals("--cloudcache")) { this.useCloudCache = true; } else if (next.ToLower().Equals("--no-cloudcache")) { this.useCloudCache = false; } else if (next.Equals("--cloudexecution")) { this.useCloudExecution = true; } else if (next.ToLower().Equals("--verify")) { this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.Verify; } else if (next.ToLower().Equals("--no-verify")) { this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.NoVerify; } else if (next.ToLower().Equals("--no-symdiff")) { this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.NoSymDiff; } else if (next.ToLower().Equals("--verify-select")) { this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.SelectiveVerify; this.verificationRequest.selectiveVerifyModuleNames.Add(takeArg("filename for selective-verify")); } else if (next.ToLower().Equals("--html")) { this.html_output = takeArg("filename for html report"); } else if (next.ToLower().Equals("--windows")) { this.target_platform = IroncladAppVerb.TARGET.WINDOWS; } else if (next.ToLower().Equals("--useframepointer")) { this.useFramePointer = DafnyCCVerb.FramePointerMode.UseFramePointer; } else if (next.ToLower().Equals("--debug")) { this.releaseBuild = false; } else { usage("unrecognized option " + next); } } else { string verb = next; string target = takeArg("verb-target"); fixIronRoot(); if (verb.Equals("DafnyVerifyTree")) { verbs.Add(new VerificationResultSummaryVerb(new DafnyVerifyTreeVerb(conditionSourcePath(target)))); } else if (verb.Equals("BatchDafny")) { if (!target.EndsWith(".batch")) { usage("Batching expects a .batch file containing a list of .dfy files"); } verbs.Add(new VerificationResultSummaryVerb(new BatchVerifyVerb(conditionSourcePath(target), BatchVerifyVerb.BatchMode.DAFNY, this.verificationRequest, useFramePointer))); } else if (verb.Equals("BatchApps")) { if (!target.EndsWith(".batch")) { usage("Batching expects a .batch file containing a list of .dfy files"); } verbs.Add(new VerificationResultSummaryVerb(new BatchVerifyVerb(conditionSourcePath(target), BatchVerifyVerb.BatchMode.APP, this.verificationRequest, useFramePointer))); } else if (verb.Equals("Beat")) { verbs.Add(new BeatVerb(BuildEngine.theEngine.getVerveContextVerb(PoundDefines.empty()), conditionSourcePath(target), appLabel: null)); } else if (verb.Equals("Boogie")) { verbs.Add(new BoogieVerb(BuildEngine.theEngine.getVerveContextVerb(PoundDefines.empty()), conditionSourcePath(target), symdiff: this.verificationRequest.getSymDiffMode())); } else if (verb.Equals("IroncladApp")) { verbs.Add(new IroncladAppVerb(conditionSourcePath(target), target_platform, this.useFramePointer, this.verificationRequest)); } else if (verb.Equals("IronfleetApp")) { verbs.Add(new IronfleetAppVerb(conditionSourcePath(target), this.verificationRequest, this.releaseBuild)); } else if (verb.Equals("DafnyCompileOne")) { verbs.Add(new DafnyCompileOneVerb(conditionSourcePath(target))); } else if (verb.Equals("VSSolution")) { verbs.Add(new VSSolutionVerb(new SourcePath(target, SourcePath.SourceType.Tools))); } else if (verb.Equals("nmake")) { verbs.Add(new NmakeVerb(new SourcePath(target, SourcePath.SourceType.Tools))); } else if (verb.Equals("BootableApp")) { verbs.Add(new BootableAppVerb(conditionSourcePath(target), this.useFramePointer, this.verificationRequest)); } else { usage("Unknown verb " + verb); } } } fixIronRoot(); }
public IroncladAppVerb(SourcePath dfyroot, TARGET target, DafnyCCVerb.FramePointerMode framePointerMode, VerificationRequest verificationRequest) { this.dfyroot = dfyroot; // TODO this is the only #define we support just yet, so I'm stuffing it in here. // We'll need to plumb more carefully when we want to add x64. if (dfyroot.getDirPath().Split(Path.DirectorySeparatorChar).Last().Equals("AppLoader")) { this.poundDefines = new PoundDefines(new string[] { "AppLoader" }); } else { this.poundDefines = PoundDefines.empty(); } this.verificationRequest = verificationRequest; this.abstractId = new AbstractId( this.GetType().Name, version, dfyroot.ToString(), this.poundDefines, concrete: string.Format( "{0},{1},{2}", target, framePointerMode.ToString(), verificationRequest.ToString())); this.appLabel = dfyroot.getDirPath().Split(Path.DirectorySeparatorChar).Last(); this.dafnyspecVerb = new DafnySpecVerb(dfyroot, this.appLabel); this.dafnyccVerb = new DafnyCCVerb(dfyroot, this.appLabel, framePointerMode); bool isLoader = dfyroot.getRelativePath().Equals(BootableAppVerb.LOADER_DFY); // NB we keep dafnyccVerb as the lowest-priority context, so that our hand-written // beat impls will override its output. IContextGeneratingVerb contextWithDafny = new ConcatContextVerb( BuildEngine.theEngine.getVerveContextVerb(this.poundDefines), new VerbOutputsContextVerb(this.dafnyspecVerb, false), new VerbOutputsContextVerb(this.dafnyccVerb, true), this.poundDefines); this.stitcherVerb = new EntryStitcherVerb(contextWithDafny, this.appLabel); IContextGeneratingVerb contextWithDafnyAndEntry = new ConcatContextVerb( new VerbOutputsContextVerb(this.stitcherVerb, false), contextWithDafny, this.poundDefines); BuildObject entryImpObj = this.stitcherVerb.getEntryImpOutput(); BoogieAsmLinkVerb entryVerb = new BoogieAsmLinkVerb(contextWithDafnyAndEntry, entryImpObj); if (target == TARGET.BARE_METAL) { MasmVerb masmVerb = new MasmVerb(entryVerb); this.linkerVerb = new LinkerVerb(masmVerb, isLoader); } else if (target == TARGET.WINDOWS) { // Rewrite the asm that comes out of entryVerb before linking it AsmRewriterVerb rewriter = new AsmRewriterVerb(entryVerb); MasmVerb masmVerb = new MasmVerb(rewriter); this.linkerVerb = new WinLinkerVerb(masmVerb, isLoader); } BoogieAsmVerificationObligationListVerb bavolVerb = new BoogieAsmVerificationObligationListVerb(contextWithDafnyAndEntry, entryImpObj, verificationRequest); this.verifyResultsVerb = new VerificationResultSummaryVerb(bavolVerb); this.srcObject = this.linkerVerb.getUntrustedExe(); if (verificationRequest.isComplete()) { this.exeObject = dfyroot.makeOutputObject(TRUSTED_EXE_EXTN); this.outputObject = this.exeObject; } else { this.exeObject = this.srcObject; this.outputObject = dfyroot.makeVirtualObject(UNVERIFIED_SENTINEL_EXTENSION); } }