//TODO: collect some stats about the instrumentation, mb some debugging output?? private static void Main(string[] args) { if (args.Length < 3) { Console.WriteLine("usage: PropInst.exe propertyFile.avp boogieInputFile.bpl boogieOutputFile.bpl"); return; } if (args.Any(s => s == "/break")) { System.Diagnostics.Debugger.Launch(); } // initialize Boogie CommandLineOptions.Install(new CommandLineOptions()); CommandLineOptions.Clo.PrintInstrumented = true; // read the boogie program that is to be instrumented var boogieProgram = BoogieUtil.ReadAndResolve(args[1], false); // parse the property file var propLines = File.ReadLines(args[0]); string globalDeclarations; List <Rule> rules; CreateRulesFromProperty(propLines, out globalDeclarations, out rules); // GlobalDeclarations: add the global declarations from the property to the Boogie program Program dummyProg; Parser.Parse(globalDeclarations, "dummy.bpl", out dummyProg); boogieProgram.AddTopLevelDeclarations(dummyProg.TopLevelDeclarations); //resolve the program with the new declarations which may include funcs and procs with bodies boogieProgram.Resolve(); // CmdRule: find insertions sites (Commands), insert code there InstrumentCmdRule.Instrument(boogieProgram, rules.OfType <CmdRule>()); // InsertAtBeginningRule: find insertion sites (Procedures), insert code there InstrumentProcedureRule.Instrument(boogieProgram, rules.OfType <InsertAtBeginningRule>()); // make functions with {:mkUniqueFn} unique (new MkUniqueFnVisitor(boogieProgram)).Visit(boogieProgram); //augment the CorralExtraInit procedure (perform this after Matching/instrumentation) AugmentCorralExtraInit(boogieProgram); string outputFile = args[2]; BoogieUtil.PrintProgram(boogieProgram, outputFile); Stats.printStats(); }
//TODO: collect some stats about the instrumentation, mb some debugging output?? private static void Main(string[] args) { if (args.Length < 3) { Console.WriteLine("usage: PropInst.exe propertyFile.avp boogieInputFile.bpl boogieOutputFile.bpl"); return; } // initialize Boogie CommandLineOptions.Install(new CommandLineOptions()); CommandLineOptions.Clo.PrintInstrumented = true; // read the boogie program that is to be instrumented var boogieProgram = BoogieUtil.ReadAndResolve(args[1], false); // parse the property file var propLines = File.ReadLines(args[0]); string globalDeclarations; List <Rule> rules; CreateRulesFromProperty(propLines, out globalDeclarations, out rules); // GlobalDeclarations: add the global declarations from the property to the Boogie program Program dummyProg; Parser.Parse(globalDeclarations, "dummy.bpl", out dummyProg); boogieProgram.AddTopLevelDeclarations(dummyProg.TopLevelDeclarations); // CmdRule: find insertions sites (Commands), insert code there InstrumentCmdRule.Instrument(boogieProgram, rules.OfType <CmdRule>()); // InsertAtBeginningRule: find insertion sites (Procedures), insert code there InstrumentProcedureRule.Instrument(boogieProgram, rules.OfType <InsertAtBeginningRule>()); string outputFile = args[2]; BoogieUtil.PrintProgram(boogieProgram, outputFile); Stats.printStats(); }
//TODO: collect some stats about the instrumentation, mb some debugging output?? private static void Main(string[] args) { if (args.Length < 3) { Console.WriteLine("usage: PropInst.exe propertyFile.avp boogieInputFile.bpl boogieOutputFile.bpl [options]"); Console.WriteLine("\t /pruneMethodsWithFilePathPrefix:<absolutePath> Prune implementations whose path has this prefix"); Console.WriteLine("\t /removeAssertsIfNoCallWithPrefix:<prefixString> Cleanup asserts if no methods prefixed with <prefixString> (e.g. ProbeFor) are present in the module"); return; } if (args.Any(s => s == "/break")) { System.Diagnostics.Debugger.Launch(); } var pruneFilePaths = new HashSet <string>(); args .Where(s => s.StartsWith("/pruneMethodsWithFilePathPrefix:")) .Iter(s => pruneFilePaths.Add(s.Substring("/pruneMethodsWithFilePathPrefix:".Length))); string cleanupPrefixString = null; var removeAssertConditions = args.Where(x => x.StartsWith("/removeAssertsIfNoCallWithPrefix:")); if (removeAssertConditions.Count() == 1) { cleanupPrefixString = removeAssertConditions.First().Substring("/removeAssertsIfNoCallWithPrefix:".Length); } else if (removeAssertConditions.Count() > 1) { Console.WriteLine("Expecting exactly one \"/removeAssertsIfNoCallWithPrefix:\" flag"); return; } // initialize Boogie CommandLineOptions.Install(new CommandLineOptions()); CommandLineOptions.Clo.PrintInstrumented = true; // read the boogie program that is to be instrumented var boogieProgram = BoogieUtil.ReadAndResolve(args[1], false); // parse the property file var propLines = File.ReadLines(args[0]); string globalDeclarations; List <Rule> rules; CreateRulesFromProperty(propLines, out globalDeclarations, out rules); // GlobalDeclarations: add the global declarations from the property to the Boogie program Program dummyProg; Parser.Parse(globalDeclarations, "dummy.bpl", out dummyProg); boogieProgram.AddTopLevelDeclarations(dummyProg.TopLevelDeclarations); //resolve the program with the new declarations which may include funcs and procs with bodies boogieProgram.Resolve(); // CmdRule: find insertions sites (Commands), insert code there InstrumentCmdRule.Instrument(boogieProgram, rules.OfType <CmdRule>()); // InsertAtBeginningRule: find insertion sites (Procedures), insert code there InstrumentProcedureRule.Instrument(boogieProgram, rules.OfType <InsertAtBeginningRule>()); // make functions with {:mkUniqueFn} unique (new MkUniqueFnVisitor(boogieProgram)).Visit(boogieProgram); //augment the CorralExtraInit procedure (perform this after Matching/instrumentation) AugmentCorralExtraInit(boogieProgram); // prune methods that match PruneFilePaths if (pruneFilePaths.Count() > 0) { PruneMethodsWithPaths(boogieProgram, pruneFilePaths); } // cleanup asserts if no method with prefix is present if (cleanupPrefixString != null) { PerformCleanupIfNoCallWithPrefix(boogieProgram, cleanupPrefixString); } string outputFile = args[2]; BoogieUtil.PrintProgram(boogieProgram, outputFile); Stats.printStats(); }