CBMC
shadow_memoryt Class Reference

The shadow memory instrumentation performed during symbolic execution. More...

#include <shadow_memory.h>

+ Collaboration diagram for shadow_memoryt:

Public Member Functions

 shadow_memoryt (const std::function< void(goto_symex_statet &, const exprt &, const exprt &)> symex_assign, const namespacet &ns, message_handlert &message_handler)
 
void symex_field_static_init (goto_symex_statet &state, const ssa_exprt &lhs)
 Initialize global-scope shadow memory for global/static variables. More...
 
void symex_field_static_init_string_constant (goto_symex_statet &state, const ssa_exprt &expr, const exprt &rhs)
 Initialize global-scope shadow memory for string constants. More...
 
void symex_field_local_init (goto_symex_statet &state, const ssa_exprt &expr)
 Initialize local-scope shadow memory for local variables and parameters. More...
 
void symex_field_dynamic_init (goto_symex_statet &state, const exprt &expr, const side_effect_exprt &code)
 Initialize global-scope shadow memory for dynamically allocated memory. More...
 
void symex_get_field (goto_symex_statet &state, const exprt &lhs, const exprt::operandst &arguments)
 Symbolically executes a __CPROVER_get_field call. More...
 
void symex_set_field (goto_symex_statet &state, const exprt::operandst &arguments)
 Symbolically executes a __CPROVER_set_field call. More...
 

Static Public Member Functions

static shadow_memory_field_definitionst gather_field_declarations (const abstract_goto_modelt &goto_model, message_handlert &message_handler)
 Gathers the available shadow memory field definitions (__CPROVER_field_decl calls) from the goto model. More...
 

Private Member Functions

void initialize_shadow_memory (goto_symex_statet &state, exprt expr, const shadow_memory_field_definitionst::field_definitiont &fields)
 Allocates and initializes a shadow memory field for the given original memory. More...
 
const symbol_exprtadd_field (goto_symex_statet &state, const exprt &expr, const irep_idt &field_name, const typet &field_type)
 Registers a shadow memory field for the given original memory. More...
 

Static Private Member Functions

static void convert_field_declaration (const code_function_callt &code_function_call, shadow_memory_field_definitionst::field_definitiont &fields, bool is_global, message_handlert &message_handler)
 Converts a field declaration. More...
 

Private Attributes

const std::function< void(goto_symex_statet &, const exprt &, const exprt)> symex_assign
 
const namespacetns
 
messaget log
 

Detailed Description

The shadow memory instrumentation performed during symbolic execution.

Definition at line 36 of file shadow_memory.h.

Constructor & Destructor Documentation

◆ shadow_memoryt()

shadow_memoryt::shadow_memoryt ( const std::function< void(goto_symex_statet &, const exprt &, const exprt &)>  symex_assign,
const namespacet ns,
message_handlert message_handler 
)
inline

Definition at line 39 of file shadow_memory.h.

Member Function Documentation

◆ add_field()

const symbol_exprt & shadow_memoryt::add_field ( goto_symex_statet state,
const exprt expr,
const irep_idt field_name,
const typet field_type 
)
private

Registers a shadow memory field for the given original memory.

Parameters
stateThe symex state
exprThe expression for which shadow memory should be allocated
field_nameThe field name
field_typeThe field type
Returns
The resulting shadow memory symbol expression

Definition at line 66 of file shadow_memory.cpp.

◆ convert_field_declaration()

void shadow_memoryt::convert_field_declaration ( const code_function_callt code_function_call,
shadow_memory_field_definitionst::field_definitiont fields,
bool  is_global,
message_handlert message_handler 
)
staticprivate

Converts a field declaration.

Parameters
code_function_callThe __CPROVER_field_decl_* call
fieldsThe field declaration to be extended
is_globalTrue if the declaration is global
message_handlerFor logging

Definition at line 506 of file shadow_memory.cpp.

◆ gather_field_declarations()

shadow_memory_field_definitionst shadow_memoryt::gather_field_declarations ( const abstract_goto_modelt goto_model,
message_handlert message_handler 
)
static

Gathers the available shadow memory field definitions (__CPROVER_field_decl calls) from the goto model.

Parameters
goto_modelThe goto model
message_handlerFor logging
Returns
The field definitions

Definition at line 458 of file shadow_memory.cpp.

◆ initialize_shadow_memory()

void shadow_memoryt::initialize_shadow_memory ( goto_symex_statet state,
exprt  expr,
const shadow_memory_field_definitionst::field_definitiont fields 
)
private

Allocates and initializes a shadow memory field for the given original memory.

Parameters
stateThe symex state
exprThe expression for which shadow memory should be allocated
fieldsThe field definition to be used

Definition at line 28 of file shadow_memory.cpp.

◆ symex_field_dynamic_init()

void shadow_memoryt::symex_field_dynamic_init ( goto_symex_statet state,
const exprt expr,
const side_effect_exprt code 
)

Initialize global-scope shadow memory for dynamically allocated memory.

Parameters
stateThe symex state
exprThe dynamic object symbol expression
codeThe allocation side effect code

Definition at line 446 of file shadow_memory.cpp.

◆ symex_field_local_init()

void shadow_memoryt::symex_field_local_init ( goto_symex_statet state,
const ssa_exprt expr 
)

Initialize local-scope shadow memory for local variables and parameters.

Parameters
stateThe symex state
exprThe declared symbol expression

Definition at line 403 of file shadow_memory.cpp.

◆ symex_field_static_init()

void shadow_memoryt::symex_field_static_init ( goto_symex_statet state,
const ssa_exprt lhs 
)

Initialize global-scope shadow memory for global/static variables.

Parameters
stateThe symex state
lhsThe LHS expression of the initializer assignment

Definition at line 340 of file shadow_memory.cpp.

◆ symex_field_static_init_string_constant()

void shadow_memoryt::symex_field_static_init_string_constant ( goto_symex_statet state,
const ssa_exprt expr,
const exprt rhs 
)

Initialize global-scope shadow memory for string constants.

Parameters
stateThe symex state
exprThe defined symbol expression
rhsThe RHS expression of the initializer assignment

Definition at line 378 of file shadow_memory.cpp.

◆ symex_get_field()

void shadow_memoryt::symex_get_field ( goto_symex_statet state,
const exprt lhs,
const exprt::operandst arguments 
)

Symbolically executes a __CPROVER_get_field call.

Parameters
stateThe symex state
lhsThe LHS of the call
argumentsThe call arguments

Definition at line 191 of file shadow_memory.cpp.

◆ symex_set_field()

void shadow_memoryt::symex_set_field ( goto_symex_statet state,
const exprt::operandst arguments 
)

Symbolically executes a __CPROVER_set_field call.

Parameters
stateThe symex state
argumentsThe call arguments

Definition at line 88 of file shadow_memory.cpp.

Member Data Documentation

◆ log

messaget shadow_memoryt::log
private

Definition at line 138 of file shadow_memory.h.

◆ ns

const namespacet& shadow_memoryt::ns
private

Definition at line 137 of file shadow_memory.h.

◆ symex_assign

const std::function<void(goto_symex_statet &, const exprt &, const exprt)> shadow_memoryt::symex_assign
private

Definition at line 136 of file shadow_memory.h.


The documentation for this class was generated from the following files: