int cbmc_parseoptionst::doit() { if(cmdline.isset("version")) { std::cout << CBMC_VERSION << std::endl; return 0; } // // unwinding of transition systems // if(cmdline.isset("module") || cmdline.isset("gen-interface")) { error("This version of CBMC has no support for " " hardware modules. Please use hw-cbmc."); return 1; } register_languages(); // // command line options // optionst options; get_command_line_options(options); bmct bmc(options, context, ui_message_handler); set_verbosity(bmc); set_verbosity(*this); if(cmdline.isset("preprocess")) { preprocessing(); return 0; } goto_functionst goto_functions; if(get_goto_program(options, bmc, goto_functions)) return 6; if(cmdline.isset("show-claims")) { const namespacet ns(context); show_claims(ns, get_ui(), goto_functions); return 0; } if(set_claims(goto_functions)) return 7; // do actual BMC return do_bmc(bmc, goto_functions); }
int cegis_parse_optionst::do_bmc( bmct &bmc, const goto_functionst &goto_functions) { optionst options; get_command_line_options(options); if(cmdline.isset("danger")) return run_danger(options, result(), symbol_table, goto_functions); if(cmdline.isset("safety")) return run_safety(options, result(), symbol_table, goto_functions); if(cmdline.isset("jsa")) return run_jsa(options, result(), symbol_table, goto_functions); return cbmc_parse_optionst::do_bmc(bmc, goto_functions); }
int symex_parseoptionst::doit() { if(cmdline.isset("version")) { std::cout << CBMC_VERSION << std::endl; return 0; } register_language(new_ansi_c_language); register_language(new_cpp_language); // // command line options // optionst options; get_command_line_options(options); eval_verbosity(); goto_functionst goto_functions; if(get_goto_program(options, goto_functions)) return 6; label_properties(goto_functions); if(cmdline.isset("show-properties")) { const namespacet ns(symbol_table); show_properties(ns, get_ui(), goto_functions); return 0; } if(set_properties(goto_functions)) return 7; if(cmdline.isset("show-locs")) { const namespacet ns(symbol_table); locst locs(ns); locs.build(goto_functions); locs.output(std::cout); return 0; } // do actual Symex try { const namespacet ns(symbol_table); path_searcht path_search(ns); path_search.set_message_handler(get_message_handler()); path_search.set_verbosity(get_verbosity()); if(cmdline.isset("depth")) path_search.depth_limit=unsafe_string2unsigned(cmdline.getval("depth")); if(cmdline.isset("context-bound")) path_search.context_bound=unsafe_string2unsigned(cmdline.getval("context-bound")); if(cmdline.isset("unwind")) path_search.unwind_limit=unsafe_string2unsigned(cmdline.getval("unwind")); if(cmdline.isset("show-vcc")) { path_search.show_vcc=true; path_search(goto_functions); return 0; } // do actual symex switch(path_search(goto_functions)) { case safety_checkert::SAFE: report_properties(path_search.property_map); report_success(); return 0; case safety_checkert::UNSAFE: report_properties(path_search.property_map); report_failure(); return 10; default: return 8; } } catch(const std::string error_msg) { error() << error_msg << messaget::eom; return 8; } catch(const char *error_msg) { error() << error_msg << messaget::eom; return 8; } #if 0 // let's log some more statistics debug() << "Memory consumption:" << messaget::endl; memory_info(debug()); debug() << eom; #endif }
int symex_parse_optionst::doit() { if(cmdline.isset("version")) { std::cout << CBMC_VERSION << std::endl; return 0; } register_language(new_ansi_c_language); register_language(new_cpp_language); register_language(new_java_bytecode_language); // // command line options // optionst options; get_command_line_options(options); eval_verbosity(); goto_model.set_message_handler(get_message_handler()); if(goto_model(cmdline.args)) return 6; if(process_goto_program(options)) return 6; label_properties(goto_model); if(cmdline.isset("show-properties")) { show_properties(goto_model, get_ui()); return 0; } if(set_properties()) return 7; if(cmdline.isset("show-locs")) { const namespacet ns(goto_model.symbol_table); locst locs(ns); locs.build(goto_model.goto_functions); locs.output(std::cout); return 0; } // do actual Symex try { const namespacet ns(goto_model.symbol_table); path_searcht path_search(ns); path_search.set_message_handler(get_message_handler()); if(cmdline.isset("depth")) path_search.set_depth_limit(unsafe_string2unsigned(cmdline.get_value("depth"))); if(cmdline.isset("context-bound")) path_search.set_context_bound(unsafe_string2unsigned(cmdline.get_value("context-bound"))); if(cmdline.isset("branch-bound")) path_search.set_branch_bound(unsafe_string2unsigned(cmdline.get_value("branch-bound"))); if(cmdline.isset("unwind")) path_search.set_unwind_limit(unsafe_string2unsigned(cmdline.get_value("unwind"))); if(cmdline.isset("dfs")) path_search.set_dfs(); if(cmdline.isset("bfs")) path_search.set_bfs(); if(cmdline.isset("locs")) path_search.set_locs(); if(cmdline.isset("show-vcc")) { path_search.show_vcc=true; path_search(goto_model.goto_functions); return 0; } path_search.eager_infeasibility= cmdline.isset("eager-infeasibility"); if(cmdline.isset("cover")) { // test-suite generation path_search(goto_model.goto_functions); report_cover(path_search.property_map); return 0; } else { // do actual symex, for assertion checking switch(path_search(goto_model.goto_functions)) { case safety_checkert::SAFE: report_properties(path_search.property_map); report_success(); return 0; case safety_checkert::UNSAFE: report_properties(path_search.property_map); report_failure(); return 10; default: return 8; } } } catch(const std::string error_msg) { error() << error_msg << messaget::eom; return 8; } catch(const char *error_msg) { error() << error_msg << messaget::eom; return 8; } #if 0 // let's log some more statistics debug() << "Memory consumption:" << messaget::endl; memory_info(debug()); debug() << eom; #endif }
int clobber_parse_optionst::doit() { if(cmdline.isset("version")) { std::cout << CBMC_VERSION << std::endl; return 0; } register_language(new_ansi_c_language); register_language(new_cpp_language); // // command line options // optionst options; get_command_line_options(options); eval_verbosity(); goto_functionst goto_functions; if(get_goto_program(options, goto_functions)) return 6; label_properties(goto_functions); if(cmdline.isset("show-properties")) { const namespacet ns(symbol_table); show_properties(ns, get_ui(), goto_functions); return 0; } if(set_properties(goto_functions)) return 7; // do instrumentation try { const namespacet ns(symbol_table); std::ofstream out("simulator.c"); if(!out) throw std::string("failed to create file simulator.c"); dump_c(goto_functions, true, ns, out); status() << "instrumentation complete; compile and execute simulator.c" << eom; return 0; } catch(const std::string error_msg) { error() << error_msg << messaget::eom; return 8; } catch(const char *error_msg) { error() << error_msg << messaget::eom; return 8; } #if 0 // let's log some more statistics debug() << "Memory consumption:" << messaget::endl; memory_info(debug()); debug() << eom; #endif }
int cbmc_parse_optionst::doit() { if(cmdline.isset("version")) { std::cout << CBMC_VERSION << std::endl; return 0; } // // command line options // optionst options; get_command_line_options(options); eval_verbosity(); // // Print a banner // status() << "CBMC version " CBMC_VERSION " " << sizeof(void *)*8 << "-bit " << config.this_architecture() << " " << config.this_operating_system() << eom; // // Unwinding of transition systems is done by hw-cbmc. // if(cmdline.isset("module") || cmdline.isset("gen-interface")) { error() << "This version of CBMC has no support for " " hardware modules. Please use hw-cbmc." << eom; return 1; } register_languages(); if(cmdline.isset("test-preprocessor")) return test_c_preprocessor(ui_message_handler)?8:0; if(cmdline.isset("preprocess")) { preprocessing(); return 0; } goto_functionst goto_functions; // get solver cbmc_solverst cbmc_solvers(options, symbol_table, ui_message_handler); cbmc_solvers.set_ui(get_ui()); std::unique_ptr<cbmc_solverst::solvert> cbmc_solver; try { cbmc_solver=cbmc_solvers.get_solver(); } catch(const char *error_msg) { error() << error_msg << eom; return 1; } prop_convt &prop_conv=cbmc_solver->prop_conv(); bmct bmc(options, symbol_table, ui_message_handler, prop_conv); int get_goto_program_ret= get_goto_program(options, bmc, goto_functions); if(get_goto_program_ret!=-1) return get_goto_program_ret; label_properties(goto_functions); if(cmdline.isset("show-claims") || // will go away cmdline.isset("show-properties")) // use this one { const namespacet ns(symbol_table); show_properties(ns, get_ui(), goto_functions); return 0; } if(cmdline.isset("show-reachable-properties")) // may replace --show-properties { const namespacet ns(symbol_table); // Entry point will have been set before and function pointers removed status() << "Removing Unused Functions" << eom; remove_unused_functions(goto_functions, ui_message_handler); show_properties(ns, get_ui(), goto_functions); return 0; } if(set_properties(goto_functions)) return 7; if(cmdline.isset("danger")) return run_danger(options, result(), symbol_table, goto_functions); if(cmdline.isset("safety")) return run_safety(options, result(), symbol_table, goto_functions); // do actual BMC return do_bmc(bmc, goto_functions); }