CBMC
goto_analyzer_parse_options.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Goto-Analyzer Command Line Option Processing
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
13 
14 #include <util/config.h>
15 #include <util/exception_utils.h>
16 #include <util/exit_codes.h>
17 #include <util/options.h>
18 #include <util/version.h>
19 
27 
28 #include <analyses/ai.h>
30 #include <ansi-c/cprover_library.h>
31 #include <ansi-c/gcc_version.h>
32 #include <assembler/remove_asm.h>
33 #include <cpp/cprover_library.h>
34 
35 #include "build_analyzer.h"
36 #include "show_on_source.h"
37 #include "static_show_domain.h"
38 #include "static_simplifier.h"
39 #include "static_verifier.h"
40 #include "taint_analysis.h"
42 
43 #include <cstdlib> // exit()
44 #include <fstream>
45 #include <iostream>
46 #include <memory>
47 
49  int argc,
50  const char **argv)
53  argc,
54  argv,
55  std::string("GOTO-ANALYZER "))
56 {
57 }
58 
60 {
61  if(config.set(cmdline))
62  {
63  usage_error();
65  }
66 
67  if(cmdline.isset("function"))
68  options.set_option("function", cmdline.get_value("function"));
69 
70  // all checks supported by goto_check
72 
73  // The user should either select:
74  // 1. a specific analysis, or
75  // 2. a tuple of task / analyser options / outputs
76 
77  // Select a specific analysis
78  if(cmdline.isset("taint"))
79  {
80  options.set_option("taint", true);
81  options.set_option("specific-analysis", true);
82  }
83  // For backwards compatibility,
84  // these are first recognised as specific analyses
85  bool reachability_task = false;
86  if(cmdline.isset("unreachable-instructions"))
87  {
88  options.set_option("unreachable-instructions", true);
89  options.set_option("specific-analysis", true);
90  reachability_task = true;
91  }
92  if(cmdline.isset("unreachable-functions"))
93  {
94  options.set_option("unreachable-functions", true);
95  options.set_option("specific-analysis", true);
96  reachability_task = true;
97  }
98  if(cmdline.isset("reachable-functions"))
99  {
100  options.set_option("reachable-functions", true);
101  options.set_option("specific-analysis", true);
102  reachability_task = true;
103  }
104  if(cmdline.isset("show-local-may-alias"))
105  {
106  options.set_option("show-local-may-alias", true);
107  options.set_option("specific-analysis", true);
108  }
109 
110  // Output format choice
111  if(cmdline.isset("text"))
112  {
113  options.set_option("text", true);
114  options.set_option("outfile", cmdline.get_value("text"));
115  }
116  else if(cmdline.isset("json"))
117  {
118  options.set_option("json", true);
119  options.set_option("outfile", cmdline.get_value("json"));
120  }
121  else if(cmdline.isset("xml"))
122  {
123  options.set_option("xml", true);
124  options.set_option("outfile", cmdline.get_value("xml"));
125  }
126  else if(cmdline.isset("dot"))
127  {
128  options.set_option("dot", true);
129  options.set_option("outfile", cmdline.get_value("dot"));
130  }
131 
132  // Task options
133  if(cmdline.isset("show"))
134  {
135  options.set_option("show", true);
136  options.set_option("general-analysis", true);
137  }
138  else if(cmdline.isset("show-on-source"))
139  {
140  options.set_option("show-on-source", true);
141  options.set_option("general-analysis", true);
142  }
143  else if(cmdline.isset("verify"))
144  {
145  options.set_option("verify", true);
146  options.set_option("general-analysis", true);
147  }
148  else if(cmdline.isset("simplify"))
149  {
150  if(cmdline.get_value("simplify") == "-")
152  "cannot output goto binary to stdout", "--simplify");
153 
154  options.set_option("simplify", true);
155  options.set_option("outfile", cmdline.get_value("simplify"));
156  options.set_option("general-analysis", true);
157 
158  // For development allow slicing to be disabled in the simplify task
159  options.set_option(
160  "simplify-slicing",
161  !(cmdline.isset("no-simplify-slicing")));
162  }
163  else if(cmdline.isset("show-intervals"))
164  {
165  // For backwards compatibility
166  options.set_option("show", true);
167  options.set_option("general-analysis", true);
168  options.set_option("intervals", true);
169  options.set_option("domain set", true);
170  }
171  else if(cmdline.isset("show-non-null"))
172  {
173  // For backwards compatibility
174  options.set_option("show", true);
175  options.set_option("general-analysis", true);
176  options.set_option("non-null", true);
177  options.set_option("domain set", true);
178  }
179  else if(cmdline.isset("intervals") || cmdline.isset("non-null"))
180  {
181  // Partial backwards compatability, just giving these domains without
182  // a task will work. However it will use the general default of verify
183  // rather than their historical default of show.
184  options.set_option("verify", true);
185  options.set_option("general-analysis", true);
186  }
187 
188  if(options.get_bool_option("general-analysis") || reachability_task)
189  {
190  // Abstract interpreter choice
191  if(cmdline.isset("recursive-interprocedural"))
192  options.set_option("recursive-interprocedural", true);
193  else if(cmdline.isset("three-way-merge"))
194  options.set_option("three-way-merge", true);
195  else if(cmdline.isset("legacy-ait") || cmdline.isset("location-sensitive"))
196  {
197  options.set_option("legacy-ait", true);
198  // Fixes a number of other options as well
199  options.set_option("ahistorical", true);
200  options.set_option("history set", true);
201  options.set_option("one-domain-per-location", true);
202  options.set_option("storage set", true);
203  }
204  else if(cmdline.isset("legacy-concurrent") || cmdline.isset("concurrent"))
205  {
206  options.set_option("legacy-concurrent", true);
207  options.set_option("ahistorical", true);
208  options.set_option("history set", true);
209  options.set_option("one-domain-per-location", true);
210  options.set_option("storage set", true);
211  }
212  else
213  {
214  // Silently default to legacy-ait for backwards compatability
215  options.set_option("legacy-ait", true);
216  // Fixes a number of other options as well
217  options.set_option("ahistorical", true);
218  options.set_option("history set", true);
219  options.set_option("one-domain-per-location", true);
220  options.set_option("storage set", true);
221  }
222 
223  // History choice
224  if(cmdline.isset("ahistorical"))
225  {
226  options.set_option("ahistorical", true);
227  options.set_option("history set", true);
228  }
229  else if(cmdline.isset("call-stack"))
230  {
231  options.set_option("call-stack", true);
232  options.set_option(
233  "call-stack-recursion-limit", cmdline.get_value("call-stack"));
234  options.set_option("history set", true);
235  }
236  else if(cmdline.isset("loop-unwind"))
237  {
238  options.set_option("local-control-flow-history", true);
239  options.set_option("local-control-flow-history-forward", false);
240  options.set_option("local-control-flow-history-backward", true);
241  options.set_option(
242  "local-control-flow-history-limit", cmdline.get_value("loop-unwind"));
243  options.set_option("history set", true);
244  }
245  else if(cmdline.isset("branching"))
246  {
247  options.set_option("local-control-flow-history", true);
248  options.set_option("local-control-flow-history-forward", true);
249  options.set_option("local-control-flow-history-backward", false);
250  options.set_option(
251  "local-control-flow-history-limit", cmdline.get_value("branching"));
252  options.set_option("history set", true);
253  }
254  else if(cmdline.isset("loop-unwind-and-branching"))
255  {
256  options.set_option("local-control-flow-history", true);
257  options.set_option("local-control-flow-history-forward", true);
258  options.set_option("local-control-flow-history-backward", true);
259  options.set_option(
260  "local-control-flow-history-limit",
261  cmdline.get_value("loop-unwind-and-branching"));
262  options.set_option("history set", true);
263  }
264 
265  if(!options.get_bool_option("history set"))
266  {
267  // Default to ahistorical as it is the expected for of analysis
268  log.status() << "History not specified, defaulting to --ahistorical"
269  << messaget::eom;
270  options.set_option("ahistorical", true);
271  options.set_option("history set", true);
272  }
273 
274  // Domain choice
275  if(cmdline.isset("constants"))
276  {
277  options.set_option("constants", true);
278  options.set_option("domain set", true);
279  }
280  else if(cmdline.isset("dependence-graph"))
281  {
282  options.set_option("dependence-graph", true);
283  options.set_option("domain set", true);
284  }
285  else if(cmdline.isset("intervals"))
286  {
287  options.set_option("intervals", true);
288  options.set_option("domain set", true);
289  }
290  else if(cmdline.isset("non-null"))
291  {
292  options.set_option("non-null", true);
293  options.set_option("domain set", true);
294  }
295  else if(cmdline.isset("vsd") || cmdline.isset("variable-sensitivity"))
296  {
297  options.set_option("vsd", true);
298  options.set_option("domain set", true);
299 
300  PARSE_OPTIONS_VSD(cmdline, options);
301  }
302  else if(cmdline.isset("dependence-graph-vs"))
303  {
304  options.set_option("dependence-graph-vs", true);
305  options.set_option("domain set", true);
306 
307  PARSE_OPTIONS_VSD(cmdline, options);
308  options.set_option("data-dependencies", true); // Always set
309  }
310 
311  // Reachability questions, when given with a domain swap from specific
312  // to general tasks so that they can use the domain & parameterisations.
313  if(reachability_task)
314  {
315  if(options.get_bool_option("domain set"))
316  {
317  options.set_option("specific-analysis", false);
318  options.set_option("general-analysis", true);
319  }
320  }
321  else
322  {
323  if(!options.get_bool_option("domain set"))
324  {
325  // Default to constants as it is light-weight but useful
326  log.status() << "Domain not specified, defaulting to --constants"
327  << messaget::eom;
328  options.set_option("constants", true);
329  }
330  }
331  }
332 
333  // Storage choice
334  if(cmdline.isset("one-domain-per-history"))
335  {
336  options.set_option("one-domain-per-history", true);
337  options.set_option("storage set", true);
338  }
339  else if(cmdline.isset("one-domain-per-location"))
340  {
341  options.set_option("one-domain-per-location", true);
342  options.set_option("storage set", true);
343  }
344 
345  if(!options.get_bool_option("storage set"))
346  {
347  // one-domain-per-location and one-domain-per-history are effectively
348  // the same when using ahistorical so we default to per-history so that
349  // more sophisticated history objects work as expected
350  log.status() << "Storage not specified,"
351  << " defaulting to --one-domain-per-history" << messaget::eom;
352  options.set_option("one-domain-per-history", true);
353  options.set_option("storage set", true);
354  }
355 
356  if(cmdline.isset("validate-goto-model"))
357  {
358  options.set_option("validate-goto-model", true);
359  }
360 }
361 
364 {
365  if(cmdline.isset("version"))
366  {
367  std::cout << CBMC_VERSION << '\n';
368  return CPROVER_EXIT_SUCCESS;
369  }
370 
371  //
372  // command line options
373  //
374 
375  optionst options;
376  get_command_line_options(options);
379 
380  log_version_and_architecture("GOTO-ANALYZER");
381 
383 
384  // configure gcc, if required
386  {
387  gcc_versiont gcc_version;
388  gcc_version.get("gcc");
389  configure_gcc(gcc_version);
390  }
391 
393 
394  // Preserve backwards compatibility in processing
395  options.set_option("partial-inline", true);
396  options.set_option("rewrite-union", false);
397  options.set_option("remove-returns", true);
398 
399  if(process_goto_program(options))
401 
402  if(cmdline.isset("validate-goto-model"))
403  {
405  }
406 
407  // show it?
408  if(cmdline.isset("show-symbol-table"))
409  {
411  return CPROVER_EXIT_SUCCESS;
412  }
413 
414  // show it?
415  if(
416  cmdline.isset("show-goto-functions") ||
417  cmdline.isset("list-goto-functions"))
418  {
420  goto_model, ui_message_handler, cmdline.isset("list-goto-functions"));
421  return CPROVER_EXIT_SUCCESS;
422  }
423 
424  return perform_analysis(options);
425 }
426 
429 {
430  if(options.get_bool_option("taint"))
431  {
432  std::string taint_file=cmdline.get_value("taint");
433 
434  if(cmdline.isset("show-taint"))
435  {
436  taint_analysis(goto_model, taint_file, ui_message_handler, true);
437  return CPROVER_EXIT_SUCCESS;
438  }
439  else
440  {
441  std::string json_file=cmdline.get_value("json");
442  bool result = taint_analysis(
443  goto_model, taint_file, ui_message_handler, false, json_file);
445  }
446  }
447 
448  // If no domain is given, this lightweight version of the analysis is used.
449  if(options.get_bool_option("unreachable-instructions") &&
450  options.get_bool_option("specific-analysis"))
451  {
452  const std::string json_file=cmdline.get_value("json");
453 
454  if(json_file.empty())
455  unreachable_instructions(goto_model, false, std::cout);
456  else if(json_file=="-")
457  unreachable_instructions(goto_model, true, std::cout);
458  else
459  {
460  std::ofstream ofs(json_file);
461  if(!ofs)
462  {
463  log.error() << "Failed to open json output '" << json_file << "'"
464  << messaget::eom;
466  }
467 
469  }
470 
471  return CPROVER_EXIT_SUCCESS;
472  }
473 
474  if(options.get_bool_option("unreachable-functions") &&
475  options.get_bool_option("specific-analysis"))
476  {
477  const std::string json_file=cmdline.get_value("json");
478 
479  if(json_file.empty())
480  unreachable_functions(goto_model, false, std::cout);
481  else if(json_file=="-")
482  unreachable_functions(goto_model, true, std::cout);
483  else
484  {
485  std::ofstream ofs(json_file);
486  if(!ofs)
487  {
488  log.error() << "Failed to open json output '" << json_file << "'"
489  << messaget::eom;
491  }
492 
493  unreachable_functions(goto_model, true, ofs);
494  }
495 
496  return CPROVER_EXIT_SUCCESS;
497  }
498 
499  if(options.get_bool_option("reachable-functions") &&
500  options.get_bool_option("specific-analysis"))
501  {
502  const std::string json_file=cmdline.get_value("json");
503 
504  if(json_file.empty())
505  reachable_functions(goto_model, false, std::cout);
506  else if(json_file=="-")
507  reachable_functions(goto_model, true, std::cout);
508  else
509  {
510  std::ofstream ofs(json_file);
511  if(!ofs)
512  {
513  log.error() << "Failed to open json output '" << json_file << "'"
514  << messaget::eom;
516  }
517 
518  reachable_functions(goto_model, true, ofs);
519  }
520 
521  return CPROVER_EXIT_SUCCESS;
522  }
523 
524  if(options.get_bool_option("show-local-may-alias"))
525  {
527 
528  for(const auto &gf_entry : goto_model.goto_functions.function_map)
529  {
530  std::cout << ">>>>\n";
531  std::cout << ">>>> " << gf_entry.first << '\n';
532  std::cout << ">>>>\n";
533  local_may_aliast local_may_alias(gf_entry.second);
534  local_may_alias.output(std::cout, gf_entry.second, ns);
535  std::cout << '\n';
536  }
537 
538  return CPROVER_EXIT_SUCCESS;
539  }
540 
542 
543  if(cmdline.isset("show-properties"))
544  {
546  return CPROVER_EXIT_SUCCESS;
547  }
548 
549  if(cmdline.isset("property"))
551 
552  if(options.get_bool_option("general-analysis"))
553  {
554  // Output file factory
555  const std::string outfile=options.get_option("outfile");
556 
557  std::ofstream output_stream;
558  if(outfile != "-" && !outfile.empty())
559  output_stream.open(outfile);
560 
561  std::ostream &out(
562  (outfile == "-" || outfile.empty()) ? std::cout : output_stream);
563 
564  if(!out)
565  {
566  log.error() << "Failed to open output file '" << outfile << "'"
567  << messaget::eom;
569  }
570 
571  // Build analyzer
572  log.status() << "Selecting abstract domain" << messaget::eom;
573  namespacet ns(goto_model.symbol_table); // Must live as long as the domain.
574  std::unique_ptr<ai_baset> analyzer;
575 
576  try
577  {
578  analyzer = build_analyzer(options, goto_model, ns, ui_message_handler);
579  }
581  {
582  log.error() << e.what() << messaget::eom;
584  }
585 
586  if(analyzer == nullptr)
587  {
588  log.status() << "Task / Interpreter combination not supported"
589  << messaget::eom;
591  }
592 
593  // Run
594  log.status() << "Computing abstract states" << messaget::eom;
595  (*analyzer)(goto_model);
596 
597  // Perform the task
598  log.status() << "Performing task" << messaget::eom;
599 
600  bool result = true;
601 
602  if(options.get_bool_option("show"))
603  {
604  static_show_domain(goto_model, *analyzer, options, out);
605  return CPROVER_EXIT_SUCCESS;
606  }
607  else if(options.get_bool_option("show-on-source"))
608  {
610  return CPROVER_EXIT_SUCCESS;
611  }
612  else if(options.get_bool_option("verify"))
613  {
614  result = static_verifier(
615  goto_model, *analyzer, options, ui_message_handler, out);
616  }
617  else if(options.get_bool_option("simplify"))
618  {
619  PRECONDITION(!outfile.empty() && outfile != "-");
620  output_stream.close();
621  output_stream.open(outfile, std::ios::binary);
622  result = static_simplifier(
623  goto_model, *analyzer, options, ui_message_handler, out);
624  }
625  else if(options.get_bool_option("unreachable-instructions"))
626  {
628  *analyzer,
629  options,
630  out);
631  }
632  else if(options.get_bool_option("unreachable-functions"))
633  {
635  *analyzer,
636  options,
637  out);
638  }
639  else if(options.get_bool_option("reachable-functions"))
640  {
642  *analyzer,
643  options,
644  out);
645  }
646  else
647  {
648  log.error() << "Unhandled task" << messaget::eom;
650  }
651 
652  return result ?
654  }
655 
656  // Final defensive error case
657  log.error() << "no analysis option given -- consider reading --help"
658  << messaget::eom;
660 }
661 
663  const optionst &options)
664 {
665  // Remove inline assembler; this needs to happen before
666  // adding the library.
668 
669  // add the library
670  log.status() << "Adding CPROVER library (" << config.ansi_c.arch << ")"
671  << messaget::eom;
674 
675  // Common removal of types and complex constructs
676  if(::process_goto_program(goto_model, options, log))
677  return true;
678 
679  return false;
680 }
681 
684 {
685  // clang-format off
686  std::cout << '\n' << banner_string("GOTO-ANALYZER", CBMC_VERSION) << '\n'
687  << align_center_with_border("Copyright (C) 2017-2018") << '\n'
688  << align_center_with_border("Daniel Kroening, Diffblue") << '\n'
689  << align_center_with_border("kroening@kroening.com") << '\n'
690  <<
691  "\n"
692  "Usage: Purpose:\n"
693  "\n"
694  " goto-analyzer [-?|-h|--help] show help\n"
695  " goto-analyzer file.c ... source file names\n"
696  "\n"
697  "Task options:\n"
698  " --show display the abstract states on the goto program\n" // NOLINT(*)
699  " --show-on-source display the abstract states on the source\n"
700  // NOLINTNEXTLINE(whitespace/line_length)
701  " --verify use the abstract domains to check assertions\n"
702  // NOLINTNEXTLINE(whitespace/line_length)
703  " --simplify file_name use the abstract domains to simplify the program\n"
704  " --no-simplify-slicing do not remove instructions from which no\n"
705  " property can be reached (use with --simplify)\n" // NOLINT(*)
706  " --unreachable-instructions list dead code\n"
707  // NOLINTNEXTLINE(whitespace/line_length)
708  " --unreachable-functions list functions unreachable from the entry point\n"
709  // NOLINTNEXTLINE(whitespace/line_length)
710  " --reachable-functions list functions reachable from the entry point\n"
711  "\n"
712  "Abstract interpreter options:\n"
713  // NOLINTNEXTLINE(whitespace/line_length)
714  " --legacy-ait recursion for function and one domain per location\n"
715  // NOLINTNEXTLINE(whitespace/line_length)
716  " --recursive-interprocedural use recursion to handle interprocedural reasoning\n"
717  // NOLINTNEXTLINE(whitespace/line_length)
718  " --three-way-merge use VSD's three-way merge on return from function call\n"
719  // NOLINTNEXTLINE(whitespace/line_length)
720  " --legacy-concurrent legacy-ait with an extended fixed-point for concurrency\n"
721  // NOLINTNEXTLINE(whitespace/line_length)
722  " --location-sensitive use location-sensitive abstract interpreter\n"
723  "\n"
724  "History options:\n"
725  // NOLINTNEXTLINE(whitespace/line_length)
726  " --ahistorical the most basic history, tracks locations only\n"
727  // NOLINTNEXTLINE(whitespace/line_length)
728  " --call-stack n track the calling location stack for each function\n"
729  // NOLINTNEXTLINE(whitespace/line_length)
730  " limiting to at most n recursive loops, 0 to disable\n"
731  // NOLINTNEXTLINE(whitespace/line_length)
732  " --loop-unwind n track the number of loop iterations within a function\n"
733  // NOLINTNEXTLINE(whitespace/line_length)
734  " limited to n histories per location, 0 is unlimited\n"
735  // NOLINTNEXTLINE(whitespace/line_length)
736  " --branching n track the forwards jumps (if, switch, etc.) within a function\n"
737  // NOLINTNEXTLINE(whitespace/line_length)
738  " limited to n histories per location, 0 is unlimited\n"
739  // NOLINTNEXTLINE(whitespace/line_length)
740  " --loop-unwind-and-branching n track all local control flow\n"
741  // NOLINTNEXTLINE(whitespace/line_length)
742  " limited to n histories per location, 0 is unlimited\n"
743  "\n"
744  "Domain options:\n"
745  " --constants a constant for each variable if possible\n"
746  " --intervals an interval for each variable\n"
747  " --non-null tracks which pointers are non-null\n"
748  " --dependence-graph data and control dependencies between instructions\n" // NOLINT(*)
749  " --vsd, --variable-sensitivity\n"
750  " a configurable non-relational domain\n"
751  " --dependence-graph-vs dependencies between instructions using VSD\n" // NOLINT(*)
752  "\n"
753  "Variable sensitivity domain (VSD) options:\n"
754  HELP_VSD
755  "\n"
756  "Storage options:\n"
757  // NOLINTNEXTLINE(whitespace/line_length)
758  " --one-domain-per-location stores a domain for each location reached (default)\n"
759  // NOLINTNEXTLINE(whitespace/line_length)
760  " --one-domain-per-history stores a domain for each history object created\n"
761  "\n"
762  "Output options:\n"
763  " --text file_name output results in plain text to given file\n"
764  // NOLINTNEXTLINE(whitespace/line_length)
765  " --json file_name output results in JSON format to given file\n"
766  " --xml file_name output results in XML format to given file\n"
767  " --dot file_name output results in DOT format to given file\n"
768  "\n"
769  "Specific analyses:\n"
770  // NOLINTNEXTLINE(whitespace/line_length)
771  " --taint file_name perform taint analysis using rules in given file\n"
772  " --show-taint print taint analysis results on stdout\n"
773  " --show-local-may-alias perform procedure-local may alias analysis\n"
774  "\n"
775  "C/C++ frontend options:\n"
778  "\n"
779  "Platform options:\n"
781  "\n"
782  "Program representations:\n"
783  " --show-parse-tree show parse tree\n"
784  " --show-symbol-table show loaded symbol table\n"
787  "\n"
788  "Program instrumentation options:\n"
789  " --property id enable selected properties only\n"
792  "\n"
793  "Other options:\n"
795  " --version show version and exit\n"
796  HELP_FLUSH
797  " --verbosity # verbosity level\n"
799  "\n";
800  // clang-format on
801 }
cprover_library.h
cmdlinet::args
argst args
Definition: cmdline.h:145
build_analyzer.h
exception_utils.h
HELP_SHOW_GOTO_FUNCTIONS
#define HELP_SHOW_GOTO_FUNCTIONS
Definition: show_goto_functions.h:25
local_may_aliast::output
void output(std::ostream &out, const goto_functiont &goto_function, const namespacet &ns) const
Definition: local_may_alias.cpp:465
HELP_GOTO_CHECK
#define HELP_GOTO_CHECK
Definition: goto_check_c.h:53
gcc_versiont::get
void get(const std::string &executable)
Definition: gcc_version.cpp:18
parse_options_baset::ui_message_handler
ui_message_handlert ui_message_handler
Definition: parse_options.h:45
CPROVER_EXIT_VERIFICATION_UNSAFE
#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
parse_options_baset
Definition: parse_options.h:19
cmdlinet::isset
virtual bool isset(char option) const
Definition: cmdline.cpp:30
static_unreachable_instructions
bool static_unreachable_instructions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
Definition: unreachable_instructions.cpp:204
optionst
Definition: options.h:22
static_simplifier.h
static_verifier
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.
Definition: static_verifier.cpp:229
goto_analyzer_parse_optionst::get_command_line_options
virtual void get_command_line_options(optionst &options)
Definition: goto_analyzer_parse_options.cpp:59
static_simplifier
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.
Definition: static_simplifier.cpp:29
gcc_version.h
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
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
static_verifier.h
goto_analyzer_parse_options.h
HELP_CONFIG_PLATFORM
#define HELP_CONFIG_PLATFORM
Definition: config.h:84
taint_analysis.h
remove_asm.h
configure_gcc
void configure_gcc(const gcc_versiont &gcc_version)
Definition: gcc_version.cpp:147
options.h
CPROVER_EXIT_VERIFICATION_SAFE
#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
build_analyzer
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.
Definition: build_analyzer.cpp:30
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
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
goto_functionst::function_map
function_mapt function_map
Definition: goto_functions.h:29
version.h
goto_analyzer_parse_optionst::goto_analyzer_parse_optionst
goto_analyzer_parse_optionst(int argc, const char **argv)
Definition: goto_analyzer_parse_options.cpp:48
local_may_aliast
Definition: local_may_alias.h:25
label_properties
void label_properties(goto_modelt &goto_model)
Definition: set_properties.cpp:45
parse_options_baset::usage_error
virtual void usage_error()
Definition: parse_options.cpp:49
reachable_functions
void reachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
Definition: unreachable_instructions.cpp:403
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
PARSE_OPTIONS_VSD
#define PARSE_OPTIONS_VSD(cmdline, options)
Definition: variable_sensitivity_domain.h:104
set_properties.h
invalid_command_line_argument_exceptiont::what
std::string what() const override
A human readable description of what went wrong.
Definition: exception_utils.cpp:17
CBMC_VERSION
const char * CBMC_VERSION
HELP_CONFIG_C_CPP
#define HELP_CONFIG_C_CPP
Definition: config.h:33
unreachable_functions
void unreachable_functions(const goto_modelt &goto_model, const bool json, std::ostream &os)
Definition: unreachable_instructions.cpp:389
messaget::error
mstreamt & error() const
Definition: message.h:399
HELP_VSD
#define HELP_VSD
Definition: variable_sensitivity_domain.h:86
goto_analyzer_parse_optionst::process_goto_program
virtual bool process_goto_program(const optionst &options)
Definition: goto_analyzer_parse_options.cpp:662
initialize_goto_model.h
banner_string
std::string banner_string(const std::string &front_end, const std::string &version)
Definition: parse_options.cpp:174
local_may_alias.h
configt::ansi_ct::preprocessor
preprocessort preprocessor
Definition: config.h:248
PRECONDITION
#define PRECONDITION(CONDITION)
Definition: invariant.h:463
show_properties.h
cmdlinet::get_value
std::string get_value(char option) const
Definition: cmdline.cpp:48
show_symbol_table.h
goto_analyzer_parse_optionst::doit
virtual int doit() override
invoke main modules
Definition: goto_analyzer_parse_options.cpp:363
unreachable_instructions.h
HELP_SHOW_PROPERTIES
#define HELP_SHOW_PROPERTIES
Definition: show_properties.h:30
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
static_show_domain
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.
Definition: static_show_domain.cpp:21
goto_analyzer_parse_optionst::help
virtual void help() override
display command line help
Definition: goto_analyzer_parse_options.cpp:683
ai.h
GOTO_ANALYSER_OPTIONS
#define GOTO_ANALYSER_OPTIONS
Definition: goto_analyzer_parse_options.h:147
unreachable_instructions
static void unreachable_instructions(const goto_programt &goto_program, dead_mapt &dest)
Definition: unreachable_instructions.cpp:28
configt::ansi_ct::preprocessort::GCC
@ GCC
remove_returns.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
goto_modelt::goto_functions
goto_functionst goto_functions
GOTO functions.
Definition: goto_model.h:33
static_reachable_functions
bool static_reachable_functions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
Definition: unreachable_instructions.cpp:451
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
taint_analysis
bool taint_analysis(goto_modelt &goto_model, const std::string &taint_file_name, message_handlert &message_handler, bool show_full, const optionalt< std::string > &json_file_name)
Definition: taint_analysis.cpp:418
show_on_source.h
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
binary
static std::string binary(const constant_exprt &src)
Definition: json_expr.cpp:189
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
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
CPROVER_EXIT_INTERNAL_ERROR
#define CPROVER_EXIT_INTERNAL_ERROR
An error has been encountered during processing the requested analysis.
Definition: exit_codes.h:45
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
static_unreachable_functions
bool static_unreachable_functions(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
Definition: unreachable_instructions.cpp:437
CPROVER_EXIT_SUCCESS
#define CPROVER_EXIT_SUCCESS
Success indicates the required analysis has been performed without error.
Definition: exit_codes.h:16
show_on_source
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
Definition: show_on_source.cpp:71
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
goto_analyzer_parse_optionst::goto_model
goto_modelt goto_model
Definition: goto_analyzer_parse_options.h:182
goto_analyzer_parse_optionst::register_languages
void register_languages() override
Definition: goto_analyzer_languages.cpp:23
invalid_command_line_argument_exceptiont
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
Definition: exception_utils.h:50
cmdlinet::get_values
const std::list< std::string > & get_values(const std::string &option) const
Definition: cmdline.cpp:109
parse_options_baset::cmdline
cmdlinet cmdline
Definition: parse_options.h:28
set_properties
void set_properties(goto_programt &goto_program, std::unordered_set< irep_idt > &property_set)
Definition: set_properties.cpp:21
goto_modelt::symbol_table
symbol_tablet symbol_table
Symbol table.
Definition: goto_model.h:30
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
goto_analyzer_parse_optionst::perform_analysis
virtual int perform_analysis(const optionst &options)
Depending on the command line mode, run one of the analysis tasks.
Definition: goto_analyzer_parse_options.cpp:428
cprover_library.h
static_show_domain.h
process_goto_program.h
HELP_TIMESTAMP
#define HELP_TIMESTAMP
Definition: timestamper.h:14
HELP_FLUSH
#define HELP_FLUSH
Definition: ui_message.h:108
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
HELP_VALIDATE
#define HELP_VALIDATE
Definition: validation_interface.h:16