Go to the documentation of this file.
55 std::string(
"GOTO-ANALYZER "))
85 bool reachability_task =
false;
88 options.
set_option(
"unreachable-instructions",
true);
90 reachability_task =
true;
94 options.
set_option(
"unreachable-functions",
true);
96 reachability_task =
true;
100 options.
set_option(
"reachable-functions",
true);
101 options.
set_option(
"specific-analysis",
true);
102 reachability_task =
true;
106 options.
set_option(
"show-local-may-alias",
true);
107 options.
set_option(
"specific-analysis",
true);
152 "cannot output goto binary to stdout",
"--simplify");
192 options.
set_option(
"recursive-interprocedural",
true);
201 options.
set_option(
"one-domain-per-location",
true);
206 options.
set_option(
"legacy-concurrent",
true);
209 options.
set_option(
"one-domain-per-location",
true);
219 options.
set_option(
"one-domain-per-location",
true);
238 options.
set_option(
"local-control-flow-history",
true);
239 options.
set_option(
"local-control-flow-history-forward",
false);
240 options.
set_option(
"local-control-flow-history-backward",
true);
247 options.
set_option(
"local-control-flow-history",
true);
248 options.
set_option(
"local-control-flow-history-forward",
true);
249 options.
set_option(
"local-control-flow-history-backward",
false);
256 options.
set_option(
"local-control-flow-history",
true);
257 options.
set_option(
"local-control-flow-history-forward",
true);
258 options.
set_option(
"local-control-flow-history-backward",
true);
260 "local-control-flow-history-limit",
268 log.
status() <<
"History not specified, defaulting to --ahistorical"
304 options.
set_option(
"dependence-graph-vs",
true);
308 options.
set_option(
"data-dependencies",
true);
313 if(reachability_task)
317 options.
set_option(
"specific-analysis",
false);
326 log.
status() <<
"Domain not specified, defaulting to --constants"
336 options.
set_option(
"one-domain-per-history",
true);
341 options.
set_option(
"one-domain-per-location",
true);
351 <<
" defaulting to --one-domain-per-history" <<
messaget::eom;
352 options.
set_option(
"one-domain-per-history",
true);
358 options.
set_option(
"validate-goto-model",
true);
388 gcc_version.
get(
"gcc");
454 if(json_file.empty())
456 else if(json_file==
"-")
460 std::ofstream ofs(json_file);
463 log.
error() <<
"Failed to open json output '" << json_file <<
"'"
479 if(json_file.empty())
481 else if(json_file==
"-")
485 std::ofstream ofs(json_file);
488 log.
error() <<
"Failed to open json output '" << json_file <<
"'"
504 if(json_file.empty())
506 else if(json_file==
"-")
510 std::ofstream ofs(json_file);
513 log.
error() <<
"Failed to open json output '" << json_file <<
"'"
530 std::cout <<
">>>>\n";
531 std::cout <<
">>>> " << gf_entry.first <<
'\n';
532 std::cout <<
">>>>\n";
534 local_may_alias.
output(std::cout, gf_entry.second, ns);
555 const std::string outfile=options.
get_option(
"outfile");
557 std::ofstream output_stream;
558 if(outfile !=
"-" && !outfile.empty())
559 output_stream.open(outfile);
562 (outfile ==
"-" || outfile.empty()) ? std::cout : output_stream);
566 log.
error() <<
"Failed to open output file '" << outfile <<
"'"
574 std::unique_ptr<ai_baset> analyzer;
586 if(analyzer ==
nullptr)
588 log.
status() <<
"Task / Interpreter combination not supported"
620 output_stream.close();
657 log.
error() <<
"no analysis option given -- consider reading --help"
694 " goto-analyzer [-?|-h|--help] show help\n"
695 " goto-analyzer file.c ... source file names\n"
698 " --show display the abstract states on the goto program\n"
699 " --show-on-source display the abstract states on the source\n"
701 " --verify use the abstract domains to check assertions\n"
703 " --simplify file_name use the abstract domains to simplify the program\n"
704 " --no-simplify-slicing do not remove instructions from which no\n"
705 " property can be reached (use with --simplify)\n"
706 " --unreachable-instructions list dead code\n"
708 " --unreachable-functions list functions unreachable from the entry point\n"
710 " --reachable-functions list functions reachable from the entry point\n"
712 "Abstract interpreter options:\n"
714 " --legacy-ait recursion for function and one domain per location\n"
716 " --recursive-interprocedural use recursion to handle interprocedural reasoning\n"
718 " --three-way-merge use VSD's three-way merge on return from function call\n"
720 " --legacy-concurrent legacy-ait with an extended fixed-point for concurrency\n"
722 " --location-sensitive use location-sensitive abstract interpreter\n"
726 " --ahistorical the most basic history, tracks locations only\n"
728 " --call-stack n track the calling location stack for each function\n"
730 " limiting to at most n recursive loops, 0 to disable\n"
732 " --loop-unwind n track the number of loop iterations within a function\n"
734 " limited to n histories per location, 0 is unlimited\n"
736 " --branching n track the forwards jumps (if, switch, etc.) within a function\n"
738 " limited to n histories per location, 0 is unlimited\n"
740 " --loop-unwind-and-branching n track all local control flow\n"
742 " limited to n histories per location, 0 is unlimited\n"
745 " --constants a constant for each variable if possible\n"
746 " --intervals an interval for each variable\n"
747 " --non-null tracks which pointers are non-null\n"
748 " --dependence-graph data and control dependencies between instructions\n"
749 " --vsd, --variable-sensitivity\n"
750 " a configurable non-relational domain\n"
751 " --dependence-graph-vs dependencies between instructions using VSD\n"
753 "Variable sensitivity domain (VSD) options:\n"
758 " --one-domain-per-location stores a domain for each location reached (default)\n"
760 " --one-domain-per-history stores a domain for each history object created\n"
763 " --text file_name output results in plain text to given file\n"
765 " --json file_name output results in JSON format to given file\n"
766 " --xml file_name output results in XML format to given file\n"
767 " --dot file_name output results in DOT format to given file\n"
769 "Specific analyses:\n"
771 " --taint file_name perform taint analysis using rules in given file\n"
772 " --show-taint print taint analysis results on stdout\n"
773 " --show-local-may-alias perform procedure-local may alias analysis\n"
775 "C/C++ frontend options:\n"
779 "Platform options:\n"
782 "Program representations:\n"
783 " --show-parse-tree show parse tree\n"
784 " --show-symbol-table show loaded symbol table\n"
788 "Program instrumentation options:\n"
789 " --property id enable selected properties only\n"
795 " --version show version and exit\n"
797 " --verbosity # verbosity level\n"
#define HELP_SHOW_GOTO_FUNCTIONS
void output(std::ostream &out, const goto_functiont &goto_function, const namespacet &ns) const
void get(const std::string &executable)
ui_message_handlert ui_message_handler
#define CPROVER_EXIT_VERIFICATION_UNSAFE
Verification successful indicates the analysis has been performed without error AND the software is n...
void link_to_library(goto_modelt &goto_model, message_handlert &message_handler, const std::function< void(const std::set< irep_idt > &, symbol_tablet &, message_handlert &)> &library)
Complete missing function definitions using the library.
virtual bool isset(char option) const
bool static_unreachable_instructions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
void static_verifier(const abstract_goto_modelt &abstract_goto_model, const ai_baset &ai, propertiest &properties)
Use the information from the abstract interpreter to fill out the statuses of the passed properties.
virtual void get_command_line_options(optionst &options)
bool static_simplifier(goto_modelt &goto_model, const ai_baset &ai, const optionst &options, message_handlert &message_handler, std::ostream &out)
Simplifies the program using the information in the abstract domain.
const std::string get_option(const std::string &option) const
mstreamt & status() const
void show_properties(const namespacet &ns, const irep_idt &identifier, message_handlert &message_handler, ui_message_handlert::uit ui, const goto_programt &goto_program)
#define HELP_CONFIG_PLATFORM
void configure_gcc(const gcc_versiont &gcc_version)
#define CPROVER_EXIT_VERIFICATION_SAFE
Verification successful indicates the analysis has been performed without error AND the software is s...
std::unique_ptr< ai_baset > build_analyzer(const optionst &options, const goto_modelt &goto_model, const namespacet &ns, message_handlert &mh)
Ideally this should be a pure function of options.
void set_option(const std::string &option, const bool value)
void log_version_and_architecture(const std::string &front_end)
Write version and system architecture to log.status().
void show_symbol_table(const symbol_tablet &symbol_table, ui_message_handlert &ui)
struct configt::ansi_ct ansi_c
function_mapt function_map
goto_analyzer_parse_optionst(int argc, const char **argv)
void label_properties(goto_modelt &goto_model)
virtual void usage_error()
void reachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
#define PARSE_OPTIONS_VSD(cmdline, options)
std::string what() const override
A human readable description of what went wrong.
const char * CBMC_VERSION
#define HELP_CONFIG_C_CPP
void unreachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
virtual bool process_goto_program(const optionst &options)
std::string banner_string(const std::string &front_end, const std::string &version)
preprocessort preprocessor
#define PRECONDITION(CONDITION)
std::string get_value(char option) const
virtual int doit() override
invoke main modules
#define HELP_SHOW_PROPERTIES
void show_goto_functions(const namespacet &ns, ui_message_handlert &ui_message_handler, const goto_functionst &goto_functions, bool list_only)
#define PARSE_OPTIONS_GOTO_CHECK(cmdline, options)
#define HELP_CONFIG_LIBRARY
void static_show_domain(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
Runs the analyzer and then prints out the domain.
virtual void help() override
display command line help
#define GOTO_ANALYSER_OPTIONS
static void unreachable_instructions(const goto_programt &goto_program, dead_mapt &dest)
goto_functionst goto_functions
GOTO functions.
bool static_reachable_functions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
void cprover_c_library_factory(const std::set< irep_idt > &functions, symbol_tablet &symbol_table, message_handlert &message_handler)
bool set(const cmdlinet &cmdline)
bool get_bool_option(const std::string &option) const
bool taint_analysis(goto_modelt &goto_model, const std::string &taint_file_name, message_handlert &message_handler, bool show_full, const optionalt< std::string > &json_file_name)
#define CPROVER_EXIT_USAGE_ERROR
A usage error is returned when the command line is invalid or conflicting.
static std::string binary(const constant_exprt &src)
void remove_asm(goto_functionst &goto_functions, symbol_tablet &symbol_table)
Replaces inline assembly instructions in the goto program (i.e., instructions of kind OTHER with a co...
void validate(const validation_modet vm=validation_modet::INVARIANT, const goto_model_validation_optionst &goto_model_validation_options=goto_model_validation_optionst{}) const override
Check that the goto model is well-formed.
#define CPROVER_EXIT_INTERNAL_ERROR
An error has been encountered during processing the requested analysis.
goto_modelt initialize_goto_model(const std::vector< std::string > &files, message_handlert &message_handler, const optionst &options)
bool static_unreachable_functions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
#define CPROVER_EXIT_SUCCESS
Success indicates the required analysis has been performed without error.
void show_on_source(const std::string &source_file, const goto_modelt &goto_model, const ai_baset &ai, message_handlert &message_handler)
output source code annotated with abstract states for given file
static unsigned eval_verbosity(const std::string &user_input, const message_levelt default_verbosity, message_handlert &dest)
Parse a (user-)provided string as a verbosity level and set it as the verbosity of dest.
void register_languages() override
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
const std::list< std::string > & get_values(const std::string &option) const
void set_properties(goto_programt &goto_program, std::unordered_set< irep_idt > &property_set)
symbol_tablet symbol_table
Symbol table.
std::string align_center_with_border(const std::string &text)
Utility for displaying help centered messages borderered by "* *".
virtual int perform_analysis(const optionst &options)
Depending on the command line mode, run one of the analysis tasks.
void cprover_cpp_library_factory(const std::set< irep_idt > &functions, symbol_tablet &symbol_table, message_handlert &message_handler)