|
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>
|
|
96 | 97 | #include "interrupt.h"
|
97 | 98 | #include "k_induction.h"
|
98 | 99 | #include "mmio.h"
|
99 |
| -#include "model_argc_argv.h" |
100 | 100 | #include "nondet_static.h"
|
101 | 101 | #include "nondet_volatile.h"
|
102 | 102 | #include "points_to.h"
|
@@ -1054,10 +1054,38 @@ void goto_instrument_parse_optionst::instrument_goto_program()
|
1054 | 1054 | {
|
1055 | 1055 | unsigned max_argc=
|
1056 | 1056 | safe_string2unsigned(cmdline.get_value("model-argc-argv"));
|
| 1057 | + std::list<std::string> argv; |
| 1058 | + argv.resize(max_argc); |
1057 | 1059 |
|
1058 | 1060 | log.status() << "Adding up to " << max_argc << " command line arguments"
|
1059 | 1061 | << messaget::eom;
|
1060 |
| - if(model_argc_argv(goto_model, max_argc, ui_message_handler)) |
| 1062 | + |
| 1063 | + if(model_argc_argv( |
| 1064 | + goto_model, argv, true /*model_argv*/, ui_message_handler)) |
| 1065 | + throw 0; |
| 1066 | + } |
| 1067 | + |
| 1068 | + if(cmdline.isset("add-cmd-line-arg")) |
| 1069 | + { |
| 1070 | + const std::list<std::string> &argv = cmdline.get_values("add-cmd-line-arg"); |
| 1071 | + unsigned argc = 0; |
| 1072 | + |
| 1073 | + std::stringstream ss; |
| 1074 | + ss << "["; |
| 1075 | + std::string sep = ""; |
| 1076 | + for(auto const &arg : argv) |
| 1077 | + { |
| 1078 | + ss << sep << "\"" << arg << "\""; |
| 1079 | + argc++; |
| 1080 | + sep = ", "; |
| 1081 | + } |
| 1082 | + ss << "]"; |
| 1083 | + |
| 1084 | + log.status() << "Adding " << argc << " arguments: " << ss.str() |
| 1085 | + << messaget::eom; |
| 1086 | + |
| 1087 | + if(model_argc_argv( |
| 1088 | + goto_model, argv, false /*model_argv*/, ui_message_handler)) |
1061 | 1089 | throw 0;
|
1062 | 1090 | }
|
1063 | 1091 |
|
@@ -1842,7 +1870,7 @@ void goto_instrument_parse_optionst::help()
|
1842 | 1870 | HELP_REMOVE_CALLS_NO_BODY
|
1843 | 1871 | HELP_REMOVE_CONST_FUNCTION_POINTERS
|
1844 | 1872 | " --add-library add models of C library functions\n"
|
1845 |
| - " --model-argc-argv <n> model up to <n> command line arguments\n" |
| 1873 | + HELP_ARGC_ARGV |
1846 | 1874 | // NOLINTNEXTLINE(whitespace/line_length)
|
1847 | 1875 | " --remove-function-body <f> remove the implementation of function <f> (may be repeated)\n"
|
1848 | 1876 | HELP_REPLACE_CALLS
|
|
0 commit comments