CBMC
Loading...
Searching...
No Matches
cbmc_parse_options.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: CBMC Command Line Option Processing
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
12#include "cbmc_parse_options.h"
13
14#include <util/config.h>
15#include <util/exit_codes.h>
16#include <util/help_formatter.h>
17#include <util/invariant.h>
18#include <util/unicode.h>
19#include <util/version.h>
20
31
32#include <ansi-c/c_preprocess.h>
34#include <ansi-c/gcc_version.h>
37#include <cpp/cprover_library.h>
56#include <langapi/language.h>
57#include <langapi/mode.h>
59
61
62#include <cstdlib> // exit()
63#include <fstream> // IWYU pragma: keep
64#include <iostream>
65#include <memory>
66
77
79 int argc,
80 const char **argv,
81 const std::string &extra_options)
84 argc,
85 argv,
86 std::string("CBMC ") + CBMC_VERSION)
87{
90}
91
93{
94 // Default true
95 options.set_option("built-in-assertions", true);
96 options.set_option("propagation", true);
97 options.set_option("simple-slice", true);
98 options.set_option("simplify", true);
99 options.set_option("show-goto-symex-steps", false);
100 options.set_option("show-points-to-sets", false);
101 options.set_option("show-array-constraints", false);
102
103 // Other default
104 options.set_option("arrays-uf", "auto");
105 options.set_option("depth", UINT32_MAX);
106}
107
109 optionst &options,
110 const bool enabled)
111{
112 // Checks enabled by default in v6.0+.
113 options.set_option("bounds-check", enabled);
114 options.set_option("pointer-check", enabled);
115 options.set_option("pointer-primitive-check", enabled);
116 options.set_option("div-by-zero-check", enabled);
117 options.set_option("signed-overflow-check", enabled);
118 options.set_option("undefined-shift-check", enabled);
119
120 // Unwinding assertions required in certain cases for sound verification
121 // results. See https://github.com/diffblue/cbmc/issues/6561 for elaboration.
122 // As the unwinding-assertions is processed earlier, we set it only if it has
123 // not been set yet.
124 if(!options.is_set("unwinding-assertions"))
125 {
126 options.set_option("unwinding-assertions", enabled);
127 }
128
129 if(enabled)
130 {
131 config.ansi_c.malloc_may_fail = true;
132 config.ansi_c.malloc_failure_mode =
134 }
135 else
136 {
137 config.ansi_c.malloc_may_fail = false;
138 config.ansi_c.malloc_failure_mode =
140 }
141}
142
144{
145 // Enable flags that in combination provide analysis with no surprises
146 // (expected checks and no unsoundness by missing checks).
148 options, !cmdline.isset("no-standard-checks"));
149
150 if(config.set(cmdline))
151 {
152 usage_error();
154 }
155
158
159 if(cmdline.isset("function"))
160 options.set_option("function", cmdline.get_value("function"));
161
162 if(cmdline.isset("cover") && cmdline.isset("unwinding-assertions"))
163 {
164 log.error()
165 << "--cover and --unwinding-assertions must not be given together"
166 << messaget::eom;
168 }
169
170 // We want to warn the user that if we are using standard checks (that enables
171 // unwinding-assertions) and we did not disable them manually.
172 if(
173 cmdline.isset("cover") && !cmdline.isset("no-standard-checks") &&
174 !cmdline.isset("no-unwinding-assertions"))
175 {
176 log.warning() << "--cover is incompatible with --unwinding-assertions, so "
177 "unwinding-assertions will be defaulted to false"
178 << messaget::eom;
179 }
180
181 // We want to set the unwinding-assertions option as early as we can,
182 // otherwise we come across two issues: 1) there's no way to deactivate it
183 // with `--no-unwinding-assertions`, as the `--no-xxx` flags are set by
184 // `goto_check_c` which doesn't provide handling for the options, and 2) we
185 // handle it only when we use `--no-standard-checks`, but if we do so, we have
186 // already printed a couple times to the screen that `--unwinding-assertions`
187 // must be passed because of some activation/sensitive further down below.
188 if(cmdline.isset("unwinding-assertions"))
189 {
190 options.set_option("unwinding-assertions", true);
191 options.set_option("paths-symex-explore-all", true);
192 }
193 else if(cmdline.isset("no-unwinding-assertions"))
194 {
195 options.set_option("unwinding-assertions", false);
196 options.set_option("paths-symex-explore-all", false);
197 }
198
199 if(cmdline.isset("max-field-sensitivity-array-size"))
200 {
201 options.set_option(
202 "max-field-sensitivity-array-size",
203 cmdline.get_value("max-field-sensitivity-array-size"));
204 }
205
206 if(cmdline.isset("no-array-field-sensitivity"))
207 {
208 if(cmdline.isset("max-field-sensitivity-array-size"))
209 {
210 log.error()
211 << "--no-array-field-sensitivity and --max-field-sensitivity-array-size"
212 << " must not be given together" << messaget::eom;
214 }
215 options.set_option("no-array-field-sensitivity", true);
216 }
217
218 if(cmdline.isset("reachability-slice") &&
219 cmdline.isset("reachability-slice-fb"))
220 {
221 log.error()
222 << "--reachability-slice and --reachability-slice-fb must not be "
223 << "given together" << messaget::eom;
225 }
226
227 if(cmdline.isset("full-slice"))
228 options.set_option("full-slice", true);
229
230 if(cmdline.isset("show-symex-strategies"))
231 {
234 }
235
237
238 if(cmdline.isset("program-only"))
239 options.set_option("program-only", true);
240
241 if(cmdline.isset("show-byte-ops"))
242 options.set_option("show-byte-ops", true);
243
244 if(cmdline.isset("show-vcc"))
245 options.set_option("show-vcc", true);
246
247 if(cmdline.isset("cover"))
248 {
250 // The default unwinding assertions option needs to be switched off when
251 // performing coverage checks because we intend to solve for coverage rather
252 // than assertions.
253 options.set_option("unwinding-assertions", false);
254 }
255
256 if(cmdline.isset("mm"))
257 options.set_option("mm", cmdline.get_value("mm"));
258
259 if(cmdline.isset("symex-complexity-limit"))
260 {
261 options.set_option(
262 "symex-complexity-limit", cmdline.get_value("symex-complexity-limit"));
263 log.warning() << "**** WARNING: Complexity-limited analysis may yield "
264 "unsound verification results"
265 << messaget::eom;
266 }
267
268 if(cmdline.isset("symex-complexity-failed-child-loops-limit"))
269 {
270 options.set_option(
271 "symex-complexity-failed-child-loops-limit",
272 cmdline.get_value("symex-complexity-failed-child-loops-limit"));
273 if(!cmdline.isset("symex-complexity-limit"))
274 {
275 log.warning() << "**** WARNING: Complexity-limited analysis may yield "
276 "unsound verification results"
277 << messaget::eom;
278 }
279 }
280
281 if(cmdline.isset("property"))
282 options.set_option("property", cmdline.get_values("property"));
283
284 if(cmdline.isset("drop-unused-functions"))
285 options.set_option("drop-unused-functions", true);
286
287 if(cmdline.isset("string-abstraction"))
288 options.set_option("string-abstraction", true);
289
290 if(cmdline.isset("reachability-slice-fb"))
291 options.set_option("reachability-slice-fb", true);
292
293 if(cmdline.isset("reachability-slice"))
294 options.set_option("reachability-slice", true);
295
296 if(cmdline.isset("nondet-static"))
297 options.set_option("nondet-static", true);
298
299 if(cmdline.isset("no-simplify"))
300 options.set_option("simplify", false);
301
302 if(cmdline.isset("stop-on-fail") ||
303 cmdline.isset("dimacs") ||
304 cmdline.isset("outfile"))
305 options.set_option("stop-on-fail", true);
306
307 if(
308 cmdline.isset("trace") || cmdline.isset("compact-trace") ||
309 cmdline.isset("stack-trace") || cmdline.isset("stop-on-fail") ||
311 !cmdline.isset("cover")))
312 {
313 options.set_option("trace", true);
314 }
315
316 if(cmdline.isset("export-symex-ready-goto"))
317 {
318 options.set_option(
319 "export-symex-ready-goto", cmdline.get_value("export-symex-ready-goto"));
320 if(options.get_option("export-symex-ready-goto").empty())
321 {
322 log.error()
323 << "ERROR: Please provide a filename to write the goto-binary to."
324 << messaget::eom;
326 }
327 }
328
329 if(cmdline.isset("localize-faults"))
330 options.set_option("localize-faults", true);
331
332 if(cmdline.isset("unwind"))
333 {
334 options.set_option("unwind", cmdline.get_value("unwind"));
335 if(
336 !options.get_bool_option("unwinding-assertions") &&
337 !cmdline.isset("unwinding-assertions"))
338 {
339 log.warning() << "**** WARNING: Use --unwinding-assertions to obtain "
340 "sound verification results"
341 << messaget::eom;
342 }
343 }
344
345 if(cmdline.isset("depth"))
346 {
347 options.set_option("depth", cmdline.get_value("depth"));
348 log.warning()
349 << "**** WARNING: Depth-bounded analysis may yield unsound verification "
350 "results"
351 << messaget::eom;
352 }
353
354 if(cmdline.isset("slice-by-trace"))
355 {
356 log.error() << "--slice-by-trace has been removed" << messaget::eom;
358 }
359
360 if(cmdline.isset("unwindset"))
361 {
362 options.set_option(
363 "unwindset", cmdline.get_comma_separated_values("unwindset"));
364 if(
365 !options.get_bool_option("unwinding-assertions") &&
366 !cmdline.isset("unwinding-assertions"))
367 {
368 log.warning() << "**** WARNING: Use --unwinding-assertions to obtain "
369 "sound verification results"
370 << messaget::eom;
371 }
372 }
373
374 // constant propagation
375 if(cmdline.isset("no-propagation"))
376 options.set_option("propagation", false);
377
378 // transform self loops to assumptions
379 options.set_option(
380 "self-loops-to-assumptions",
381 !cmdline.isset("no-self-loops-to-assumptions"));
382
383 // all (other) checks supported by goto_check
385
386 if(cmdline.isset("partial-loops"))
387 {
388 options.set_option("partial-loops", true);
389 log.warning()
390 << "**** WARNING: --partial-loops may yield unsound verification results"
391 << messaget::eom;
392 }
393
394 // remove unused equations
395 if(cmdline.isset("slice-formula"))
396 options.set_option("slice-formula", true);
397
398 if(cmdline.isset("arrays-uf-always"))
399 options.set_option("arrays-uf", "always");
400 else if(cmdline.isset("arrays-uf-never"))
401 options.set_option("arrays-uf", "never");
402
403 if(cmdline.isset("show-array-constraints"))
404 options.set_option("show-array-constraints", true);
405
406 if(cmdline.isset("refine-strings"))
407 {
408 options.set_option("refine-strings", true);
409 options.set_option("string-printable", cmdline.isset("string-printable"));
410 }
411
412 options.set_option(
413 "symex-cache-dereferences", cmdline.isset("symex-cache-dereferences"));
414
415 if(cmdline.isset("incremental-loop"))
416 {
417 options.set_option(
418 "incremental-loop", cmdline.get_value("incremental-loop"));
419 options.set_option("refine", true);
420 options.set_option("refine-arrays", true);
421
422 if(cmdline.isset("unwind-min"))
423 options.set_option("unwind-min", cmdline.get_value("unwind-min"));
424
425 if(cmdline.isset("unwind-max"))
426 options.set_option("unwind-max", cmdline.get_value("unwind-max"));
427
428 if(cmdline.isset("ignore-properties-before-unwind-min"))
429 options.set_option("ignore-properties-before-unwind-min", true);
430
431 if(cmdline.isset("paths"))
432 {
433 log.error() << "--paths not supported with --incremental-loop"
434 << messaget::eom;
436 }
437 }
438
439 if(cmdline.isset("graphml-witness"))
440 {
441 options.set_option("graphml-witness", cmdline.get_value("graphml-witness"));
442 options.set_option("stop-on-fail", true);
443 options.set_option("trace", true);
444 }
445
446 if(cmdline.isset("symex-coverage-report"))
447 {
448 options.set_option(
449 "symex-coverage-report",
450 cmdline.get_value("symex-coverage-report"));
451 options.set_option("paths-symex-explore-all", true);
452 }
453
454 if(cmdline.isset("validate-ssa-equation"))
455 {
456 options.set_option("validate-ssa-equation", true);
457 }
458
459 if(cmdline.isset("validate-goto-model"))
460 {
461 options.set_option("validate-goto-model", true);
462 }
463
464 if(cmdline.isset("show-goto-symex-steps"))
465 options.set_option("show-goto-symex-steps", true);
466
467 if(cmdline.isset("show-points-to-sets"))
468 options.set_option("show-points-to-sets", true);
469
471
472 // Options for process_goto_program
473 options.set_option("rewrite-rw-ok", true);
474 options.set_option("rewrite-union", true);
475
476 if(cmdline.isset("smt1"))
477 {
478 log.error() << "--smt1 is no longer supported" << messaget::eom;
480 }
481
483}
484
487{
488 if(cmdline.isset("version"))
489 {
490 std::cout << CBMC_VERSION << '\n';
492 }
493
494 //
495 // command line options
496 //
497
498 optionst options;
500
503
505
506 //
507 // Unwinding of transition systems is done by hw-cbmc.
508 //
509
510 if(cmdline.isset("module") ||
511 cmdline.isset("gen-interface"))
512 {
513 log.error() << "This version of CBMC has no support for "
514 " hardware modules. Please use hw-cbmc."
515 << messaget::eom;
517 }
518
519 if(cmdline.isset("show-points-to-sets"))
520 {
521 if(!cmdline.isset("json-ui") || cmdline.isset("xml-ui"))
522 {
523 log.error() << "--show-points-to-sets supports only"
524 " json output. Use --json-ui."
525 << messaget::eom;
527 }
528 }
529
530 if(cmdline.isset("show-array-constraints"))
531 {
532 if(!cmdline.isset("json-ui") || cmdline.isset("xml-ui"))
533 {
534 log.error() << "--show-array-constraints supports only"
535 " json output. Use --json-ui."
536 << messaget::eom;
538 }
539 }
540
542
543 // configure gcc, if required
545 {
546 gcc_versiont gcc_version;
547 gcc_version.get("gcc");
548 configure_gcc(gcc_version);
549 }
550
551 if(cmdline.isset("test-preprocessor"))
555
556 if(cmdline.isset("preprocess"))
557 {
558 preprocessing(options);
560 }
561
562 if(cmdline.isset("show-parse-tree"))
563 {
564 if(
565 cmdline.args.size() != 1 ||
567 {
568 log.error() << "Please give exactly one source file" << messaget::eom;
570 }
571
572 std::string filename=cmdline.args[0];
573
574 std::ifstream infile(widen_if_needed(filename));
575
576 if(!infile)
577 {
578 log.error() << "failed to open input file '" << filename << "'"
579 << messaget::eom;
581 }
582
583 std::unique_ptr<languaget> language=
585
586 if(language==nullptr)
587 {
588 log.error() << "failed to figure out type of file '" << filename << "'"
589 << messaget::eom;
591 }
592
593 language->set_language_options(options, ui_message_handler);
594
595 log.status() << "Parsing " << filename << messaget::eom;
596
597 if(language->parse(infile, filename, ui_message_handler))
598 {
599 log.error() << "PARSING ERROR" << messaget::eom;
601 }
602
603 language->show_parse(std::cout, ui_message_handler);
605 }
606
609
612
613 if(cmdline.isset("show-claims") || // will go away
614 cmdline.isset("show-properties")) // use this one
615 {
618 }
619
620 if(set_properties())
622
623 // At this point, our goto-model should be in symex-ready-goto form (all of
624 // the transformations have been run and the program is ready to be given
625 // to the solver).
626 if(options.is_set("export-symex-ready-goto"))
627 {
629 options.get_option("export-symex-ready-goto");
630
633
634 if(!success)
635 {
636 log.error() << "ERROR: Unable to export goto-program in file "
639 }
640 else
641 {
642 log.status() << "Exported goto-program in symex-ready-goto form at "
645 }
646 }
647
648 if(
649 options.get_bool_option("program-only") ||
650 options.get_bool_option("show-vcc") ||
651 options.get_bool_option("show-byte-ops"))
652 {
653 if(options.get_bool_option("paths"))
654 {
657 (void)verifier();
658 }
659 else
660 {
663 (void)verifier();
664 }
665
667 }
668
669 if(
670 options.get_bool_option("dimacs") || !options.get_option("outfile").empty())
671 {
672 if(options.get_bool_option("paths"))
673 {
676 (void)verifier();
677 }
678 else
679 {
682 (void)verifier();
683 }
684
686 }
687
688 if(options.is_set("cover"))
689 {
692 (void)verifier();
693 verifier.report();
694
695 if(options.get_bool_option("show-test-suite"))
696 {
698 test_generator(verifier.get_traces());
699 }
700
702 }
703
704 std::unique_ptr<goto_verifiert> verifier = nullptr;
705
706 if(options.is_set("incremental-loop"))
707 {
708 if(options.get_bool_option("stop-on-fail"))
709 {
710 verifier = std::make_unique<
713 }
714 else
715 {
719 }
720 }
721 else if(
722 options.get_bool_option("stop-on-fail") && options.get_bool_option("paths"))
723 {
724 verifier =
725 std::make_unique<stop_on_fail_verifiert<single_path_symex_checkert>>(
727 }
728 else if(
729 options.get_bool_option("stop-on-fail") &&
730 !options.get_bool_option("paths"))
731 {
732 if(options.get_bool_option("localize-faults"))
733 {
734 verifier =
737 }
738 else
739 {
740 verifier =
741 std::make_unique<stop_on_fail_verifiert<multi_path_symex_checkert>>(
743 }
744 }
745 else if(
746 !options.get_bool_option("stop-on-fail") &&
747 options.get_bool_option("paths"))
748 {
749 verifier = std::make_unique<
752 }
753 else if(
754 !options.get_bool_option("stop-on-fail") &&
755 !options.get_bool_option("paths"))
756 {
757 if(options.get_bool_option("localize-faults"))
758 {
759 verifier =
762 }
763 else
764 {
765 verifier = std::make_unique<
768 }
769 }
770 else
771 {
773 }
774
775 const resultt result = (*verifier)();
776 verifier->report();
777
778 return result_to_exit_code(result);
779}
780
782{
783 if(cmdline.isset("claim")) // will go away
785
786 if(cmdline.isset("property")) // use this one
788
789 return false;
790}
791
793 goto_modelt &goto_model,
794 const optionst &options,
795 const cmdlinet &cmdline,
796 ui_message_handlert &ui_message_handler)
797{
799 if(cmdline.args.empty())
800 {
801 log.error() << "Please provide a program to verify" << messaget::eom;
803 }
804
806
808
809 if(cmdline.isset("show-symbol-table"))
810 {
813 }
814
817
818 if(cmdline.isset("validate-goto-model"))
819 {
821 }
822
823 // show it?
824 if(cmdline.isset("show-loops"))
825 {
828 }
829
830 // show it?
831 if(
832 cmdline.isset("show-goto-functions") ||
833 cmdline.isset("list-goto-functions"))
834 {
836 goto_model, ui_message_handler, cmdline.isset("list-goto-functions"));
838 }
839
841
842 return -1; // no error, continue
843}
844
846{
847 if(cmdline.args.size() != 1)
848 {
849 log.error() << "Please provide one program to preprocess" << messaget::eom;
850 return;
851 }
852
853 std::string filename = cmdline.args[0];
854
855 std::ifstream infile(filename);
856
857 if(!infile)
858 {
859 log.error() << "failed to open input file" << messaget::eom;
860 return;
861 }
862
863 std::unique_ptr<languaget> language = get_language_from_filename(filename);
864
865 if(language == nullptr)
866 {
867 log.error() << "failed to figure out type of file" << messaget::eom;
868 return;
869 }
870
871 language->set_language_options(options, ui_message_handler);
872
873 if(language->preprocess(infile, filename, std::cout, ui_message_handler))
874 log.error() << "PREPROCESSING ERROR" << messaget::eom;
875}
876
878 goto_modelt &goto_model,
879 const optionst &options,
880 messaget &log)
881{
882 // Remove inline assembler; this needs to happen before
883 // adding the library.
885
886 // add the library
887 log.status() << "Adding CPROVER library (" << config.ansi_c.arch << ")"
888 << messaget::eom;
893 // library functions may introduce inline assembler
894 while(has_asm(goto_model))
895 {
901 }
902
903 // Common removal of types and complex constructs
905 return true;
906
907 // ignore default/user-specified initialization
908 // of variables with static lifetime
909 if(options.get_bool_option("nondet-static"))
910 {
911 log.status() << "Adding nondeterministic initialization "
912 "of static/global variables"
913 << messaget::eom;
915 }
916
917 // add failed symbols
918 // needs to be done before pointer analysis
920
921 // remove skips such that trivial GOTOs are deleted and not considered
922 // for coverage annotation:
924
925 // instrument cover goals
926 if(options.is_set("cover"))
927 {
928 const auto cover_config = get_cover_config(
932 return true;
933 }
934
935 // label the assertions
936 // This must be done after adding assertions and
937 // before using the argument of the "property" option.
938 // Do not re-label after using the property slicer because
939 // this would cause the property identifiers to change.
941
942 // reachability slice?
943 if(options.get_bool_option("reachability-slice-fb"))
944 {
945 log.status() << "Performing a forwards-backwards reachability slice"
946 << messaget::eom;
947 if(options.is_set("property"))
948 {
951 options.get_list_option("property"),
952 true,
954 }
955 else
957 }
958
959 if(options.get_bool_option("reachability-slice"))
960 {
961 log.status() << "Performing a reachability slice" << messaget::eom;
962 if(options.is_set("property"))
963 {
966 options.get_list_option("property"),
968 }
969 else
971 }
972
973 // full slice?
974 if(options.get_bool_option("full-slice"))
975 {
976 log.warning() << "**** WARNING: Experimental option --full-slice, "
977 << "analysis results may be unsound. See "
978 << "https://github.com/diffblue/cbmc/issues/260"
979 << messaget::eom;
980 log.status() << "Performing a full slice" << messaget::eom;
981 if(options.is_set("property"))
984 options.get_list_option("property"),
986 else
988 }
989
990 // remove any skips introduced since coverage instrumentation
992
993 return false;
994}
995
998{
999 // clang-format off
1000 std::cout << '\n' << banner_string("CBMC", CBMC_VERSION) << '\n'
1001 << align_center_with_border("Copyright (C) 2001-2018") << '\n'
1002 << align_center_with_border("Daniel Kroening, Edmund Clarke") << '\n' // NOLINT(*)
1003 << align_center_with_border("Carnegie Mellon University, Computer Science Department") << '\n' // NOLINT(*)
1004 << align_center_with_border("kroening@kroening.com") << '\n' // NOLINT(*)
1005 << align_center_with_border("Protected in part by U.S. patent 7,225,417") << '\n'; // NOLINT(*)
1006
1007 std::cout << help_formatter(
1008 "\n"
1009 "Usage: \tPurpose:\n"
1010 "\n"
1011 " {bcbmc} [{y-?}] [{y-h}] [{y--help}] \t show this help\n"
1012 " {bcbmc} {y--version} \t show version and exit\n"
1013 " {bcbmc} [options] {ufile.c} {u...} \t perform bounded model checking\n"
1014 "\n"
1015 "Analysis options:\n"
1017 " {y--symex-coverage-report} {uf} \t generate a Cobertura XML coverage"
1018 " report in {uf}\n"
1019 " {y--property} {uid} \t only check one specific property\n"
1020 " {y--trace} \t give a counterexample trace for failed properties\n"
1021 " {y--stop-on-fail} \t stop analysis once a failed property is detected"
1022 " (implies {y--trace})\n"
1023 " {y--localize-faults} \t localize faults (experimental)\n"
1024 "\n"
1025 "C/C++ frontend options:\n"
1026 " {y--preprocess} \t stop after preprocessing\n"
1027 " {y--test-preprocessor} \t stop after preprocessing, discard output\n"
1031 "\n"
1032 "Platform options:\n"
1034 "\n"
1035 "Program representations:\n"
1036 " {y--show-parse-tree} \t show parse tree\n"
1037 " {y--show-symbol-table} \t show loaded symbol table\n"
1040 " {y--export-symex-ready-goto} {uf} \t "
1041 "serialise goto-program in symex-ready-goto form in {uf}\n"
1042 "\n"
1043 "Program instrumentation options:\n"
1046 " {y--mm} {uMM} \t memory consistency model for concurrent programs"
1047 " (default: {ysc})\n"
1050 " {y--full-slice} \t run full slicer (experimental)\n"
1051 " {y--drop-unused-functions} \t drop functions trivially unreachable from"
1052 " main function\n"
1053 "\n"
1054 "Semantic transformations:\n"
1055 " {y--nondet-static} \t add nondeterministic initialization of variables"
1056 " with static lifetime\n"
1057 "\n"
1058 "BMC options:\n"
1059 HELP_BMC
1060 "\n"
1061 "Backend options:\n"
1065 " {y--arrays-uf-never} \t never turn arrays into uninterpreted functions\n"
1066 " {y--arrays-uf-always} \t always turn arrays into uninterpreted"
1067 " functions\n"
1068 " {y--show-array-constraints} \t show array theory constraints added"
1069 " during post processing. Requires {y--json-ui}.\n"
1070 "\n"
1071 "User-interface options:\n"
1076 " {y--verbosity} {u#} \t verbosity level (default 6)\n"
1078 "\n");
1079 // clang-format on
1080}
void add_failed_symbols(symbol_table_baset &symbol_table)
Create a failed-dereference symbol for all symbols in the given table that need one (i....
Pointer Dereferencing.
Goto Verifier for Verifying all Properties.
Goto verifier for verifying all properties that stores traces and localizes faults.
Goto verifier for verifying all properties that stores traces.
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)
#define HELP_ANSI_C_LANGUAGE
configt config
Definition config.cpp:25
Bounded Model Checking Utilities.
#define HELP_BMC
Definition bmc_util.h:192
void parse_c_object_factory_options(const cmdlinet &cmdline, optionst &options)
Parse the c object factory parameters from a given command line.
bool test_c_preprocessor(message_handlert &message_handler)
Test Input Generator for C.
CBMC Command Line Option Processing.
#define CBMC_OPTIONS
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:566
Requires an incremental goto checker that is a goto_trace_providert and fault_localization_providert.
virtual int doit() override
invoke main modules
static bool process_goto_program(goto_modelt &, const optionst &, messaget &)
static void set_default_options(optionst &)
Set the options that have default values.
static int get_goto_program(goto_modelt &, const optionst &, const cmdlinet &, ui_message_handlert &)
void get_command_line_options(optionst &)
void register_languages() override
void preprocessing(const optionst &)
static void set_default_analysis_flags(optionst &, const bool enabled)
Setup default analysis flags.
virtual void help() override
display command line help
cbmc_parse_optionst(int argc, const char **argv)
std::string get_value(char option) const
Definition cmdline.cpp:48
virtual bool isset(char option) const
Definition cmdline.cpp:30
std::list< std::string > get_comma_separated_values(const char *option) const
Collect all occurrences of option option and split their values on each comma, merging them into a si...
Definition cmdline.cpp:131
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
std::string object_bits_info()
Definition config.cpp:1447
struct configt::ansi_ct ansi_c
void get(const std::string &executable)
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
Class that provides messages with a built-in verbosity 'level'.
Definition message.h:154
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:115
mstreamt & error() const
Definition message.h:401
message_handlert & get_message_handler()
Definition message.h:183
mstreamt & statistics() const
Definition message.h:421
mstreamt & warning() const
Definition message.h:406
@ M_STATUS
Definition message.h:169
static eomt eom
Definition message.h:289
mstreamt & status() const
Definition message.h:416
Performs a multi-path symbolic execution using goto-symex and calls a SAT/SMT solver to check the sta...
bool is_set(const std::string &option) const
N.B. opts.is_set("foo") does not imply opts.get_bool_option("foo")
Definition options.cpp:62
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
const value_listt & get_list_option(const std::string &option) const
Definition options.cpp:80
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
Performs a multi-path symbolic execution using goto-symex that incrementally unwinds a given loop and...
Stops when the first failing property is found and localizes the fault Requires an incremental goto c...
virtual uit get_ui() const
Definition ui_message.h:33
#define HELP_CONFIG_LIBRARY
Definition config.h:85
#define HELP_CONFIG_PLATFORM
Definition config.h:108
#define HELP_CONFIG_C_CPP
Definition config.h:32
#define HELP_CONFIG_BACKEND
Definition config.h:138
static void instrument_cover_goals(const irep_idt &function_id, goto_programt &goto_program, const cover_instrumenterst &instrumenters, const irep_idt &mode, message_handlert &message_handler, const cover_instrumenter_baset::assertion_factoryt &make_assertion)
Applies instrumenters to given goto program.
Definition cover.cpp:36
cover_configt get_cover_config(const optionst &options, const symbol_tablet &symbol_table, message_handlert &message_handler)
Build data structures controlling coverage from command-line options.
Definition cover.cpp:181
void parse_cover_options(const cmdlinet &cmdline, optionst &options)
Parses coverage-related command line options.
Definition cover.cpp:143
Coverage Instrumentation.
#define HELP_COVER
Definition cover.h:32
Goto verifier for covering goals that stores traces.
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_INCORRECT_TASK
The command line is correctly structured but cannot be carried out due to missing files,...
Definition exit_codes.h:49
#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
#define CPROVER_EXIT_SET_PROPERTIES_FAILED
Failure to identify the properties to verify.
Definition exit_codes.h:55
#define CPROVER_EXIT_PREPROCESSOR_TEST_FAILED
Failure of the test-preprocessor method.
Definition exit_codes.h:59
void property_slicer(goto_functionst &goto_functions, const namespacet &ns, const std::list< std::string > &properties, message_handlert &message_handler)
void full_slicer(goto_functionst &goto_functions, const namespacet &ns, const slicing_criteriont &criterion, message_handlert &message_handler)
void configure_gcc(const gcc_versiont &gcc_version)
#define PARSE_OPTIONS_GOTO_CHECK(cmdline, options)
#define HELP_GOTO_CHECK
#define PARSE_OPTIONS_GOTO_TRACE(cmdline, options)
Definition goto_trace.h:287
#define HELP_GOTO_TRACE
Definition goto_trace.h:279
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)
void update_max_malloc_size(goto_modelt &goto_model, message_handlert &message_handler)
Update the initial value of __CPROVER_max_malloc_size in case the number of object bits has changed.
Initialize a Goto Program.
void json_interface(cmdlinet &cmdline, message_handlert &message_handler)
Parses the JSON-formatted command line from stdin.
#define HELP_JSON_INTERFACE
Abstract interface to support a programming language.
#define HELP_FUNCTIONS
Definition language.h:34
void show_loop_ids(ui_message_handlert::uit ui, const goto_modelt &goto_model)
Definition loop_ids.cpp:21
Loop IDs.
double log(double x)
Definition math.c:2416
std::unique_ptr< languaget > get_language_from_filename(const std::string &filename)
Get the language corresponding to the registered file name extensions.
Definition mode.cpp:102
Goto Checker using Multi-Path Symbolic Execution.
Goto Checker using Multi-Path Symbolic Execution only (no SAT solving)
STL namespace.
static void nondet_static(const namespacet &ns, goto_modelt &goto_model, const irep_idt &fct_name)
Nondeterministically initializes global scope variables in a goto-function.
Nondeterministically initializes global scope variables, except for constants (such as string literal...
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 parse_path_strategy_options(const cmdlinet &cmdline, optionst &options, message_handlert &message_handler)
add paths and exploration-strategy option, suitable to be invoked from front-ends.
std::string show_path_strategies()
suitable for displaying as a front-end help message
Storage of symbolic execution paths to resume.
int result_to_exit_code(resultt result)
Properties.
resultt
The result of goto verifying.
Definition properties.h:45
void reachability_slicer(goto_modelt &goto_model, const bool include_forward_reachability, message_handlert &message_handler)
Perform reachability slicing on goto_model, with respect to the criterion given by all properties.
#define HELP_REACHABILITY_SLICER
bool is_goto_binary(const std::string &filename, message_handlert &message_handler)
Read Goto Programs.
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 remove_skip(goto_programt &goto_program, goto_programt::targett begin, goto_programt::targett end)
remove unnecessary skip statements
Program Transformation.
void label_properties(goto_modelt &goto_model)
Set the properties to check.
Show the goto functions.
#define HELP_SHOW_GOTO_FUNCTIONS
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.
Goto Checker using multi-path symbolic execution with incremental unwinding of a specified loop.
Goto Checker using Single Path Symbolic Execution.
Goto Checker using Single Path Symbolic Execution only.
void parse_solver_options(const cmdlinet &cmdline, optionst &options)
Parse solver-related command-line parameters in cmdline and set corresponding values in options.
#define HELP_SOLVER
#define UNREACHABLE
This should be used to mark dead code.
Definition invariant.h:525
void exit(int status)
Definition stdlib.c:102
Goto Verifier for stopping at the first failing property.
Goto Verifier for stopping at the first failing property and localizing the fault.
#define HELP_STRING_REFINEMENT_CBMC
@ malloc_failure_mode_return_null
Definition config.h:318
@ malloc_failure_mode_none
Definition config.h:317
#define HELP_TIMESTAMP
Definition timestamper.h:14
#define HELP_FLUSH
Definition ui_message.h:112
#define widen_if_needed(s)
Definition unicode.h:28
#define HELP_VALIDATE
const char * CBMC_VERSION
static void write_goto_binary(std::ostream &out, const symbol_table_baset &symbol_table, const goto_functionst &goto_functions, irep_serializationt &irepconverter)
Writes a goto program to disc, using goto binary format.
Write GOTO binaries.
void xml_interface(cmdlinet &cmdline, message_handlert &message_handler)
Parse XML-formatted commandline options from stdin.
#define HELP_XML_INTERFACE