Skip to content

Commit dc10d51

Browse files
committed
Split symex_step and execute_next_instruction
This is in preparation for adding post-step cleanup
1 parent cbc495d commit dc10d51

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/goto-symex/goto_symex.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,26 @@ class goto_symext
218218
const get_goto_functiont &get_goto_function);
219219

220220
/// \brief Called for each step in the symbolic execution
221+
/// This calls \ref print_symex_step to print symex's current instruction if
222+
/// required, then \ref execute_instruction to execute the actual instruction
223+
/// body.
224+
/// \param get_goto_function: The delegate to retrieve function bodies (see
225+
/// \ref get_goto_functiont)
226+
/// \param state: Symbolic execution state for current instruction
227+
virtual void
228+
symex_step(const get_goto_functiont &get_goto_function, statet &state);
229+
230+
/// \brief Executes the instruction `state.source.pc`
221231
/// Case-switches over the type of the instruction being executed and calls
222232
/// another function appropriate to the instruction type, for example
223233
/// \ref symex_function_call if the current instruction is a function call,
224234
/// \ref symex_goto if the current instruction is a goto, etc.
225235
/// \param get_goto_function: The delegate to retrieve function bodies (see
226236
/// \ref get_goto_functiont)
227237
/// \param state: Symbolic execution state for current instruction
228-
virtual void
229-
symex_step(const get_goto_functiont &get_goto_function, statet &state);
238+
void execute_next_instruction(
239+
const get_goto_functiont &get_goto_function,
240+
statet &state);
230241

231242
/// Prints the route of symex as it walks through the code. Used for
232243
/// debugging.

src/goto-symex/symex_main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,13 @@ void goto_symext::symex_step(
512512
{
513513
// Print debug statements if they've been enabled.
514514
print_symex_step(state);
515+
execute_next_instruction(get_goto_function, state);
516+
}
515517

518+
void goto_symext::execute_next_instruction(
519+
const get_goto_functiont &get_goto_function,
520+
statet &state)
521+
{
516522
PRECONDITION(!state.threads.empty());
517523
PRECONDITION(!state.call_stack().empty());
518524

0 commit comments

Comments
 (0)