Skip to content

Commit dd66465

Browse files
peterschrammelgiulio-garbi
authored andcommitted
Add --nondet-static-matching regex option to goto-instrument
1 parent 5ad4962 commit dd66465

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
222222
if(cmdline.isset("nondet-static"))
223223
options.set_option("nondet-static", true);
224224

225+
if(cmdline.isset("nondet-static-matching"))
226+
options.set_option(
227+
"nondet-static-matching", cmdline.get_value("nondet-static-matching"));
228+
225229
if(cmdline.isset("no-simplify"))
226230
options.set_option("simplify", false);
227231

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,17 @@ int goto_instrument_parse_optionst::doit()
154154
}
155155
}
156156

157+
// ignore default/user-specified initialization
158+
// of matching variables with static lifetime
159+
if(cmdline.isset("nondet-static-matching"))
160+
{
161+
log.status() << "Adding nondeterministic initialization "
162+
"of matching static/global variables"
163+
<< messaget::eom;
164+
nondet_static_matching(
165+
goto_model, cmdline.get_value("nondet-static-matching"));
166+
}
167+
157168
instrument_goto_program();
158169

159170
if(cmdline.isset("validate-goto-model"))
@@ -1898,6 +1909,8 @@ void goto_instrument_parse_optionst::help()
18981909
" --nondet-static add nondeterministic initialization of variables with static lifetime\n" // NOLINT(*)
18991910
" --nondet-static-exclude e same as nondet-static except for the variable e\n" //NOLINT(*)
19001911
" (use multiple times if required)\n"
1912+
" --nondet-static-matching r add nondeterministic initialization of variables\n"
1913+
" with static lifetime matching regex r\n"
19011914
" --function-enter <f>, --function-exit <f>, --branch <f>\n"
19021915
" instruments a call to <f> at the beginning,\n" // NOLINT(*)
19031916
" the exit, or a branch point, respectively\n"

src/goto-instrument/goto_instrument_parse_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Author: Daniel Kroening, [email protected]
6565
"(isr):" \
6666
"(stack-depth):(nondet-static)" \
6767
"(nondet-static-exclude):" \
68+
"(nondet-static-matching):" \
6869
"(function-enter):(function-exit):(branch):" \
6970
OPT_SHOW_GOTO_FUNCTIONS \
7071
OPT_SHOW_PROPERTIES \

0 commit comments

Comments
 (0)