62 ui_message_handler(cmdline,
"JANALYZER " CBMC_VERSION)
103 bool reachability_task =
false;
106 options.
set_option(
"unreachable-instructions",
true);
107 options.
set_option(
"specific-analysis",
true);
108 reachability_task =
true;
112 options.
set_option(
"unreachable-functions",
true);
113 options.
set_option(
"specific-analysis",
true);
114 reachability_task =
true;
118 options.
set_option(
"reachable-functions",
true);
119 options.
set_option(
"specific-analysis",
true);
120 reachability_task =
true;
124 options.
set_option(
"show-local-may-alias",
true);
125 options.
set_option(
"specific-analysis",
true);
179 "simplify-slicing", !(
cmdline.
isset(
"no-simplify-slicing")));
208 options.
set_option(
"location-sensitive",
true);
215 options.
set_option(
"location-sensitive",
true);
242 if(reachability_task)
246 options.
set_option(
"specific-analysis",
false);
255 status() <<
"Domain not specified, defaulting to --constants" <<
eom;
328 std::cout << CBMC_VERSION <<
'\n';
344 status() <<
"JANALYZER version " CBMC_VERSION
" " <<
sizeof(
void *) * 8
361 catch(
const std::string &e)
369 error() <<
"Numeric exception: " << e <<
eom;
407 catch(
const std::string &e)
415 error() <<
"Numeric exception: " << e <<
eom;
419 catch(
const std::bad_alloc &)
454 if(json_file.empty())
456 else if(json_file ==
"-")
460 std::ofstream ofs(json_file);
463 error() <<
"Failed to open json output `" << json_file <<
"'" <<
eom;
479 if(json_file.empty())
481 else if(json_file ==
"-")
485 std::ofstream ofs(json_file);
488 error() <<
"Failed to open json output `" << json_file <<
"'" <<
eom;
504 if(json_file.empty())
506 else if(json_file ==
"-")
510 std::ofstream ofs(json_file);
513 error() <<
"Failed to open json output `" << json_file <<
"'" <<
eom;
529 std::cout <<
">>>>\n";
530 std::cout <<
">>>> " << it->first <<
'\n';
531 std::cout <<
">>>>\n";
533 local_may_alias.
output(std::cout, it->second, ns);
554 const std::string outfile = options.
get_option(
"outfile");
555 std::ofstream output_stream;
556 if(!(outfile ==
"-"))
557 output_stream.open(outfile);
559 std::ostream &out((outfile ==
"-") ? std::cout : output_stream);
563 error() <<
"Failed to open output file `" << outfile <<
"'" <<
eom;
568 status() <<
"Selecting abstract domain" <<
eom;
572 if(analyzer ==
nullptr)
574 status() <<
"Task / Interpreter / Domain combination not supported" 580 status() <<
"Computing abstract states" <<
eom;
627 error() <<
"no analysis option given -- consider reading --help" <<
eom;
645 catch(
const std::string &e)
664 status() <<
"Removing function pointers and virtual functions" <<
eom;
685 status() <<
"Generic Property Instrumentation" <<
eom;
701 catch(
const std::string &e)
712 catch(
const std::bad_alloc &)
725 std::cout <<
'\n' <<
banner_string(
"JANALYZER", CBMC_VERSION) <<
'\n' 728 "* * Copyright (C) 2016-2018 * *\n" 729 "* * Daniel Kroening, Diffblue * *\n" 730 "* * kroening@kroening.com * *\n" 734 " janalyzer [-?] [-h] [--help] show help\n" 735 " janalyzer class name of class to be checked\n" 738 " --show display the abstract domains\n" 740 " --verify use the abstract domains to check assertions\n" 742 " --simplify file_name use the abstract domains to simplify the program\n" 743 " --unreachable-instructions list dead code\n" 745 " --unreachable-functions list functions unreachable from the entry point\n" 747 " --reachable-functions list functions reachable from the entry point\n" 749 "Abstract interpreter options:\n" 751 " --location-sensitive use location-sensitive abstract interpreter\n" 752 " --concurrent use concurrency-aware abstract interpreter\n" 755 " --constants constant domain\n" 756 " --intervals interval domain\n" 757 " --non-null non-null domain\n" 758 " --dependence-graph data and control dependencies between instructions\n" 761 " --text file_name output results in plain text to given file\n" 763 " --json file_name output results in JSON format to given file\n" 764 " --xml file_name output results in XML format to given file\n" 765 " --dot file_name output results in DOT format to given file\n" 767 "Specific analyses:\n" 769 " --taint file_name perform taint analysis using rules in given file\n" 771 "Java Bytecode frontend options:\n" 772 " --classpath dir/jar set the classpath\n" 773 " --main-class class-name set the name of the main class\n" 777 "Program representations:\n" 778 " --show-parse-tree show parse tree\n" 779 " --show-symbol-table show loaded symbol table\n" 783 "Program instrumentation options:\n" 787 " --version show version and exit\n"
const std::list< std::string > & get_values(const std::string &option) const
Over-approximate Concurrency for Threaded Goto Programs.
Remove function exceptional returns.
janalyzer_parse_optionst(int argc, const char **argv)
Remove Instance-of Operators.
virtual void register_languages()
Remove Indirect Function Calls.
Remove Virtual Function (Method) Calls.
Field-Sensitive Program Dependence Analysis, Litvak et al., FSE 2010.
void compute_loop_numbers()
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...
Remove the 'complex' data type by compilation into structs.
std::string get_value(char option) const
bool static_show_domain(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, message_handlert &message_handler, std::ostream &out)
Runs the analyzer and then prints out the domain.
bool static_reachable_functions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, message_handlert &message_handler, std::ostream &out)
bool static_unreachable_functions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, message_handlert &message_handler, std::ostream &out)
symbol_tablet symbol_table
Symbol table.
static mstreamt & eom(mstreamt &m)
#define CPROVER_EXIT_INTERNAL_ERROR
An error has been encountered during processing the requested analysis.
void show_goto_functions(const namespacet &ns, message_handlert &message_handler, ui_message_handlert::uit ui, const goto_functionst &goto_functions, bool list_only)
void remove_virtual_functions(const symbol_table_baset &symbol_table, goto_functionst &goto_functions)
#define CPROVER_EXIT_SUCCESS
Success indicates the required analysis has been performed without error.
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...
Set the properties to check.
virtual int perform_analysis(const optionst &options)
Depending on the command line mode, run one of the analysis tasks.
bool set(const cmdlinet &cmdline)
bool taint_analysis(goto_modelt &goto_model, const std::string &taint_file_name, message_handlert &message_handler, bool show_full, const std::string &json_file_name)
void remove_instanceof(goto_programt::targett target, goto_programt &goto_program, symbol_table_baset &symbol_table)
Replace an instanceof in the expression or guard of the passed instruction of the given function body...
void show_symbol_table(const symbol_tablet &symbol_table, ui_message_handlert::uit ui)
virtual bool isset(char option) const
Initialize a Goto Program.
#define HELP_SHOW_PROPERTIES
void remove_exceptions(symbol_table_baset &symbol_table, goto_functionst &goto_functions, remove_exceptions_typest type)
removes throws/CATCH-POP/CATCH-PUSH
const std::string get_option(const std::string &option) const
bool get_bool_option(const std::string &option) const
virtual int doit() override
invoke main modules
Abstract interface to support a programming language.
std::unique_ptr< languaget > new_java_bytecode_language()
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.
bool remove_function_pointers(message_handlert &_message_handler, symbol_tablet &symbol_table, const goto_functionst &goto_functions, goto_programt &goto_program, bool add_safety_assertion, bool only_remove_const_fps)
std::string banner_string(const std::string &front_end, const std::string &version)
void remove_returns(symbol_table_baset &symbol_table, goto_functionst &goto_functions)
removes returns
void goto_check(const namespacet &ns, const optionst &options, const irep_idt &mode, goto_functionst::goto_functiont &goto_function)
#define CPROVER_EXIT_EXCEPTION
An (unanticipated) exception was thrown during computation.
virtual bool process_goto_program(const optionst &options)
List all unreachable instructions.
static irep_idt this_operating_system()
#define CPROVER_EXIT_INTERNAL_OUT_OF_MEMORY
Memory allocation has failed and this has been detected within the program.
bool static_verifier(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, message_handlert &message_handler, std::ostream &out)
Runs the analyzer and then prints out the domain.
virtual void get_command_line_options(optionst &options)
ui_message_handlert::uit get_ui()
message_handlert & get_message_handler()
bool static_unreachable_instructions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, message_handlert &message_handler, std::ostream &out)
Goto Programs with Functions.
Document and give macros for the exit codes of CPROVER binaries.
mstreamt & result() const
mstreamt & status() const
#define JAVA_BYTECODE_LANGUAGE_OPTIONS_HELP
#define HELP_SHOW_GOTO_FUNCTIONS
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...
#define CPROVER_EXIT_VERIFICATION_UNSAFE
Verification successful indiciates the analysis has been performed without error AND the software is ...
JANALYZER Command Line Option Processing.
static void unreachable_instructions(const goto_programt &goto_program, dead_mapt &dest)
goto_modelt initialize_goto_model(const cmdlinet &cmdline, message_handlert &message_handler)
void unreachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
Remove the 'vector' data type by compilation into arrays.
#define JANALYZER_OPTIONS
virtual void usage_error()
void register_language(language_factoryt factory)
Register a language Note: registering a language is required for using the functions in language_util...
#define CPROVER_EXIT_VERIFICATION_SAFE
Verification successful indiciates the analysis has been performed without error AND the software is ...
void set_option(const std::string &option, const bool value)
static void remove_complex(typet &)
removes complex data type
void output(std::ostream &out, const goto_functiont &goto_function, const namespacet &ns) const
virtual void help() override
display command line help
#define forall_goto_functions(it, functions)
#define CPROVER_EXIT_USAGE_ERROR
A usage error is returned when the command line is invalid or conflicting.
void reachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
void label_properties(goto_modelt &goto_model)
goto_functionst goto_functions
GOTO functions.
static void remove_vector(typet &)
removes vector data type
static irep_idt this_architecture()
#define CPROVER_EXIT_SET_PROPERTIES_FAILED
Failure to identify the properties to verify.
ui_message_handlert ui_message_handler
Field-insensitive, location-sensitive may-alias analysis.
void show_properties(const namespacet &ns, const irep_idt &identifier, message_handlert &message_handler, ui_message_handlert::uit ui, const goto_programt &goto_program)