Skip to content

Commit f3c7b40

Browse files
Pass preprocessed shadow memory fields to goto_symex
Initializees the shadow_memory member of the goto_symex_state that tracks the shadow memory information during symbolic execution.
1 parent cb93427 commit f3c7b40

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

src/goto-checker/multi_path_symex_only_checker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ void multi_path_symex_only_checkert::generate_equation()
7979

8080
const auto symex_start = std::chrono::steady_clock::now();
8181

82-
symex_symbol_table =
83-
symex.symex_from_entry_point_of(goto_symext::get_goto_function(goto_model));
82+
symex_symbol_table = symex.symex_from_entry_point_of(
83+
goto_symext::get_goto_function(goto_model), fields);
8484

8585
const auto symex_stop = std::chrono::steady_clock::now();
8686
std::chrono::duration<double> symex_runtime =

src/goto-checker/single_path_symex_only_checker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void single_path_symex_only_checkert::initialize_worklist()
7979
shadow_memoryt::gather_field_declarations(goto_model, ui_message_handler);
8080

8181
symex.initialize_path_storage_from_entry_point_of(
82-
goto_symext::get_goto_function(goto_model), symex_symbol_table);
82+
goto_symext::get_goto_function(goto_model), symex_symbol_table, fields);
8383
}
8484

8585
bool single_path_symex_only_checkert::has_finished_exploration(

src/goto-symex/goto_symex.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class address_of_exprt;
2222
class function_application_exprt;
2323
class goto_symex_statet;
2424
class path_storaget;
25+
class shadow_memory_field_definitionst;
2526
class side_effect_exprt;
2627
class symex_assignt;
2728
class typet;
@@ -98,16 +99,22 @@ class goto_symext
9899
/// having the state around afterwards.
99100
/// \param get_goto_function: The delegate to retrieve function bodies (see
100101
/// \ref get_goto_functiont)
101-
/// \return A symbol table holding the symbols added during symbolic
102-
/// execution.
102+
/// \param fields The shadow memory field declarations
103103
NODISCARD
104-
virtual symbol_tablet
105-
symex_from_entry_point_of(const get_goto_functiont &get_goto_function);
104+
virtual symbol_tablet symex_from_entry_point_of(
105+
const get_goto_functiont &get_goto_function,
106+
const shadow_memory_field_definitionst &fields);
106107

107108
/// Puts the initial state of the entry point function into the path storage
109+
/// \param get_goto_function: The delegate to retrieve function bodies (see
110+
/// \ref get_goto_functiont)
111+
/// \param new_symbol_table: A symbol table to store the symbols added during
112+
/// symbolic execution
113+
/// \param fields The shadow memory field declarations
108114
virtual void initialize_path_storage_from_entry_point_of(
109115
const get_goto_functiont &get_goto_function,
110-
symbol_table_baset &new_symbol_table);
116+
symbol_table_baset &new_symbol_table,
117+
const shadow_memory_field_definitionst &fields);
111118

112119
/// Performs symbolic execution using a state and equation that have
113120
/// already been used to symbolically execute part of the program. The state

src/goto-symex/symex_main.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,18 +465,24 @@ std::unique_ptr<goto_symext::statet> goto_symext::initialize_entry_point_state(
465465
}
466466

467467
symbol_tablet goto_symext::symex_from_entry_point_of(
468-
const get_goto_functiont &get_goto_function)
468+
const get_goto_functiont &get_goto_function,
469+
const shadow_memory_field_definitionst &fields)
469470
{
470471
auto state = initialize_entry_point_state(get_goto_function);
472+
// Initialize declared shadow memory fields
473+
state->shadow_memory.fields = fields;
471474

472475
return symex_with_state(*state, get_goto_function);
473476
}
474477

475478
void goto_symext::initialize_path_storage_from_entry_point_of(
476479
const get_goto_functiont &get_goto_function,
477-
symbol_table_baset &new_symbol_table)
480+
symbol_table_baset &new_symbol_table,
481+
const shadow_memory_field_definitionst &fields)
478482
{
479483
auto state = initialize_entry_point_state(get_goto_function);
484+
// Initialize declared shadow memory fields
485+
state->shadow_memory.fields = fields;
480486

481487
path_storaget::patht entry_point_start(target, *state);
482488
entry_point_start.state.saved_target = state->source.pc;

unit/path_strategies.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,9 @@ void _check_with_strategy(
426426
setup_symex(symex, ns, options, ui_message_handler);
427427

428428
symex.initialize_path_storage_from_entry_point_of(
429-
goto_symext::get_goto_function(goto_model), symex_symbol_table);
429+
goto_symext::get_goto_function(goto_model),
430+
symex_symbol_table,
431+
shadow_memory_field_definitionst{});
430432
}
431433

432434
std::size_t expected_results_cnt = 0;

0 commit comments

Comments
 (0)