CBMC
cbmc_parse_options.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: CBMC Command Line Option Processing
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #include "cbmc_parse_options.h"
13 
14 #include <cstdlib> // exit()
15 #include <fstream>
16 #include <iostream>
17 #include <memory>
18 
19 #include <util/config.h>
20 #include <util/exit_codes.h>
21 #include <util/invariant.h>
22 #include <util/make_unique.h>
23 #include <util/version.h>
24 
25 #ifdef _MSC_VER
26 # include <util/unicode.h>
27 #endif
28 
29 #include <langapi/language.h>
30 
31 #include <ansi-c/c_preprocess.h>
32 #include <ansi-c/cprover_library.h>
33 #include <ansi-c/gcc_version.h>
34 
35 #include <assembler/remove_asm.h>
36 
37 #include <cpp/cprover_library.h>
38 
42 #include <goto-checker/bmc_util.h>
52 
55 #include <goto-programs/loop_ids.h>
64 
65 #include <goto-instrument/cover.h>
69 
71 
73 
74 #include <langapi/mode.h>
75 
76 #include "c_test_input_generator.h"
77 
78 cbmc_parse_optionst::cbmc_parse_optionst(int argc, const char **argv)
81  argc,
82  argv,
83  std::string("CBMC ") + CBMC_VERSION)
84 {
87 }
88 
90  int argc,
91  const char **argv,
92  const std::string &extra_options)
94  CBMC_OPTIONS + extra_options,
95  argc,
96  argv,
97  std::string("CBMC ") + CBMC_VERSION)
98 {
101 }
102 
104 {
105  // Default true
106  options.set_option("built-in-assertions", true);
107  options.set_option("propagation", true);
108  options.set_option("simple-slice", true);
109  options.set_option("simplify", true);
110  options.set_option("show-goto-symex-steps", false);
111  options.set_option("show-points-to-sets", false);
112  options.set_option("show-array-constraints", false);
113 
114  // Other default
115  options.set_option("arrays-uf", "auto");
116  options.set_option("depth", UINT32_MAX);
117 }
118 
120 {
121  if(config.set(cmdline))
122  {
123  usage_error();
125  }
126 
129 
130  if(cmdline.isset("function"))
131  options.set_option("function", cmdline.get_value("function"));
132 
133  if(cmdline.isset("cover") && cmdline.isset("unwinding-assertions"))
134  {
135  log.error()
136  << "--cover and --unwinding-assertions must not be given together"
137  << messaget::eom;
139  }
140 
141  if(cmdline.isset("max-field-sensitivity-array-size"))
142  {
143  options.set_option(
144  "max-field-sensitivity-array-size",
145  cmdline.get_value("max-field-sensitivity-array-size"));
146  }
147 
148  if(cmdline.isset("no-array-field-sensitivity"))
149  {
150  if(cmdline.isset("max-field-sensitivity-array-size"))
151  {
152  log.error()
153  << "--no-array-field-sensitivity and --max-field-sensitivity-array-size"
154  << " must not be given together" << messaget::eom;
156  }
157  options.set_option("no-array-field-sensitivity", true);
158  }
159 
160  if(cmdline.isset("reachability-slice") &&
161  cmdline.isset("reachability-slice-fb"))
162  {
163  log.error()
164  << "--reachability-slice and --reachability-slice-fb must not be "
165  << "given together" << messaget::eom;
167  }
168 
169  if(cmdline.isset("full-slice"))
170  options.set_option("full-slice", true);
171 
172  if(cmdline.isset("show-symex-strategies"))
173  {
175  exit(CPROVER_EXIT_SUCCESS);
176  }
177 
179 
180  if(cmdline.isset("program-only"))
181  options.set_option("program-only", true);
182 
183  if(cmdline.isset("show-byte-ops"))
184  options.set_option("show-byte-ops", true);
185 
186  if(cmdline.isset("show-vcc"))
187  options.set_option("show-vcc", true);
188 
189  if(cmdline.isset("cover"))
190  parse_cover_options(cmdline, options);
191 
192  if(cmdline.isset("mm"))
193  options.set_option("mm", cmdline.get_value("mm"));
194 
195  if(cmdline.isset("symex-complexity-limit"))
196  options.set_option(
197  "symex-complexity-limit", cmdline.get_value("symex-complexity-limit"));
198 
199  if(cmdline.isset("symex-complexity-failed-child-loops-limit"))
200  options.set_option(
201  "symex-complexity-failed-child-loops-limit",
202  cmdline.get_value("symex-complexity-failed-child-loops-limit"));
203 
204  if(cmdline.isset("property"))
205  options.set_option("property", cmdline.get_values("property"));
206 
207  if(cmdline.isset("drop-unused-functions"))
208  options.set_option("drop-unused-functions", true);
209 
210  if(cmdline.isset("havoc-undefined-functions"))
211  options.set_option("havoc-undefined-functions", true);
212 
213  if(cmdline.isset("string-abstraction"))
214  options.set_option("string-abstraction", true);
215 
216  if(cmdline.isset("reachability-slice-fb"))
217  options.set_option("reachability-slice-fb", true);
218 
219  if(cmdline.isset("reachability-slice"))
220  options.set_option("reachability-slice", true);
221 
222  if(cmdline.isset("nondet-static"))
223  options.set_option("nondet-static", true);
224 
225  if(cmdline.isset("no-simplify"))
226  options.set_option("simplify", false);
227 
228  if(cmdline.isset("stop-on-fail") ||
229  cmdline.isset("dimacs") ||
230  cmdline.isset("outfile"))
231  options.set_option("stop-on-fail", true);
232 
233  if(
234  cmdline.isset("trace") || cmdline.isset("compact-trace") ||
235  cmdline.isset("stack-trace") || cmdline.isset("stop-on-fail") ||
237  !cmdline.isset("cover")))
238  {
239  options.set_option("trace", true);
240  }
241 
242  if(cmdline.isset("localize-faults"))
243  options.set_option("localize-faults", true);
244 
245  if(cmdline.isset("unwind"))
246  options.set_option("unwind", cmdline.get_value("unwind"));
247 
248  if(cmdline.isset("depth"))
249  options.set_option("depth", cmdline.get_value("depth"));
250 
251  if(cmdline.isset("slice-by-trace"))
252  {
253  log.error() << "--slice-by-trace has been removed" << messaget::eom;
255  }
256 
257  if(cmdline.isset("unwindset"))
258  {
259  options.set_option(
260  "unwindset", cmdline.get_comma_separated_values("unwindset"));
261  }
262 
263  // constant propagation
264  if(cmdline.isset("no-propagation"))
265  options.set_option("propagation", false);
266 
267  // transform self loops to assumptions
268  options.set_option(
269  "self-loops-to-assumptions",
270  !cmdline.isset("no-self-loops-to-assumptions"));
271 
272  // all checks supported by goto_check
274 
275  // generate unwinding assertions
276  if(cmdline.isset("unwinding-assertions"))
277  {
278  options.set_option("unwinding-assertions", true);
279  options.set_option("paths-symex-explore-all", true);
280  }
281 
282  if(cmdline.isset("partial-loops"))
283  options.set_option("partial-loops", true);
284 
285  // remove unused equations
286  if(cmdline.isset("slice-formula"))
287  options.set_option("slice-formula", true);
288 
289  if(cmdline.isset("arrays-uf-always"))
290  options.set_option("arrays-uf", "always");
291  else if(cmdline.isset("arrays-uf-never"))
292  options.set_option("arrays-uf", "never");
293 
294  if(cmdline.isset("show-array-constraints"))
295  options.set_option("show-array-constraints", true);
296 
297  if(cmdline.isset("refine-strings"))
298  {
299  options.set_option("refine-strings", true);
300  options.set_option("string-printable", cmdline.isset("string-printable"));
301  }
302 
303  options.set_option(
304  "symex-cache-dereferences", cmdline.isset("symex-cache-dereferences"));
305 
306  if(cmdline.isset("incremental-loop"))
307  {
308  options.set_option(
309  "incremental-loop", cmdline.get_value("incremental-loop"));
310  options.set_option("refine", true);
311  options.set_option("refine-arrays", true);
312 
313  if(cmdline.isset("unwind-min"))
314  options.set_option("unwind-min", cmdline.get_value("unwind-min"));
315 
316  if(cmdline.isset("unwind-max"))
317  options.set_option("unwind-max", cmdline.get_value("unwind-max"));
318 
319  if(cmdline.isset("ignore-properties-before-unwind-min"))
320  options.set_option("ignore-properties-before-unwind-min", true);
321 
322  if(cmdline.isset("paths"))
323  {
324  log.error() << "--paths not supported with --incremental-loop"
325  << messaget::eom;
327  }
328  }
329 
330  if(cmdline.isset("graphml-witness"))
331  {
332  options.set_option("graphml-witness", cmdline.get_value("graphml-witness"));
333  options.set_option("stop-on-fail", true);
334  options.set_option("trace", true);
335  }
336 
337  if(cmdline.isset("symex-coverage-report"))
338  {
339  options.set_option(
340  "symex-coverage-report",
341  cmdline.get_value("symex-coverage-report"));
342  options.set_option("paths-symex-explore-all", true);
343  }
344 
345  if(cmdline.isset("validate-ssa-equation"))
346  {
347  options.set_option("validate-ssa-equation", true);
348  }
349 
350  if(cmdline.isset("validate-goto-model"))
351  {
352  options.set_option("validate-goto-model", true);
353  }
354 
355  if(cmdline.isset("show-goto-symex-steps"))
356  options.set_option("show-goto-symex-steps", true);
357 
358  if(cmdline.isset("show-points-to-sets"))
359  options.set_option("show-points-to-sets", true);
360 
362 
363  // Options for process_goto_program
364  options.set_option("rewrite-union", true);
365 
366  if(cmdline.isset("smt1"))
367  {
368  log.error() << "--smt1 is no longer supported" << messaget::eom;
370  }
371 
372  parse_solver_options(cmdline, options);
373 }
374 
377 {
378  if(cmdline.isset("version"))
379  {
380  std::cout << CBMC_VERSION << '\n';
381  return CPROVER_EXIT_SUCCESS;
382  }
383 
384  //
385  // command line options
386  //
387 
388  optionst options;
389  get_command_line_options(options);
390 
393 
395 
396  //
397  // Unwinding of transition systems is done by hw-cbmc.
398  //
399 
400  if(cmdline.isset("module") ||
401  cmdline.isset("gen-interface"))
402  {
403  log.error() << "This version of CBMC has no support for "
404  " hardware modules. Please use hw-cbmc."
405  << messaget::eom;
407  }
408 
409  if(cmdline.isset("show-points-to-sets"))
410  {
411  if(!cmdline.isset("json-ui") || cmdline.isset("xml-ui"))
412  {
413  log.error() << "--show-points-to-sets supports only"
414  " json output. Use --json-ui."
415  << messaget::eom;
417  }
418  }
419 
420  if(cmdline.isset("show-array-constraints"))
421  {
422  if(!cmdline.isset("json-ui") || cmdline.isset("xml-ui"))
423  {
424  log.error() << "--show-array-constraints supports only"
425  " json output. Use --json-ui."
426  << messaget::eom;
428  }
429  }
430 
432 
433  // configure gcc, if required
435  {
436  gcc_versiont gcc_version;
437  gcc_version.get("gcc");
438  configure_gcc(gcc_version);
439  }
440 
441  if(cmdline.isset("test-preprocessor"))
445 
446  if(cmdline.isset("preprocess"))
447  {
448  preprocessing(options);
449  return CPROVER_EXIT_SUCCESS;
450  }
451 
452  if(cmdline.isset("show-parse-tree"))
453  {
454  if(
455  cmdline.args.size() != 1 ||
457  {
458  log.error() << "Please give exactly one source file" << messaget::eom;
460  }
461 
462  std::string filename=cmdline.args[0];
463 
464  #ifdef _MSC_VER
465  std::ifstream infile(widen(filename));
466  #else
467  std::ifstream infile(filename);
468  #endif
469 
470  if(!infile)
471  {
472  log.error() << "failed to open input file '" << filename << "'"
473  << messaget::eom;
475  }
476 
477  std::unique_ptr<languaget> language=
478  get_language_from_filename(filename);
479 
480  if(language==nullptr)
481  {
482  log.error() << "failed to figure out type of file '" << filename << "'"
483  << messaget::eom;
485  }
486 
487  language->set_language_options(options);
489 
490  log.status() << "Parsing " << filename << messaget::eom;
491 
492  if(language->parse(infile, filename))
493  {
494  log.error() << "PARSING ERROR" << messaget::eom;
496  }
497 
498  language->show_parse(std::cout);
499  return CPROVER_EXIT_SUCCESS;
500  }
501 
502  int get_goto_program_ret =
504 
505  if(get_goto_program_ret!=-1)
506  return get_goto_program_ret;
507 
508  if(cmdline.isset("show-claims") || // will go away
509  cmdline.isset("show-properties")) // use this one
510  {
512  return CPROVER_EXIT_SUCCESS;
513  }
514 
515  if(set_properties())
517 
518  if(
519  options.get_bool_option("program-only") ||
520  options.get_bool_option("show-vcc") ||
521  options.get_bool_option("show-byte-ops"))
522  {
523  if(options.get_bool_option("paths"))
524  {
526  options, ui_message_handler, goto_model);
527  (void)verifier();
528  }
529  else
530  {
532  options, ui_message_handler, goto_model);
533  (void)verifier();
534  }
535 
536  return CPROVER_EXIT_SUCCESS;
537  }
538 
539  if(
540  options.get_bool_option("dimacs") || !options.get_option("outfile").empty())
541  {
542  if(options.get_bool_option("paths"))
543  {
545  options, ui_message_handler, goto_model);
546  (void)verifier();
547  }
548  else
549  {
551  options, ui_message_handler, goto_model);
552  (void)verifier();
553  }
554 
555  return CPROVER_EXIT_SUCCESS;
556  }
557 
558  if(options.is_set("cover"))
559  {
561  verifier(options, ui_message_handler, goto_model);
562  (void)verifier();
563  verifier.report();
564 
565  if(options.get_bool_option("show-test-suite"))
566  {
567  c_test_input_generatort test_generator(ui_message_handler, options);
568  test_generator(verifier.get_traces());
569  }
570 
571  return CPROVER_EXIT_SUCCESS;
572  }
573 
574  std::unique_ptr<goto_verifiert> verifier = nullptr;
575 
576  if(options.is_set("incremental-loop"))
577  {
578  if(options.get_bool_option("stop-on-fail"))
579  {
580  verifier = util_make_unique<
582  options, ui_message_handler, goto_model);
583  }
584  else
585  {
588  options, ui_message_handler, goto_model);
589  }
590  }
591  else if(
592  options.get_bool_option("stop-on-fail") && options.get_bool_option("paths"))
593  {
594  verifier =
595  util_make_unique<stop_on_fail_verifiert<single_path_symex_checkert>>(
596  options, ui_message_handler, goto_model);
597  }
598  else if(
599  options.get_bool_option("stop-on-fail") &&
600  !options.get_bool_option("paths"))
601  {
602  if(options.get_bool_option("localize-faults"))
603  {
604  verifier =
607  }
608  else
609  {
610  verifier =
611  util_make_unique<stop_on_fail_verifiert<multi_path_symex_checkert>>(
612  options, ui_message_handler, goto_model);
613  }
614  }
615  else if(
616  !options.get_bool_option("stop-on-fail") &&
617  options.get_bool_option("paths"))
618  {
619  verifier = util_make_unique<
621  options, ui_message_handler, goto_model);
622  }
623  else if(
624  !options.get_bool_option("stop-on-fail") &&
625  !options.get_bool_option("paths"))
626  {
627  if(options.get_bool_option("localize-faults"))
628  {
629  verifier =
632  }
633  else
634  {
635  verifier = util_make_unique<
637  options, ui_message_handler, goto_model);
638  }
639  }
640  else
641  {
642  UNREACHABLE;
643  }
644 
645  const resultt result = (*verifier)();
646  verifier->report();
647 
648  return result_to_exit_code(result);
649 }
650 
652 {
653  if(cmdline.isset("claim")) // will go away
655 
656  if(cmdline.isset("property")) // use this one
658 
659  return false;
660 }
661 
663  goto_modelt &goto_model,
664  const optionst &options,
665  const cmdlinet &cmdline,
666  ui_message_handlert &ui_message_handler)
667 {
669  if(cmdline.args.empty())
670  {
671  log.error() << "Please provide a program to verify" << messaget::eom;
673  }
674 
676 
677  if(cmdline.isset("show-symbol-table"))
678  {
680  return CPROVER_EXIT_SUCCESS;
681  }
682 
685 
686  if(cmdline.isset("validate-goto-model"))
687  {
689  }
690 
691  // show it?
692  if(cmdline.isset("show-loops"))
693  {
695  return CPROVER_EXIT_SUCCESS;
696  }
697 
698  // show it?
699  if(
700  cmdline.isset("show-goto-functions") ||
701  cmdline.isset("list-goto-functions"))
702  {
704  goto_model, ui_message_handler, cmdline.isset("list-goto-functions"));
705  return CPROVER_EXIT_SUCCESS;
706  }
707 
709 
710  return -1; // no error, continue
711 }
712 
714 {
715  if(cmdline.args.size() != 1)
716  {
717  log.error() << "Please provide one program to preprocess" << messaget::eom;
718  return;
719  }
720 
721  std::string filename = cmdline.args[0];
722 
723  std::ifstream infile(filename);
724 
725  if(!infile)
726  {
727  log.error() << "failed to open input file" << messaget::eom;
728  return;
729  }
730 
731  std::unique_ptr<languaget> language = get_language_from_filename(filename);
732  language->set_language_options(options);
733 
734  if(language == nullptr)
735  {
736  log.error() << "failed to figure out type of file" << messaget::eom;
737  return;
738  }
739 
741 
742  if(language->preprocess(infile, filename, std::cout))
743  log.error() << "PREPROCESSING ERROR" << messaget::eom;
744 }
745 
747  goto_modelt &goto_model,
748  const optionst &options,
749  messaget &log)
750 {
751  // Remove inline assembler; this needs to happen before
752  // adding the library.
754 
755  // add the library
756  log.status() << "Adding CPROVER library (" << config.ansi_c.arch << ")"
757  << messaget::eom;
762 
763  // Common removal of types and complex constructs
764  if(::process_goto_program(goto_model, options, log))
765  return true;
766 
767  // ignore default/user-specified initialization
768  // of variables with static lifetime
769  if(options.get_bool_option("nondet-static"))
770  {
771  log.status() << "Adding nondeterministic initialization "
772  "of static/global variables"
773  << messaget::eom;
775  }
776 
777  // add failed symbols
778  // needs to be done before pointer analysis
780 
781  if(options.get_bool_option("drop-unused-functions"))
782  {
783  // Entry point will have been set before and function pointers removed
784  log.status() << "Removing unused functions" << messaget::eom;
786  }
787 
788  // remove skips such that trivial GOTOs are deleted and not considered
789  // for coverage annotation:
791 
792  // instrument cover goals
793  if(options.is_set("cover"))
794  {
795  const auto cover_config = get_cover_config(
798  cover_config, goto_model, log.get_message_handler()))
799  return true;
800  }
801 
802  // label the assertions
803  // This must be done after adding assertions and
804  // before using the argument of the "property" option.
805  // Do not re-label after using the property slicer because
806  // this would cause the property identifiers to change.
808 
809  // reachability slice?
810  if(options.get_bool_option("reachability-slice-fb"))
811  {
812  log.status() << "Performing a forwards-backwards reachability slice"
813  << messaget::eom;
814  if(options.is_set("property"))
815  {
817  goto_model,
818  options.get_list_option("property"),
819  true,
821  }
822  else
824  }
825 
826  if(options.get_bool_option("reachability-slice"))
827  {
828  log.status() << "Performing a reachability slice" << messaget::eom;
829  if(options.is_set("property"))
830  {
832  goto_model,
833  options.get_list_option("property"),
835  }
836  else
838  }
839 
840  // full slice?
841  if(options.get_bool_option("full-slice"))
842  {
843  log.status() << "Performing a full slice" << messaget::eom;
844  if(options.is_set("property"))
845  property_slicer(goto_model, options.get_list_option("property"));
846  else
848  }
849 
850  // remove any skips introduced since coverage instrumentation
852 
853  return false;
854 }
855 
858 {
859  // clang-format off
860  std::cout << '\n' << banner_string("CBMC", CBMC_VERSION) << '\n'
861  << align_center_with_border("Copyright (C) 2001-2018") << '\n'
862  << align_center_with_border("Daniel Kroening, Edmund Clarke") << '\n' // NOLINT(*)
863  << align_center_with_border("Carnegie Mellon University, Computer Science Department") << '\n' // NOLINT(*)
864  << align_center_with_border("kroening@kroening.com") << '\n' // NOLINT(*)
865  << align_center_with_border("Protected in part by U.S. patent 7,225,417") << '\n' // NOLINT(*)
866  <<
867  "\n"
868  "Usage: Purpose:\n"
869  "\n"
870  " cbmc [-?] [-h] [--help] show help\n"
871  " cbmc --version show version and exit\n"
872  " cbmc [options] file.c ... perform bounded model checking\n"
873  "\n"
874  "Analysis options:\n"
876  " --symex-coverage-report f generate a Cobertura XML coverage report in f\n" // NOLINT(*)
877  " --property id only check one specific property\n"
878  " --trace give a counterexample trace for failed properties\n" //NOLINT(*)
879  " --stop-on-fail stop analysis once a failed property is detected\n" // NOLINT(*)
880  " (implies --trace)\n"
881  " --localize-faults localize faults (experimental)\n"
882  "\n"
883  "C/C++ frontend options:\n"
884  " --preprocess stop after preprocessing\n"
885  " --test-preprocessor stop after preprocessing, discard output\n"
889  "\n"
890  "Platform options:\n"
892  "\n"
893  "Program representations:\n"
894  " --show-parse-tree show parse tree\n"
895  " --show-symbol-table show loaded symbol table\n"
898  "\n"
899  "Program instrumentation options:\n"
901  HELP_COVER
902  " --mm MM memory consistency model for concurrent programs (default: sc)\n" // NOLINT(*)
906  " --full-slice run full slicer (experimental)\n" // NOLINT(*)
907  " --drop-unused-functions drop functions trivially unreachable from main function\n" // NOLINT(*)
908  " --havoc-undefined-functions\n"
909  " for any function that has no body, assign non-deterministic values to\n" // NOLINT(*)
910  " any parameters passed as non-const pointers and the return value\n" // NOLINT(*)
911  "\n"
912  "Semantic transformations:\n"
913  // NOLINTNEXTLINE(whitespace/line_length)
914  " --nondet-static add nondeterministic initialization of variables with static lifetime\n"
915  "\n"
916  "BMC options:\n"
917  HELP_BMC
918  "\n"
919  "Backend options:\n"
923  " --arrays-uf-never never turn arrays into uninterpreted functions\n" // NOLINT(*)
924  " --arrays-uf-always always turn arrays into uninterpreted functions\n" // NOLINT(*)
925  " --show-array-constraints show array theory constraints added\n"
926  " during post processing.\n"
927  " Requires --json-ui.\n"
928  "\n"
929  "User-interface options:\n"
933  HELP_FLUSH
934  " --verbosity # verbosity level\n"
936  "\n";
937  // clang-format on
938 }
messaget
Class that provides messages with a built-in verbosity 'level'.
Definition: message.h:154
cprover_library.h
cmdlinet::args
argst args
Definition: cmdline.h:145
cbmc_parse_optionst::doit
virtual int doit() override
invoke main modules
Definition: cbmc_parse_options.cpp:376
UNREACHABLE
#define UNREACHABLE
This should be used to mark dead code.
Definition: invariant.h:503
cover.h
HELP_REACHABILITY_SLICER
#define HELP_REACHABILITY_SLICER
Definition: reachability_slicer.h:48
HELP_BMC
#define HELP_BMC
Definition: bmc_util.h:200
HELP_SHOW_GOTO_FUNCTIONS
#define HELP_SHOW_GOTO_FUNCTIONS
Definition: show_goto_functions.h:25
HELP_GOTO_CHECK
#define HELP_GOTO_CHECK
Definition: goto_check_c.h:53
languaget::show_parse
virtual void show_parse(std::ostream &out)=0
configt::object_bits_info
std::string object_bits_info()
Definition: config.cpp:1339
gcc_versiont::get
void get(const std::string &executable)
Definition: gcc_version.cpp:18
HELP_GOTO_TRACE
#define HELP_GOTO_TRACE
Definition: goto_trace.h:277
parse_options_baset::ui_message_handler
ui_message_handlert ui_message_handler
Definition: parse_options.h:45
cbmc_parse_optionst::goto_model
goto_modelt goto_model
Definition: cbmc_parse_options.h:102
cbmc_parse_optionst::get_goto_program
static int get_goto_program(goto_modelt &, const optionst &, const cmdlinet &, ui_message_handlert &)
Definition: cbmc_parse_options.cpp:662
parse_options_baset
Definition: parse_options.h:19
single_loop_incremental_symex_checkert
Performs a multi-path symbolic execution using goto-symex that incrementally unwinds a given loop and...
Definition: single_loop_incremental_symex_checker.h:31
ui_message_handlert
Definition: ui_message.h:21
parse_c_object_factory_options
void parse_c_object_factory_options(const cmdlinet &cmdline, optionst &options)
Parse the c object factory parameters from a given command line.
Definition: c_object_factory_parameters.cpp:11
resultt
resultt
The result of goto verifying.
Definition: properties.h:44
cmdlinet::isset
virtual bool isset(char option) const
Definition: cmdline.cpp:30
stop_on_fail_verifiert
Stops when the first failing property is found.
Definition: stop_on_fail_verifier.h:22
nondet_static
static void nondet_static(const namespacet &ns, goto_functionst &goto_functions, const irep_idt &fct_name)
Nondeterministically initializes global scope variables in a goto-function.
Definition: nondet_static.cpp:80
optionst
Definition: options.h:22
parse_solver_options
void parse_solver_options(const cmdlinet &cmdline, optionst &options)
Parse solver-related command-line parameters in cmdline and set corresponding values in options.
Definition: solver_factory.cpp:537
gcc_version.h
all_properties_verifiert
Definition: all_properties_verifier.h:22
optionst::get_option
const std::string get_option(const std::string &option) const
Definition: options.cpp:67
messaget::M_STATISTICS
@ M_STATISTICS
Definition: message.h:171
messaget::status
mstreamt & status() const
Definition: message.h:414
multi_path_symex_only_checker.h
show_properties
void show_properties(const namespacet &ns, const irep_idt &identifier, message_handlert &message_handler, ui_message_handlert::uit ui, const goto_programt &goto_program)
Definition: show_properties.cpp:44
HELP_FUNCTIONS
#define HELP_FUNCTIONS
Definition: rebuild_goto_start_function.h:27
remove_skip
void remove_skip(goto_programt &goto_program, goto_programt::targett begin, goto_programt::targett end)
remove unnecessary skip statements
Definition: remove_skip.cpp:87
cover_goals_verifier_with_trace_storaget::get_traces
const goto_trace_storaget & get_traces() const
Definition: cover_goals_verifier_with_trace_storage.h:64
HELP_CONFIG_PLATFORM
#define HELP_CONFIG_PLATFORM
Definition: config.h:84
invariant.h
remove_asm.h
configure_gcc
void configure_gcc(const gcc_versiont &gcc_version)
Definition: gcc_version.cpp:147
c_preprocess.h
goto_modelt
Definition: goto_model.h:25
show_goto_functions.h
mode.h
show_loop_ids
void show_loop_ids(ui_message_handlert::uit ui, const goto_modelt &goto_model)
Definition: loop_ids.cpp:21
all_properties_verifier.h
HELP_COVER
#define HELP_COVER
Definition: cover.h:32
optionst::set_option
void set_option(const std::string &option, const bool value)
Definition: options.cpp:28
parse_options_baset::log_version_and_architecture
void log_version_and_architecture(const std::string &front_end)
Write version and system architecture to log.status().
Definition: parse_options.cpp:152
messaget::eom
static eomt eom
Definition: message.h:297
instrument_cover_goals
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:37
show_symbol_table
void show_symbol_table(const symbol_tablet &symbol_table, ui_message_handlert &ui)
Definition: show_symbol_table.cpp:242
configt::ansi_c
struct configt::ansi_ct ansi_c
version.h
remove_unused_functions
void remove_unused_functions(goto_modelt &goto_model, message_handlert &message_handler)
Definition: remove_unused_functions.cpp:18
cbmc_parse_optionst::cbmc_parse_optionst
cbmc_parse_optionst(int argc, const char **argv)
Definition: cbmc_parse_options.cpp:78
nondet_static.h
HELP_REACHABILITY_SLICER_FB
#define HELP_REACHABILITY_SLICER_FB
Definition: reachability_slicer.h:55
stop_on_fail_verifier_with_fault_localization.h
label_properties
void label_properties(goto_modelt &goto_model)
Definition: set_properties.cpp:45
path_storage.h
Storage of symbolic execution paths to resume.
languaget::set_language_options
virtual void set_language_options(const optionst &)
Set language-specific options.
Definition: language.h:41
cmdlinet::get_comma_separated_values
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:121
parse_path_strategy_options
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.
Definition: path_storage.cpp:137
HELP_JSON_INTERFACE
#define HELP_JSON_INTERFACE
Definition: json_interface.h:45
ui_message_handlert::get_ui
virtual uit get_ui() const
Definition: ui_message.h:33
parse_options_baset::usage_error
virtual void usage_error()
Definition: parse_options.cpp:49
util_make_unique
std::unique_ptr< T > util_make_unique(Ts &&... ts)
Definition: make_unique.h:19
bmc_util.h
set_properties.h
get_cover_config
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:186
full_slicer
void full_slicer(goto_functionst &goto_functions, const namespacet &ns, const slicing_criteriont &criterion)
Definition: full_slicer.cpp:348
c_test_input_generator.h
get_language_from_filename
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
cmdlinet
Definition: cmdline.h:20
CBMC_VERSION
const char * CBMC_VERSION
cover_goals_verifier_with_trace_storage.h
HELP_CONFIG_C_CPP
#define HELP_CONFIG_C_CPP
Definition: config.h:33
make_unique.h
messaget::error
mstreamt & error() const
Definition: message.h:399
cover_goals_verifier_with_trace_storaget
Definition: cover_goals_verifier_with_trace_storage.h:24
multi_path_symex_checkert
Performs a multi-path symbolic execution using goto-symex and calls a SAT/SMT solver to check the sta...
Definition: multi_path_symex_checker.h:25
all_properties_verifier_with_trace_storage.h
initialize_goto_model.h
banner_string
std::string banner_string(const std::string &front_end, const std::string &version)
Definition: parse_options.cpp:174
c_test_input_generatort
Definition: c_test_input_generator.h:50
cbmc_parse_options.h
cbmc_parse_optionst::get_command_line_options
void get_command_line_options(optionst &)
Definition: cbmc_parse_options.cpp:119
configt::ansi_ct::preprocessor
preprocessort preprocessor
Definition: config.h:248
optionst::is_set
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
property_slicer
void property_slicer(goto_functionst &goto_functions, const namespacet &ns, const std::list< std::string > &properties)
Definition: full_slicer.cpp:371
show_properties.h
multi_path_symex_checker.h
cmdlinet::get_value
std::string get_value(char option) const
Definition: cmdline.cpp:48
show_symbol_table.h
languaget::parse
virtual bool parse(std::istream &instream, const std::string &path)=0
CPROVER_EXIT_PREPROCESSOR_TEST_FAILED
#define CPROVER_EXIT_PREPROCESSOR_TEST_FAILED
Failure of the test-preprocessor method.
Definition: exit_codes.h:59
language.h
messaget::set_message_handler
virtual void set_message_handler(message_handlert &_message_handler)
Definition: message.h:179
HELP_SHOW_PROPERTIES
#define HELP_SHOW_PROPERTIES
Definition: show_properties.h:30
all_properties_verifier_with_trace_storaget
Definition: all_properties_verifier_with_trace_storage.h:24
cbmc_parse_optionst::process_goto_program
static bool process_goto_program(goto_modelt &, const optionst &, messaget &)
Definition: cbmc_parse_options.cpp:746
single_path_symex_checker.h
CPROVER_EXIT_SET_PROPERTIES_FAILED
#define CPROVER_EXIT_SET_PROPERTIES_FAILED
Failure to identify the properties to verify.
Definition: exit_codes.h:55
xml_interface
void xml_interface(cmdlinet &cmdline, message_handlert &message_handler)
Parse XML-formatted commandline options from stdin.
Definition: xml_interface.cpp:47
configt::ansi_ct::arch
irep_idt arch
Definition: config.h:206
show_goto_functions
void show_goto_functions(const namespacet &ns, ui_message_handlert &ui_message_handler, const goto_functionst &goto_functions, bool list_only)
Definition: show_goto_functions.cpp:20
PARSE_OPTIONS_GOTO_CHECK
#define PARSE_OPTIONS_GOTO_CHECK(cmdline, options)
Definition: goto_check_c.h:74
HELP_CONFIG_LIBRARY
#define HELP_CONFIG_LIBRARY
Definition: config.h:64
json_interface
void json_interface(cmdlinet &cmdline, message_handlert &message_handler)
Parses the JSON-formatted command line from stdin.
Definition: json_interface.cpp:88
parse_cover_options
void parse_cover_options(const cmdlinet &cmdline, optionst &options)
Parses coverage-related command line options.
Definition: cover.cpp:148
cbmc_parse_optionst::set_properties
bool set_properties()
Definition: cbmc_parse_options.cpp:651
HELP_SOLVER
#define HELP_SOLVER
Definition: solver_factory.h:119
HELP_STRING_REFINEMENT_CBMC
#define HELP_STRING_REFINEMENT_CBMC
Definition: string_refinement.h:57
widen
std::wstring widen(const char *s)
Definition: unicode.cpp:48
read_goto_binary.h
all_properties_verifier_with_fault_localization.h
CPROVER_EXIT_INCORRECT_TASK
#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
full_slicer.h
configt::ansi_ct::preprocessort::GCC
@ GCC
HELP_ANSI_C_LANGUAGE
#define HELP_ANSI_C_LANGUAGE
Definition: ansi_c_language.h:27
goto_verifiert::report
virtual void report()=0
Report results.
remove_unused_functions.h
config
configt config
Definition: config.cpp:25
gcc_versiont
Definition: gcc_version.h:19
parse_options_baset::log
messaget log
Definition: parse_options.h:46
messaget::get_message_handler
message_handlert & get_message_handler()
Definition: message.h:184
result_to_exit_code
int result_to_exit_code(resultt result)
Definition: properties.cpp:147
ui_message_handlert::uit::PLAIN
@ PLAIN
stop_on_fail_verifier.h
cprover_c_library_factory
void cprover_c_library_factory(const std::set< irep_idt > &functions, symbol_tablet &symbol_table, message_handlert &message_handler)
Definition: cprover_library.cpp:98
configt::set
bool set(const cmdlinet &cmdline)
Definition: config.cpp:798
exit_codes.h
optionst::get_bool_option
bool get_bool_option(const std::string &option) const
Definition: options.cpp:44
CPROVER_EXIT_USAGE_ERROR
#define CPROVER_EXIT_USAGE_ERROR
A usage error is returned when the command line is invalid or conflicting.
Definition: exit_codes.h:33
cbmc_parse_optionst::help
virtual void help() override
display command line help
Definition: cbmc_parse_options.cpp:857
remove_asm
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...
Definition: remove_asm.cpp:512
unicode.h
is_goto_binary
bool is_goto_binary(const std::string &filename, message_handlert &message_handler)
Definition: read_goto_binary.cpp:192
show_path_strategies
std::string show_path_strategies()
suitable for displaying as a front-end help message
Definition: path_storage.cpp:111
config.h
goto_modelt::validate
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:98
languaget::preprocess
virtual bool preprocess(std::istream &instream, const std::string &path, std::ostream &outstream)
Definition: language.h:47
loop_ids.h
reachability_slicer.h
PARSE_OPTIONS_GOTO_TRACE
#define PARSE_OPTIONS_GOTO_TRACE(cmdline, options)
Definition: goto_trace.h:285
HELP_CONFIG_BACKEND
#define HELP_CONFIG_BACKEND
Definition: config.h:111
single_loop_incremental_symex_checker.h
stop_on_fail_verifier_with_fault_localizationt
Stops when the first failing property is found and localizes the fault Requires an incremental goto c...
Definition: stop_on_fail_verifier_with_fault_localization.h:25
add_failed_symbols.h
CPROVER_EXIT_INTERNAL_ERROR
#define CPROVER_EXIT_INTERNAL_ERROR
An error has been encountered during processing the requested analysis.
Definition: exit_codes.h:45
properties.h
initialize_goto_model
goto_modelt initialize_goto_model(const std::vector< std::string > &files, message_handlert &message_handler, const optionst &options)
Definition: initialize_goto_model.cpp:178
add_failed_symbols
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....
Definition: add_failed_symbols.cpp:78
CPROVER_EXIT_SUCCESS
#define CPROVER_EXIT_SUCCESS
Success indicates the required analysis has been performed without error.
Definition: exit_codes.h:16
cbmc_parse_optionst::register_languages
void register_languages() override
Definition: cbmc_languages.cpp:25
messaget::eval_verbosity
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
remove_skip.h
cbmc_parse_optionst::set_default_options
static void set_default_options(optionst &)
Set the options that have default values.
Definition: cbmc_parse_options.cpp:103
all_properties_verifier_with_fault_localizationt
Requires an incremental goto checker that is a goto_trace_providert and fault_localization_providert.
Definition: all_properties_verifier_with_fault_localization.h:27
cmdlinet::get_values
const std::list< std::string > & get_values(const std::string &option) const
Definition: cmdline.cpp:109
cover_goals_verifier_with_trace_storaget::report
void report() override
Report results.
Definition: cover_goals_verifier_with_trace_storage.h:59
parse_options_baset::cmdline
cmdlinet cmdline
Definition: parse_options.h:28
goto_modelt::symbol_table
symbol_tablet symbol_table
Symbol table.
Definition: goto_model.h:30
single_path_symex_only_checker.h
align_center_with_border
std::string align_center_with_border(const std::string &text)
Utility for displaying help centered messages borderered by "* *".
Definition: parse_options.cpp:161
optionst::get_list_option
const value_listt & get_list_option(const std::string &option) const
Definition: options.cpp:80
cprover_library.h
HELP_XML_INTERFACE
#define HELP_XML_INTERFACE
Definition: xml_interface.h:39
process_goto_program.h
HELP_TIMESTAMP
#define HELP_TIMESTAMP
Definition: timestamper.h:14
HELP_FLUSH
#define HELP_FLUSH
Definition: ui_message.h:108
CBMC_OPTIONS
#define CBMC_OPTIONS
Definition: cbmc_parse_options.h:35
reachability_slicer
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.
Definition: reachability_slicer.cpp:397
cbmc_parse_optionst::preprocessing
void preprocessing(const optionst &)
Definition: cbmc_parse_options.cpp:713
cprover_cpp_library_factory
void cprover_cpp_library_factory(const std::set< irep_idt > &functions, symbol_tablet &symbol_table, message_handlert &message_handler)
Definition: cprover_library.cpp:38
test_c_preprocessor
bool test_c_preprocessor(message_handlert &message_handler)
Definition: c_preprocess.cpp:758
HELP_VALIDATE
#define HELP_VALIDATE
Definition: validation_interface.h:16