CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
goto_analyzer_parse_options.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Goto-Analyzer Command Line Option Processing
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
13
14#include <util/config.h>
16#include <util/exit_codes.h>
17#include <util/help_formatter.h>
18#include <util/options.h>
19#include <util/version.h>
20
26
27#include <analyses/ai.h>
31#include <ansi-c/gcc_version.h>
34#include <cpp/cprover_library.h>
35
36#include "build_analyzer.h"
37#include "show_on_source.h"
38#include "static_show_domain.h"
39#include "static_simplifier.h"
40#include "static_verifier.h"
41#include "taint_analysis.h"
43
44#include <cstdlib> // exit()
45#include <fstream> // IWYU pragma: keep
46#include <iostream>
47#include <memory>
48
50 int argc,
51 const char **argv)
54 argc,
55 argv,
56 std::string("GOTO-ANALYZER "))
57{
58}
59
61 optionst &options,
62 const bool enabled)
63{
64 // Checks enabled by default in v6.0+.
65 options.set_option("bounds-check", enabled);
66 options.set_option("pointer-check", enabled);
67 options.set_option("pointer-primitive-check", enabled);
68 options.set_option("div-by-zero-check", enabled);
69 options.set_option("signed-overflow-check", enabled);
70 options.set_option("undefined-shift-check", enabled);
71
72 if(enabled)
73 {
74 config.ansi_c.malloc_may_fail = true;
75 config.ansi_c.malloc_failure_mode =
77 }
78 else
79 {
80 config.ansi_c.malloc_may_fail = false;
81 config.ansi_c.malloc_failure_mode =
83 }
84
85 // This is in-line with the options we set for CBMC in cbmc_parse_optionst
86 // with the exception of unwinding-assertions, which don't make sense in
87 // the context of abstract interpretation.
88}
89
91{
93 options, !cmdline.isset("no-standard-checks"));
94
95 if(config.set(cmdline))
96 {
99 }
100
101 if(cmdline.isset("function"))
102 options.set_option("function", cmdline.get_value("function"));
103
104 // all (other) checks supported by goto_check
106
107 // The user should either select:
108 // 1. a specific analysis, or
109 // 2. a tuple of task / analyser options / outputs
110
111 // Select a specific analysis
112 if(cmdline.isset("taint"))
113 {
114 options.set_option("taint", true);
115 options.set_option("specific-analysis", true);
116 }
117 // For backwards compatibility,
118 // these are first recognised as specific analyses
119 bool reachability_task = false;
120 if(cmdline.isset("unreachable-instructions"))
121 {
122 options.set_option("unreachable-instructions", true);
123 options.set_option("specific-analysis", true);
124 reachability_task = true;
125 }
126 if(cmdline.isset("unreachable-functions"))
127 {
128 options.set_option("unreachable-functions", true);
129 options.set_option("specific-analysis", true);
130 reachability_task = true;
131 }
132 if(cmdline.isset("reachable-functions"))
133 {
134 options.set_option("reachable-functions", true);
135 options.set_option("specific-analysis", true);
136 reachability_task = true;
137 }
138 if(cmdline.isset("show-local-may-alias"))
139 {
140 options.set_option("show-local-may-alias", true);
141 options.set_option("specific-analysis", true);
142 }
143 if(cmdline.isset("show-local-bitvector"))
144 {
145 options.set_option("show-local-bitvector", true);
146 options.set_option("specific-analysis", true);
147 }
148
149 // Output format choice
150 if(cmdline.isset("text"))
151 {
152 options.set_option("text", true);
153 options.set_option("outfile", cmdline.get_value("text"));
154 }
155 else if(cmdline.isset("json"))
156 {
157 options.set_option("json", true);
158 options.set_option("outfile", cmdline.get_value("json"));
159 }
160 else if(cmdline.isset("xml"))
161 {
162 options.set_option("xml", true);
163 options.set_option("outfile", cmdline.get_value("xml"));
164 }
165 else if(cmdline.isset("dot"))
166 {
167 options.set_option("dot", true);
168 options.set_option("outfile", cmdline.get_value("dot"));
169 }
170
171 // Task options
172 if(cmdline.isset("show"))
173 {
174 options.set_option("show", true);
175 options.set_option("general-analysis", true);
176 }
177 else if(cmdline.isset("show-on-source"))
178 {
179 options.set_option("show-on-source", true);
180 options.set_option("general-analysis", true);
181 }
182 else if(cmdline.isset("verify"))
183 {
184 options.set_option("verify", true);
185 options.set_option("general-analysis", true);
186 }
187 else if(cmdline.isset("simplify"))
188 {
189 if(cmdline.get_value("simplify") == "-")
191 "cannot output goto binary to stdout", "--simplify");
192
193 options.set_option("simplify", true);
194 options.set_option("outfile", cmdline.get_value("simplify"));
195 options.set_option("general-analysis", true);
196
197 // For development allow slicing to be disabled in the simplify task
198 options.set_option(
199 "simplify-slicing",
200 !(cmdline.isset("no-simplify-slicing")));
201 }
202 else if(cmdline.isset("show-intervals"))
203 {
204 // For backwards compatibility
205 options.set_option("show", true);
206 options.set_option("general-analysis", true);
207 options.set_option("intervals", true);
208 options.set_option("domain set", true);
209 }
210 else if(cmdline.isset("show-non-null"))
211 {
212 // For backwards compatibility
213 options.set_option("show", true);
214 options.set_option("general-analysis", true);
215 options.set_option("non-null", true);
216 options.set_option("domain set", true);
217 }
218 else if(cmdline.isset("intervals") || cmdline.isset("non-null"))
219 {
220 // Partial backwards compatability, just giving these domains without
221 // a task will work. However it will use the general default of verify
222 // rather than their historical default of show.
223 options.set_option("verify", true);
224 options.set_option("general-analysis", true);
225 }
226
227 if(options.get_bool_option("general-analysis") || reachability_task)
228 {
229 // Abstract interpreter choice
230 if(cmdline.isset("recursive-interprocedural"))
231 options.set_option("recursive-interprocedural", true);
232 else if(cmdline.isset("three-way-merge"))
233 options.set_option("three-way-merge", true);
234 else if(cmdline.isset("legacy-ait") || cmdline.isset("location-sensitive"))
235 {
236 options.set_option("legacy-ait", true);
237 // Fixes a number of other options as well
238 options.set_option("ahistorical", true);
239 options.set_option("history set", true);
240 options.set_option("one-domain-per-location", true);
241 options.set_option("storage set", true);
242 }
243 else if(cmdline.isset("legacy-concurrent") || cmdline.isset("concurrent"))
244 {
245 options.set_option("legacy-concurrent", true);
246 options.set_option("ahistorical", true);
247 options.set_option("history set", true);
248 options.set_option("one-domain-per-location", true);
249 options.set_option("storage set", true);
250 }
251 else
252 {
253 // Silently default to legacy-ait for backwards compatability
254 options.set_option("legacy-ait", true);
255 // Fixes a number of other options as well
256 options.set_option("ahistorical", true);
257 options.set_option("history set", true);
258 options.set_option("one-domain-per-location", true);
259 options.set_option("storage set", true);
260 }
261
262 // History choice
263 if(cmdline.isset("ahistorical"))
264 {
265 options.set_option("ahistorical", true);
266 options.set_option("history set", true);
267 }
268 else if(cmdline.isset("call-stack"))
269 {
270 options.set_option("call-stack", true);
271 options.set_option(
272 "call-stack-recursion-limit", cmdline.get_value("call-stack"));
273 options.set_option("history set", true);
274 }
275 else if(cmdline.isset("loop-unwind"))
276 {
277 options.set_option("local-control-flow-history", true);
278 options.set_option("local-control-flow-history-forward", false);
279 options.set_option("local-control-flow-history-backward", true);
280 options.set_option(
281 "local-control-flow-history-limit", cmdline.get_value("loop-unwind"));
282 options.set_option("history set", true);
283 }
284 else if(cmdline.isset("branching"))
285 {
286 options.set_option("local-control-flow-history", true);
287 options.set_option("local-control-flow-history-forward", true);
288 options.set_option("local-control-flow-history-backward", false);
289 options.set_option(
290 "local-control-flow-history-limit", cmdline.get_value("branching"));
291 options.set_option("history set", true);
292 }
293 else if(cmdline.isset("loop-unwind-and-branching"))
294 {
295 options.set_option("local-control-flow-history", true);
296 options.set_option("local-control-flow-history-forward", true);
297 options.set_option("local-control-flow-history-backward", true);
298 options.set_option(
299 "local-control-flow-history-limit",
300 cmdline.get_value("loop-unwind-and-branching"));
301 options.set_option("history set", true);
302 }
303
304 if(!options.get_bool_option("history set"))
305 {
306 // Default to ahistorical as it is the expected for of analysis
307 log.status() << "History not specified, defaulting to --ahistorical"
308 << messaget::eom;
309 options.set_option("ahistorical", true);
310 options.set_option("history set", true);
311 }
312
313 // Domain choice
314 if(cmdline.isset("constants"))
315 {
316 options.set_option("constants", true);
317 options.set_option("domain set", true);
318 }
319 else if(cmdline.isset("dependence-graph"))
320 {
321 options.set_option("dependence-graph", true);
322 options.set_option("domain set", true);
323 }
324 else if(cmdline.isset("intervals"))
325 {
326 options.set_option("intervals", true);
327 options.set_option("domain set", true);
328 }
329 else if(cmdline.isset("non-null"))
330 {
331 options.set_option("non-null", true);
332 options.set_option("domain set", true);
333 }
334 else if(cmdline.isset("vsd") || cmdline.isset("variable-sensitivity"))
335 {
336 options.set_option("vsd", true);
337 options.set_option("domain set", true);
338
339 PARSE_OPTIONS_VSD(cmdline, options);
340 }
341 else if(cmdline.isset("dependence-graph-vs"))
342 {
343 options.set_option("dependence-graph-vs", true);
344 options.set_option("domain set", true);
345
346 PARSE_OPTIONS_VSD(cmdline, options);
347 options.set_option("data-dependencies", true); // Always set
348 }
349
350 // Reachability questions, when given with a domain swap from specific
351 // to general tasks so that they can use the domain & parameterisations.
353 {
354 if(options.get_bool_option("domain set"))
355 {
356 options.set_option("specific-analysis", false);
357 options.set_option("general-analysis", true);
358 }
359 }
360 else
361 {
362 if(!options.get_bool_option("domain set"))
363 {
364 // Default to constants as it is light-weight but useful
365 log.status() << "Domain not specified, defaulting to --constants"
366 << messaget::eom;
367 options.set_option("constants", true);
368 }
369 }
370 }
371
372 // Storage choice
373 if(cmdline.isset("one-domain-per-history"))
374 {
375 options.set_option("one-domain-per-history", true);
376 options.set_option("storage set", true);
377 }
378 else if(cmdline.isset("one-domain-per-location"))
379 {
380 options.set_option("one-domain-per-location", true);
381 options.set_option("storage set", true);
382 }
383
384 if(!options.get_bool_option("storage set"))
385 {
386 // one-domain-per-location and one-domain-per-history are effectively
387 // the same when using ahistorical so we default to per-history so that
388 // more sophisticated history objects work as expected
389 log.status() << "Storage not specified,"
390 << " defaulting to --one-domain-per-history" << messaget::eom;
391 options.set_option("one-domain-per-history", true);
392 options.set_option("storage set", true);
393 }
394
395 if(cmdline.isset("validate-goto-model"))
396 {
397 options.set_option("validate-goto-model", true);
398 }
399}
400
403{
404 if(cmdline.isset("version"))
405 {
406 std::cout << CBMC_VERSION << '\n';
408 }
409
410 //
411 // command line options
412 //
413
414 optionst options;
418
419 log_version_and_architecture("GOTO-ANALYZER");
420
422
423 // configure gcc, if required
425 {
426 gcc_versiont gcc_version;
427 gcc_version.get("gcc");
428 configure_gcc(gcc_version);
429 }
430
432
433 // Preserve backwards compatibility in processing
434 options.set_option("partial-inline", true);
435 options.set_option("rewrite-rw-ok", false);
436 options.set_option("rewrite-union", false);
437 options.set_option("remove-returns", true);
438
439 if(process_goto_program(options))
441
442 if(cmdline.isset("validate-goto-model"))
443 {
445 }
446
447 // show it?
448 if(cmdline.isset("show-symbol-table"))
449 {
452 }
453
454 // show it?
455 if(
456 cmdline.isset("show-goto-functions") ||
457 cmdline.isset("list-goto-functions"))
458 {
460 goto_model, ui_message_handler, cmdline.isset("list-goto-functions"));
462 }
463
464 return perform_analysis(options);
465}
466
469{
470 if(options.get_bool_option("taint"))
471 {
472 std::string taint_file=cmdline.get_value("taint");
473
474 if(cmdline.isset("show-taint"))
475 {
478 }
479 else
480 {
481 std::string json_file=cmdline.get_value("json");
482 bool result = taint_analysis(
485 }
486 }
487
488 // If no domain is given, this lightweight version of the analysis is used.
489 if(options.get_bool_option("unreachable-instructions") &&
490 options.get_bool_option("specific-analysis"))
491 {
492 const std::string json_file=cmdline.get_value("json");
493
494 if(json_file.empty())
495 unreachable_instructions(goto_model, false, std::cout);
496 else if(json_file=="-")
497 unreachable_instructions(goto_model, true, std::cout);
498 else
499 {
500 std::ofstream ofs(json_file);
501 if(!ofs)
502 {
503 log.error() << "Failed to open json output '" << json_file << "'"
504 << messaget::eom;
506 }
507
509 }
510
512 }
513
514 if(options.get_bool_option("unreachable-functions") &&
515 options.get_bool_option("specific-analysis"))
516 {
517 const std::string json_file=cmdline.get_value("json");
518
519 if(json_file.empty())
520 unreachable_functions(goto_model, false, std::cout);
521 else if(json_file=="-")
522 unreachable_functions(goto_model, true, std::cout);
523 else
524 {
525 std::ofstream ofs(json_file);
526 if(!ofs)
527 {
528 log.error() << "Failed to open json output '" << json_file << "'"
529 << messaget::eom;
531 }
532
534 }
535
537 }
538
539 if(options.get_bool_option("reachable-functions") &&
540 options.get_bool_option("specific-analysis"))
541 {
542 const std::string json_file=cmdline.get_value("json");
543
544 if(json_file.empty())
545 reachable_functions(goto_model, false, std::cout);
546 else if(json_file=="-")
547 reachable_functions(goto_model, true, std::cout);
548 else
549 {
550 std::ofstream ofs(json_file);
551 if(!ofs)
552 {
553 log.error() << "Failed to open json output '" << json_file << "'"
554 << messaget::eom;
556 }
557
559 }
560
562 }
563
564 if(options.get_bool_option("show-local-may-alias"))
565 {
567
569 {
570 std::cout << ">>>>\n";
571 std::cout << ">>>> " << gf_entry.first << '\n';
572 std::cout << ">>>>\n";
573 local_may_aliast local_may_alias(gf_entry.second);
574 local_may_alias.output(std::cout, gf_entry.second, ns);
575 std::cout << '\n';
576 }
577
579 }
580
581 if(options.get_bool_option("show-local-bitvector"))
582 {
584
586 {
587 std::cout << ">>>>\n";
588 std::cout << ">>>> " << gf_entry.first << '\n';
589 std::cout << ">>>>\n";
590 local_bitvector_analysist local_bitvector_analysis(gf_entry.second, ns);
591 local_bitvector_analysis.output(std::cout, gf_entry.second, ns);
592 std::cout << '\n';
593 }
594
596 }
597
599
600 if(cmdline.isset("show-properties"))
601 {
604 }
605
606 if(cmdline.isset("property"))
608
609 if(options.get_bool_option("general-analysis"))
610 {
611 // Output file factory
612 const std::string outfile=options.get_option("outfile");
613
614 std::ofstream output_stream;
615 if(outfile != "-" && !outfile.empty())
616 output_stream.open(outfile);
617
618 std::ostream &out(
619 (outfile == "-" || outfile.empty()) ? std::cout : output_stream);
620
621 if(!out)
622 {
623 log.error() << "Failed to open output file '" << outfile << "'"
624 << messaget::eom;
626 }
627
628 // Build analyzer
629 log.status() << "Selecting abstract domain" << messaget::eom;
630 namespacet ns(goto_model.symbol_table); // Must live as long as the domain.
631 std::unique_ptr<ai_baset> analyzer;
632
633 try
634 {
636 }
638 {
639 log.error() << e.what() << messaget::eom;
641 }
642
643 if(analyzer == nullptr)
644 {
645 log.status() << "Task / Interpreter combination not supported"
646 << messaget::eom;
648 }
649
650 // Run
651 log.status() << "Computing abstract states" << messaget::eom;
652 (*analyzer)(goto_model);
653
654 // Perform the task
655 log.status() << "Performing task" << messaget::eom;
656
657 bool result = true;
658
659 if(options.get_bool_option("show"))
660 {
661 static_show_domain(goto_model, *analyzer, options, out);
663 }
664 else if(options.get_bool_option("show-on-source"))
665 {
668 }
669 else if(options.get_bool_option("verify"))
670 {
671 result = static_verifier(
672 goto_model, *analyzer, options, ui_message_handler, out);
673 }
674 else if(options.get_bool_option("simplify"))
675 {
676 PRECONDITION(!outfile.empty() && outfile != "-");
677 output_stream.close();
678 output_stream.open(outfile, std::ios::binary);
679 result = static_simplifier(
680 goto_model, *analyzer, options, ui_message_handler, out);
681 }
682 else if(options.get_bool_option("unreachable-instructions"))
683 {
685 *analyzer,
686 options,
687 out);
688 }
689 else if(options.get_bool_option("unreachable-functions"))
690 {
692 *analyzer,
693 options,
694 out);
695 }
696 else if(options.get_bool_option("reachable-functions"))
697 {
699 *analyzer,
700 options,
701 out);
702 }
703 else
704 {
705 log.error() << "Unhandled task" << messaget::eom;
707 }
708
709 return result ?
711 }
712
713 // Final defensive error case
714 log.error() << "no analysis option given -- consider reading --help"
715 << messaget::eom;
717}
718
720 const optionst &options)
721{
722 // Remove inline assembler; this needs to happen before
723 // adding the library.
725
726 // add the library
727 log.status() << "Adding CPROVER library (" << config.ansi_c.arch << ")"
728 << messaget::eom;
731 // library functions may introduce inline assembler
732 while(has_asm(goto_model))
733 {
738 }
739
740 // Common removal of types and complex constructs
742 return true;
743
744 return false;
745}
746
749{
750 std::cout << '\n'
751 << banner_string("GOTO-ANALYZER", CBMC_VERSION) << '\n'
752 << align_center_with_border("Copyright (C) 2017-2018") << '\n'
753 << align_center_with_border("Daniel Kroening, Diffblue") << '\n'
754 << align_center_with_border("kroening@kroening.com") << '\n';
755
756 // clang-format off
757 std::cout << help_formatter(
758 "\n"
759 "Usage: \tPurpose:\n"
760 "\n"
761 " {bgoto-analyzer} [{y-?}|{y-h}|{y--help}] \t show this help\n"
762 " {bgoto-analyzer} {ufile.c...} \t source file names\n"
763 "\n"
764 "Task options:\n"
765 " {y--show} \t display the abstract states on the goto program\n"
766 " {y--show-on-source} \t display the abstract states on the source\n"
767 " {y--verify} \t use the abstract domains to check assertions\n"
768 " {y--simplify} {ufile_name} \t use the abstract domains to simplify the"
769 " program\n"
770 " {y--no-simplify-slicing} \t do not remove instructions from which no"
771 " property can be reached (use with {y--simplify})\n"
772 " {y--unreachable-instructions} \t list dead code\n"
773 " {y--unreachable-functions} \t list functions unreachable from the entry"
774 " point\n"
775 " {y--reachable-functions} \t list functions reachable from the entry"
776 " point\n"
777 "\n"
778 "Abstract interpreter options:\n"
779 " {y--legacy-ait} \t recursion for function and one domain per location\n"
780 " {y--recursive-interprocedural} \t use recursion to handle interprocedural"
781 " reasoning\n"
782 " {y--three-way-merge} \t use VSD's three-way merge on return from function"
783 " call\n"
784 " {y--legacy-concurrent} \t legacy-ait with an extended fixed-point for"
785 " concurrency\n"
786 " {y--location-sensitive} \t use location-sensitive abstract interpreter\n"
787 "\n"
788 "History options:\n"
789 " {y--ahistorical} \t the most basic history, tracks locations only\n"
790 " {y--call-stack} {un} \t track the calling location stack for each"
791 " function limiting to at most {un} recursive loops, 0 to disable\n"
792 " {y--loop-unwind} {un} \t track the number of loop iterations within a"
793 " function limited to {un} histories per location, 0 is unlimited\n"
794 " {y--branching} {un} \t track the forwards jumps (if, switch, etc.) within"
795 " a function limited to {un} histories per location, 0 is unlimited\n"
796 " {y--loop-unwind-and-branching} {un} \t track all local control flow"
797 " limited to {un} histories per location, 0 is unlimited\n"
798 "\n"
799 "Domain options:\n"
800 " {y--constants} \t a constant for each variable if possible\n"
801 " {y--intervals} \t an interval for each variable\n"
802 " {y--non-null} \t tracks which pointers are non-null\n"
803 " {y--dependence-graph} \t data and control dependencies between"
804 " instructions\n"
805 " {y--vsd}, {y--variable-sensitivity} \t a configurable non-relational"
806 " domain\n"
807 " {y--dependence-graph-vs} \t dependencies between instructions using VSD\n"
808 "\n"
809 "Variable sensitivity domain (VSD) options:\n"
811 "\n"
812 "Storage options:\n"
813 " {y--one-domain-per-location} \t stores a domain for each location"
814 " reached\n"
815 " {y--one-domain-per-history} \t stores a domain for each history object"
816 " created\n"
817 "\n"
818 "Output options:\n"
819 " {y--text} {ufile_name} \t output results in plain text to given file\n"
820 " {y--json} {ufile_name} \t output results in JSON format to given file\n"
821 " {y--xml} {ufile_name} \t output results in XML format to given file\n"
822 " {y--dot} {ufile_name} \t output results in DOT format to given file\n"
823 "\n"
824 "Specific analyses:\n"
825 " {y--taint} {ufile_name} \t perform taint analysis using rules in given"
826 " file\n"
827 " {y--show-taint} \t print taint analysis results on stdout\n"
828 " {y--show-local-bitvector} \t perform procedure-local bitvector analysis\n"
829 " {y--show-local-may-alias} \t perform procedure-local may alias analysis\n"
830 "\n"
831 "C/C++ frontend options:\n"
834 "\n"
835 "Platform options:\n"
837 "\n"
838 "Program representations:\n"
839 " {y--show-parse-tree} \t show parse tree\n"
840 " {y--show-symbol-table} \t show loaded symbol table\n"
843 "\n"
844 "Program instrumentation options:\n"
845 " {y--property} {uid} \t enable selected properties only\n"
848 "\n"
849 "Other options:\n"
851 " {y--version} \t show version and exit\n"
853 " {y--verbosity} {u#} \t verbosity level\n"
855 "\n");
856 // clang-format on
857}
Abstract Interpretation.
void cprover_c_library_factory(const std::set< irep_idt > &functions, const symbol_table_baset &symbol_table, symbol_table_baset &dest_symbol_table, message_handlert &message_handler)
configt config
Definition config.cpp:25
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.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
std::string get_value(char option) const
Definition cmdline.cpp:48
virtual bool isset(char option) const
Definition cmdline.cpp:30
argst args
Definition cmdline.h:154
const std::list< std::string > & get_values(const std::string &option) const
Definition cmdline.cpp:119
bool set(const cmdlinet &cmdline)
Definition config.cpp:863
struct configt::ansi_ct ansi_c
void get(const std::string &executable)
virtual int doit() override
invoke main modules
virtual void get_command_line_options(optionst &options)
goto_analyzer_parse_optionst(int argc, const char **argv)
virtual bool process_goto_program(const optionst &options)
virtual int perform_analysis(const optionst &options)
Depending on the command line mode, run one of the analysis tasks.
virtual void help() override
display command line help
static void set_default_analysis_flags(optionst &options, const bool enabled)
function_mapt function_map
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.
Definition goto_model.h:105
symbol_tablet symbol_table
Symbol table.
Definition goto_model.h:31
goto_functionst goto_functions
GOTO functions.
Definition goto_model.h:34
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
std::string what() const override
A human readable description of what went wrong.
void output(std::ostream &out, const goto_functiont &goto_function, const namespacet &ns) const
void output(std::ostream &out, const goto_functiont &goto_function, const namespacet &ns) const
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.
Definition message.cpp:105
mstreamt & error() const
Definition message.h:391
@ M_STATUS
Definition message.h:169
static eomt eom
Definition message.h:289
mstreamt & status() const
Definition message.h:406
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
bool get_bool_option(const std::string &option) const
Definition options.cpp:44
void set_option(const std::string &option, const bool value)
Definition options.cpp:28
const std::string get_option(const std::string &option) const
Definition options.cpp:67
virtual void usage_error()
void log_version_and_architecture(const std::string &front_end)
Write version and system architecture to log.status().
ui_message_handlert ui_message_handler
#define HELP_CONFIG_LIBRARY
Definition config.h:79
#define HELP_CONFIG_PLATFORM
Definition config.h:102
#define HELP_CONFIG_C_CPP
Definition config.h:32
void cprover_cpp_library_factory(const std::set< irep_idt > &functions, const symbol_table_baset &symbol_table, symbol_table_baset &dest_symbol_table, message_handlert &message_handler)
static void show_goto_functions(const goto_modelt &goto_model)
Document and give macros for the exit codes of CPROVER binaries.
#define CPROVER_EXIT_INTERNAL_ERROR
An error has been encountered during processing the requested analysis.
Definition exit_codes.h:45
#define CPROVER_EXIT_VERIFICATION_SAFE
Verification successful indicates the analysis has been performed without error AND the software is s...
Definition exit_codes.h:21
#define CPROVER_EXIT_VERIFICATION_UNSAFE
Verification successful indicates the analysis has been performed without error AND the software is n...
Definition exit_codes.h:25
#define CPROVER_EXIT_USAGE_ERROR
A usage error is returned when the command line is invalid or conflicting.
Definition exit_codes.h:33
#define CPROVER_EXIT_SUCCESS
Success indicates the required analysis has been performed without error.
Definition exit_codes.h:16
void configure_gcc(const gcc_versiont &gcc_version)
Goto-Analyser Command Line Option Processing.
#define GOTO_ANALYSER_OPTIONS
#define PARSE_OPTIONS_GOTO_CHECK(cmdline, options)
#define HELP_GOTO_CHECK
Help Formatter.
static help_formattert help_formatter(const std::string &s)
goto_modelt initialize_goto_model(const std::vector< std::string > &files, message_handlert &message_handler, const optionst &options)
Initialize a Goto Program.
#define HELP_FUNCTIONS
Definition language.h:34
Field-insensitive, location-sensitive bitvector analysis.
Field-insensitive, location-sensitive may-alias analysis.
STL namespace.
Options.
std::string align_center_with_border(const std::string &text)
Utility for displaying help centered messages borderered by "* *".
std::string banner_string(const std::string &front_end, const std::string &version)
void remove_asm(goto_functionst &goto_functions, symbol_tablet &symbol_table, message_handlert &message_handler)
Replaces inline assembly instructions in the goto program (i.e., instructions of kind OTHER with a co...
bool has_asm(const goto_functionst &goto_functions)
returns true iff the given goto functions use asm instructions
Remove 'asm' statements by compiling them into suitable standard goto program instructions.
void set_properties(goto_programt &goto_program, std::unordered_set< irep_idt > &property_set)
void label_properties(goto_modelt &goto_model)
Set the properties to check.
#define HELP_SHOW_GOTO_FUNCTIONS
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
void show_properties(const namespacet &ns, const irep_idt &identifier, message_handlert &message_handler, ui_message_handlert::uit ui, const goto_programt &goto_program)
Show the properties.
#define HELP_SHOW_PROPERTIES
void show_symbol_table(const symbol_table_baset &symbol_table, ui_message_handlert &ui)
Show the symbol table.
#define PRECONDITION(CONDITION)
Definition invariant.h:463
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.
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.
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.
void exit(int status)
Definition stdlib.c:102
@ malloc_failure_mode_return_null
Definition config.h:300
@ malloc_failure_mode_none
Definition config.h:299
bool taint_analysis(goto_modelt &goto_model, const std::string &taint_file_name, message_handlert &message_handler, bool show_full, const std::optional< std::string > &json_file_name)
Taint Analysis.
#define HELP_TIMESTAMP
Definition timestamper.h:14
#define HELP_FLUSH
Definition ui_message.h:108
bool static_unreachable_functions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
bool static_unreachable_instructions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
bool static_reachable_functions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
void unreachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
static void unreachable_instructions(const goto_programt &goto_program, dead_mapt &dest)
void reachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
List all unreachable instructions.
#define HELP_VALIDATE
#define HELP_VSD
#define PARSE_OPTIONS_VSD(cmdline, options)
const char * CBMC_VERSION