|
26 | 26 | # include <util/unicode.h>
|
27 | 27 | #endif
|
28 | 28 |
|
29 |
| -#include <langapi/language.h> |
| 29 | +#include <goto-programs/initialize_goto_model.h> |
| 30 | +#include <goto-programs/link_to_library.h> |
| 31 | +#include <goto-programs/loop_ids.h> |
| 32 | +#include <goto-programs/process_goto_program.h> |
| 33 | +#include <goto-programs/read_goto_binary.h> |
| 34 | +#include <goto-programs/remove_skip.h> |
| 35 | +#include <goto-programs/remove_unused_functions.h> |
| 36 | +#include <goto-programs/set_properties.h> |
| 37 | +#include <goto-programs/show_goto_functions.h> |
| 38 | +#include <goto-programs/show_properties.h> |
| 39 | +#include <goto-programs/show_symbol_table.h> |
| 40 | +#include <goto-programs/write_goto_binary.h> |
30 | 41 |
|
31 | 42 | #include <ansi-c/c_preprocess.h>
|
32 | 43 | #include <ansi-c/cprover_library.h>
|
33 | 44 | #include <ansi-c/gcc_version.h>
|
34 |
| - |
35 | 45 | #include <assembler/remove_asm.h>
|
36 |
| - |
37 | 46 | #include <cpp/cprover_library.h>
|
38 |
| - |
39 | 47 | #include <goto-checker/all_properties_verifier.h>
|
40 | 48 | #include <goto-checker/all_properties_verifier_with_fault_localization.h>
|
41 | 49 | #include <goto-checker/all_properties_verifier_with_trace_storage.h>
|
|
49 | 57 | #include <goto-checker/single_path_symex_only_checker.h>
|
50 | 58 | #include <goto-checker/stop_on_fail_verifier.h>
|
51 | 59 | #include <goto-checker/stop_on_fail_verifier_with_fault_localization.h>
|
52 |
| - |
53 |
| -#include <goto-programs/initialize_goto_model.h> |
54 |
| -#include <goto-programs/link_to_library.h> |
55 |
| -#include <goto-programs/loop_ids.h> |
56 |
| -#include <goto-programs/process_goto_program.h> |
57 |
| -#include <goto-programs/read_goto_binary.h> |
58 |
| -#include <goto-programs/remove_skip.h> |
59 |
| -#include <goto-programs/remove_unused_functions.h> |
60 |
| -#include <goto-programs/set_properties.h> |
61 |
| -#include <goto-programs/show_goto_functions.h> |
62 |
| -#include <goto-programs/show_properties.h> |
63 |
| -#include <goto-programs/show_symbol_table.h> |
64 |
| - |
65 | 60 | #include <goto-instrument/cover.h>
|
66 | 61 | #include <goto-instrument/full_slicer.h>
|
67 | 62 | #include <goto-instrument/nondet_static.h>
|
68 | 63 | #include <goto-instrument/reachability_slicer.h>
|
69 |
| - |
70 | 64 | #include <goto-symex/path_storage.h>
|
71 |
| - |
72 |
| -#include <pointer-analysis/add_failed_symbols.h> |
73 |
| - |
| 65 | +#include <langapi/language.h> |
74 | 66 | #include <langapi/mode.h>
|
| 67 | +#include <pointer-analysis/add_failed_symbols.h> |
75 | 68 |
|
76 | 69 | #include "c_test_input_generator.h"
|
77 | 70 |
|
@@ -252,6 +245,19 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
|
252 | 245 | options.set_option("trace", true);
|
253 | 246 | }
|
254 | 247 |
|
| 248 | + if(cmdline.isset("export-symex-ready-goto")) |
| 249 | + { |
| 250 | + options.set_option( |
| 251 | + "export-symex-ready-goto", cmdline.get_value("export-symex-ready-goto")); |
| 252 | + if(options.get_option("export-symex-ready-goto").empty()) |
| 253 | + { |
| 254 | + log.error() |
| 255 | + << "ERROR: Please provide a filename to write the goto-binary to." |
| 256 | + << messaget::eom; |
| 257 | + exit(CPROVER_EXIT_INTERNAL_ERROR); |
| 258 | + } |
| 259 | + } |
| 260 | + |
255 | 261 | if(cmdline.isset("localize-faults"))
|
256 | 262 | options.set_option("localize-faults", true);
|
257 | 263 |
|
@@ -553,6 +559,31 @@ int cbmc_parse_optionst::doit()
|
553 | 559 | if(set_properties())
|
554 | 560 | return CPROVER_EXIT_SET_PROPERTIES_FAILED;
|
555 | 561 |
|
| 562 | + // At this point, our goto-model should be in symex-ready-goto form (all of |
| 563 | + // the transformations have been run and the program is ready to be given |
| 564 | + // to the solver). |
| 565 | + if(options.is_set("export-symex-ready-goto")) |
| 566 | + { |
| 567 | + auto symex_ready_goto_filename = |
| 568 | + options.get_option("export-symex-ready-goto"); |
| 569 | + |
| 570 | + bool success = !write_goto_binary( |
| 571 | + symex_ready_goto_filename, goto_model, ui_message_handler); |
| 572 | + |
| 573 | + if(!success) |
| 574 | + { |
| 575 | + log.error() << "ERROR: Unable to export goto-program in file " |
| 576 | + << symex_ready_goto_filename << messaget::eom; |
| 577 | + return CPROVER_EXIT_INTERNAL_ERROR; |
| 578 | + } |
| 579 | + else |
| 580 | + { |
| 581 | + log.status() << "Exported goto-program in symex-ready-goto form at " |
| 582 | + << symex_ready_goto_filename << messaget::eom; |
| 583 | + return CPROVER_EXIT_SUCCESS; |
| 584 | + } |
| 585 | + } |
| 586 | + |
556 | 587 | if(
|
557 | 588 | options.get_bool_option("program-only") ||
|
558 | 589 | options.get_bool_option("show-vcc") ||
|
@@ -937,6 +968,7 @@ void cbmc_parse_optionst::help()
|
937 | 968 | " --show-symbol-table show loaded symbol table\n"
|
938 | 969 | HELP_SHOW_GOTO_FUNCTIONS
|
939 | 970 | HELP_VALIDATE
|
| 971 | + " --export-symex-ready-goto f serialise goto-program in symex-ready-goto form in f\n" // NOLINT(*) |
940 | 972 | "\n"
|
941 | 973 | "Program instrumentation options:\n"
|
942 | 974 | HELP_GOTO_CHECK
|
|
0 commit comments