Skip to content

Commit f5461ac

Browse files
authored
Merge pull request diffblue#467 from diffblue/save_goto_binary_without_analysis
SEC-513: Added: Java -> GOTO binary.
2 parents 273bad4 + b6d6efc commit f5461ac

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/driver/sec_driver_parse_options.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <goto-programs/set_properties.h>
2121
#include <goto-programs/show_properties.h>
2222
#include <goto-programs/show_symbol_table.h>
23+
#include <goto-programs/write_goto_binary.h>
2324
#include <java_bytecode/java_bytecode_language.h>
2425
#include <jsil/jsil_language.h>
2526
#include <linking/static_lifetime_init.h>
@@ -221,6 +222,21 @@ int sec_driver_parse_optionst::doit()
221222
local_value_sett::do_not_use_precise_access_paths = true;
222223
}
223224

225+
if(cmdline.isset("output-goto-binary"))
226+
{
227+
const irep_idt &binary_pathname = cmdline.get_value("goto-binary");
228+
status() << "Saving loaded program as GOTO binary." << messaget::eom;
229+
const bool fail = write_goto_binary(
230+
as_string(binary_pathname), goto_model, get_message_handler());
231+
if(fail)
232+
{
233+
error()
234+
<< "ERROR: Call to 'write_goto_binary' has FAILED." << messaget::eom;
235+
return CPROVER_EXIT_EXCEPTION;
236+
}
237+
return CPROVER_EXIT_SUCCESS;
238+
}
239+
224240
if(cmdline.isset("security-scanner"))
225241
{
226242
try
@@ -631,6 +647,8 @@ void sec_driver_parse_optionst::help()
631647
" a directory. Pass a non existing directory\n"
632648
" path-name with this option. The directory\n"
633649
" will be created with the dumped program.\n"
650+
" --output-goto-binary save the input Java program as GOTO binary\n"
651+
" and exit.\n"
634652
"\n"
635653
"Other options:\n"
636654
" --version show version and exit\n"

src/driver/sec_driver_parse_options.h

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class optionst;
5353
"(java-max-input-array-length):" \
5454
"(string-max-input-length):" \
5555
"(java-max-input-tree-depth):" \
56+
"(output-goto-binary):" \
5657
UI_MESSAGE_OPTIONS \
5758
JAVA_BYTECODE_LANGUAGE_OPTIONS \
5859
// End of options

0 commit comments

Comments
 (0)