|
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 |
|
@@ -553,6 +546,26 @@ int cbmc_parse_optionst::doit()
|
553 | 546 | if(set_properties())
|
554 | 547 | return CPROVER_EXIT_SET_PROPERTIES_FAILED;
|
555 | 548 |
|
| 549 | + // At this point, our goto-model should be in core-goto form (all of the |
| 550 | + // transformations have been run and the program is ready to be given to the |
| 551 | + // solver). |
| 552 | + if(cmdline.isset("export-core-goto")) |
| 553 | + { |
| 554 | + auto core_goto_filename = cmdline.get_value("export-core-goto"); |
| 555 | + auto success = |
| 556 | + !write_goto_binary(core_goto_filename, goto_model, ui_message_handler); |
| 557 | + |
| 558 | + if(!success) |
| 559 | + { |
| 560 | + log.error() << "Unable to export goto-program in file " |
| 561 | + << core_goto_filename << messaget::eom; |
| 562 | + return CPROVER_EXIT_INTERNAL_ERROR; |
| 563 | + } |
| 564 | + log.status() << "Exported goto-program in core-goto form at " |
| 565 | + << core_goto_filename << messaget::eom; |
| 566 | + return CPROVER_EXIT_SUCCESS; |
| 567 | + } |
| 568 | + |
556 | 569 | if(
|
557 | 570 | options.get_bool_option("program-only") ||
|
558 | 571 | options.get_bool_option("show-vcc") ||
|
@@ -937,6 +950,7 @@ void cbmc_parse_optionst::help()
|
937 | 950 | " --show-symbol-table show loaded symbol table\n"
|
938 | 951 | HELP_SHOW_GOTO_FUNCTIONS
|
939 | 952 | HELP_VALIDATE
|
| 953 | + " --export-core-goto f serialise goto-program in core-goto form in f\n" // NOLINT(*) |
940 | 954 | "\n"
|
941 | 955 | "Program instrumentation options:\n"
|
942 | 956 | HELP_GOTO_CHECK
|
|
0 commit comments