|
14 | 14 | #include <fstream>
|
15 | 15 | #include <iostream>
|
16 | 16 | #include <memory>
|
| 17 | +#include <sstream> |
17 | 18 |
|
18 | 19 | #include <util/config.h>
|
19 | 20 | #include <util/exception_utils.h>
|
|
93 | 94 | #include "interrupt.h"
|
94 | 95 | #include "k_induction.h"
|
95 | 96 | #include "mmio.h"
|
96 |
| -#include "model_argc_argv.h" |
97 | 97 | #include "nondet_static.h"
|
98 | 98 | #include "nondet_volatile.h"
|
99 | 99 | #include "points_to.h"
|
@@ -1050,10 +1050,38 @@ void goto_instrument_parse_optionst::instrument_goto_program()
|
1050 | 1050 | {
|
1051 | 1051 | unsigned max_argc=
|
1052 | 1052 | safe_string2unsigned(cmdline.get_value("model-argc-argv"));
|
| 1053 | + std::list<std::string> argv; |
| 1054 | + argv.resize(max_argc); |
1053 | 1055 |
|
1054 | 1056 | log.status() << "Adding up to " << max_argc << " command line arguments"
|
1055 | 1057 | << messaget::eom;
|
1056 |
| - if(model_argc_argv(goto_model, max_argc, ui_message_handler)) |
| 1058 | + |
| 1059 | + if(model_argc_argv( |
| 1060 | + goto_model, argv, true /*model_argv*/, ui_message_handler)) |
| 1061 | + throw 0; |
| 1062 | + } |
| 1063 | + |
| 1064 | + if(cmdline.isset("add-cmd-line-arg")) |
| 1065 | + { |
| 1066 | + const std::list<std::string> &argv = cmdline.get_values("add-cmd-line-arg"); |
| 1067 | + unsigned argc = 0; |
| 1068 | + |
| 1069 | + std::stringstream ss; |
| 1070 | + ss << "["; |
| 1071 | + std::string sep = ""; |
| 1072 | + for(auto const &arg : argv) |
| 1073 | + { |
| 1074 | + ss << sep << "\"" << arg << "\""; |
| 1075 | + argc++; |
| 1076 | + sep = ", "; |
| 1077 | + } |
| 1078 | + ss << "]"; |
| 1079 | + |
| 1080 | + log.status() << "Adding " << argc << " arguments: " << ss.str() |
| 1081 | + << messaget::eom; |
| 1082 | + |
| 1083 | + if(model_argc_argv( |
| 1084 | + goto_model, argv, false /*model_argv*/, ui_message_handler)) |
1057 | 1085 | throw 0;
|
1058 | 1086 | }
|
1059 | 1087 |
|
@@ -1827,7 +1855,8 @@ void goto_instrument_parse_optionst::help()
|
1827 | 1855 | HELP_REMOVE_CALLS_NO_BODY
|
1828 | 1856 | HELP_REMOVE_CONST_FUNCTION_POINTERS
|
1829 | 1857 | " --add-library add models of C library functions\n"
|
1830 |
| - " --model-argc-argv <n> model up to <n> command line arguments\n" |
| 1858 | + HELP_CONFIG_LIBRARY |
| 1859 | + HELP_ARGC_ARGV |
1831 | 1860 | // NOLINTNEXTLINE(whitespace/line_length)
|
1832 | 1861 | " --remove-function-body <f> remove the implementation of function <f> (may be repeated)\n"
|
1833 | 1862 | HELP_REPLACE_CALLS
|
|
0 commit comments