Go to the documentation of this file.
76 std::string(
"GOTO-ANALYZER "))
144 options.
set_option(
"specific-analysis",
true);
148 bool reachability_task =
false;
151 options.
set_option(
"unreachable-instructions",
true);
152 options.
set_option(
"specific-analysis",
true);
153 reachability_task =
true;
157 options.
set_option(
"unreachable-functions",
true);
158 options.
set_option(
"specific-analysis",
true);
159 reachability_task =
true;
163 options.
set_option(
"reachable-functions",
true);
164 options.
set_option(
"specific-analysis",
true);
165 reachability_task =
true;
169 options.
set_option(
"show-local-may-alias",
true);
170 options.
set_option(
"specific-analysis",
true);
215 "cannot output goto binary to stdout",
"--simplify");
255 options.
set_option(
"recursive-interprocedural",
true);
262 options.
set_option(
"one-domain-per-location",
true);
267 options.
set_option(
"legacy-concurrent",
true);
270 options.
set_option(
"one-domain-per-location",
true);
280 options.
set_option(
"one-domain-per-location",
true);
301 log.
status() <<
"History not specified, defaulting to --ahistorical"
331 if(reachability_task)
335 options.
set_option(
"specific-analysis",
false);
344 log.
status() <<
"Domain not specified, defaulting to --constants"
354 options.
set_option(
"one-domain-per-history",
true);
359 options.
set_option(
"one-domain-per-location",
true);
369 <<
" defaulting to --one-domain-per-history" <<
messaget::eom;
370 options.
set_option(
"one-domain-per-history",
true);
376 options.
set_option(
"validate-goto-model",
true);
391 std::unique_ptr<ai_history_factory_baset> hf =
nullptr;
399 hf = util_make_unique<call_stack_history_factoryt>(
404 std::unique_ptr<ai_domain_factory_baset> df =
nullptr;
419 std::unique_ptr<ai_storage_baset> st =
nullptr;
422 st = util_make_unique<history_sensitive_storaget>();
426 st = util_make_unique<location_sensitive_storaget>();
431 if(hf !=
nullptr && df !=
nullptr && st !=
nullptr)
436 std::move(hf), std::move(df), std::move(st));
567 if(json_file.empty())
569 else if(json_file==
"-")
573 std::ofstream ofs(json_file);
576 log.
error() <<
"Failed to open json output '" << json_file <<
"'"
592 if(json_file.empty())
594 else if(json_file==
"-")
598 std::ofstream ofs(json_file);
601 log.
error() <<
"Failed to open json output '" << json_file <<
"'"
617 if(json_file.empty())
619 else if(json_file==
"-")
623 std::ofstream ofs(json_file);
626 log.
error() <<
"Failed to open json output '" << json_file <<
"'"
643 std::cout <<
">>>>\n";
644 std::cout <<
">>>> " << it->first <<
'\n';
645 std::cout <<
">>>>\n";
647 local_may_alias.
output(std::cout, it->second, ns);
668 const std::string outfile=options.
get_option(
"outfile");
670 std::ofstream output_stream;
671 if(outfile !=
"-" && !outfile.empty())
672 output_stream.open(outfile);
675 (outfile ==
"-" || outfile.empty()) ? std::cout : output_stream);
679 log.
error() <<
"Failed to open output file '" << outfile <<
"'"
689 if(analyzer ==
nullptr)
691 log.
status() <<
"Task / Interpreter combination not supported"
723 output_stream.close();
761 log.
error() <<
"no analysis option given -- consider reading --help"
783 log.
status() <<
"Removing function pointers and virtual functions"
826 " goto-analyzer [-h] [--help] show help\n"
827 " goto-analyzer file.c ... source file names\n"
830 " --show display the abstract states on the goto program\n"
831 " --show-on-source display the abstract states on the source\n"
833 " --verify use the abstract domains to check assertions\n"
835 " --simplify file_name use the abstract domains to simplify the program\n"
836 " --unreachable-instructions list dead code\n"
838 " --unreachable-functions list functions unreachable from the entry point\n"
840 " --reachable-functions list functions reachable from the entry point\n"
842 "Abstract interpreter options:\n"
844 " --recursive-interprocedural use recursion to handle interprocedural reasoning\n"
846 " --legacy-ait recursion for function and one domain per location\n"
848 " --legacy-concurrent legacy-ait with an extended fixed-point for concurrency\n"
852 " --ahistorical the most basic history, tracks locations only\n"
854 " --call-stack n track the calling location stack for each function\n"
856 " limiting to at most n recursive loops, 0 to disable\n"
859 " --constants a constant for each variable if possible\n"
860 " --intervals an interval for each variable\n"
861 " --non-null tracks which pointers are non-null\n"
862 " --dependence-graph data and control dependencies between instructions\n"
866 " --one-domain-per-history stores a domain for each history object created\n"
867 " --one-domain-per-location stores a domain for each location reached\n"
870 " --text file_name output results in plain text to given file\n"
872 " --json file_name output results in JSON format to given file\n"
873 " --xml file_name output results in XML format to given file\n"
874 " --dot file_name output results in DOT format to given file\n"
876 "Specific analyses:\n"
878 " --taint file_name perform taint analysis using rules in given file\n"
880 "C/C++ frontend options:\n"
881 " -I path set include path (C/C++)\n"
882 " -D macro define preprocessor macro (C/C++)\n"
883 " --arch X set architecture (default: "
885 " --os set operating system (default: "
887 " --c89/99/11 set C language standard (default: "
895 " --cpp98/03/11 set C++ language standard (default: "
906 " --gcc use GCC as preprocessor\n"
908 " --no-library disable built-in abstract C library\n"
911 "Program representations:\n"
912 " --show-parse-tree show parse tree\n"
913 " --show-symbol-table show loaded symbol table\n"
917 "Program instrumentation options:\n"
922 " --version show version and exit\n"
const char * CBMC_VERSION
#define UNREACHABLE
This should be used to mark dead code.
#define HELP_SHOW_GOTO_FUNCTIONS
void output(std::ostream &out, const goto_functiont &goto_function, const namespacet &ns) const
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)
void goto_partial_inline(goto_modelt &goto_model, message_handlert &message_handler, unsigned smallfunc_limit, bool adjust_function)
Inline all function calls to functions either marked as "inlined" or smaller than smallfunc_limit (by...
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
#define CPROVER_EXIT_VERIFICATION_SAFE
Verification successful indicates the analysis has been performed without error AND the software is s...
void goto_check(const irep_idt &function_identifier, goto_functionst::goto_functiont &goto_function, const namespacet &ns, const optionst &options)
void set_option(const std::string &option, const bool value)
void show_symbol_table(const symbol_tablet &symbol_table, ui_message_handlert &ui)
struct configt::ansi_ct ansi_c
ai_baset * build_analyzer(const optionst &, const namespacet &ns)
For the task, build the appropriate kind of analyzer Ideally this should be a pure function of option...
goto_analyzer_parse_optionst(int argc, const char **argv)
void label_properties(goto_modelt &goto_model)
virtual void usage_error()
std::unique_ptr< languaget > new_cpp_language()
void reachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
static void remove_vector(typet &)
removes vector data type
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
std::unique_ptr< T > util_make_unique(Ts &&... ts)
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)
An easy factory implementation for histories that don't need parameters.
#define PRECONDITION(CONDITION)
std::string get_value(char option) const
virtual int doit() override
invoke main modules
#define HELP_SHOW_PROPERTIES
static irep_idt this_operating_system()
void show_goto_functions(const namespacet &ns, ui_message_handlert &ui_message_handler, const goto_functionst &goto_functions, bool list_only)
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
void compute_loop_numbers()
#define GOTO_ANALYSER_OPTIONS
static void unreachable_instructions(const goto_programt &goto_program, dead_mapt &dest)
unsigned int get_unsigned_int_option(const std::string &option) const
static c_standardt default_c_standard()
static void remove_complex(typet &)
removes complex data type
virtual void register_languages()
static irep_idt this_architecture()
void register_language(language_factoryt factory)
Register a language Note: registering a language is required for using the functions in language_util...
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)
static cpp_standardt default_cpp_standard()
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)
void remove_returns(symbol_table_baset &symbol_table, goto_functionst &goto_functions)
removes returns
This is the basic interface of the abstract interpreter with default implementations of the core func...
std::unique_ptr< languaget > new_ansi_c_language()
#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 forall_goto_functions(it, functions)
void adjust_float_expressions(exprt &expr, const exprt &rounding_mode)
Replaces arithmetic operations and typecasts involving floating point numbers with their equivalent f...
#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.
bool remove_function_pointers(message_handlert &_message_handler, symbol_tablet &symbol_table, const goto_functionst &goto_functions, goto_programt &goto_program, const irep_idt &function_id, bool add_safety_assertion, bool only_remove_const_fps)
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)
std::unique_ptr< languaget > new_jsil_language()