12 #ifndef CPROVER_GOTO_PROGRAMS_INTERPRETER_CLASS_H
13 #define CPROVER_GOTO_PROGRAMS_INTERPRETER_CLASS_H
35 :
output(_message_handler),
93 typedef std::list<function_assignments_contextt>
95 typedef std::map<irep_idt, std::list<function_assignments_contextt> >
118 if(lower_bound->first!=address)
144 return next_alloc_address-address;
149 auto memory_iter =
memory.
find(numeric_cast_v<std::size_t>(address));
154 while(memory_iter!=
memory.
end() && memory_iter->first<(address+alloc_size))
209 bool use_non_det=
false);
263 goto_functionst::function_mapt::const_iterator
function;
280 throw "invalid boolean value";
285 const typet &source_type,
289 const typet &source_type,
294 const typet &source_type,
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
A collection of goto functions.
instructionst::const_iterator const_targett
mp_integer old_stack_pointer
mp_integer return_value_address
goto_programt::const_targett return_pc
goto_functionst::function_mapt::const_iterator return_function
void clear_input_flags()
Clears memoy r/w flag initialization.
exprt get_value(const typet &type, const mp_integer &offset=0, bool use_non_det=false)
retrives the constant value at memory location offset as an object of type type
std::map< irep_idt, function_assignmentst > output_valuest
std::map< assignment_idt, diff_pairt > side_effects_differencet
std::map< irep_idt, std::list< function_assignments_contextt > > list_input_varst
void execute_function_call()
std::list< function_assignments_contextt > function_assignments_contextst
std::map< struct_member_idt, const exprt > struct_valuest
std::pair< exprt, exprt > diff_pairt
mp_integer base_address_to_actual_size(const mp_integer &address) const
friend class interpreter_testt
void print_memory(bool input_flags)
Prints the current state of the memory map Since messaget mdofifies class members,...
mp_integer evaluate_address(const exprt &expr, bool fail_quietly=false)
virtual void command()
reads a user command and executes it.
bool byte_offset_to_memory_offset(const typet &source_type, const mp_integer &byte_offset, mp_integer &result)
Supposing the caller has an mp_vector representing a value with type 'source_type',...
std::map< mp_integer, std::optional< symbol_exprt > > inverse_memory_mapt
inverse_memory_mapt inverse_memory_map
sparse_vectort< memory_cellt > memoryt
output_valuest output_values
symbol_exprt address_to_symbol(const mp_integer &address) const
void execute_goto()
executes a goto instruction
std::map< std::string, const irep_idt & > parameter_sett
void build_memory_map()
Creates a memory map of all static symbols in the program.
std::pair< irep_idt, exprt > input_entryt
std::vector< mp_integer > mp_vectort
mp_vectort evaluate(const exprt &)
Evaluate an expression.
void execute_assign()
executes the assign statement at the current pc value
std::map< irep_idt, exprt > input_valuest
list_input_varst function_input_vars
void assign(const mp_integer &address, const mp_vectort &rhs)
sets the memory at address with the given rhs value (up to sizeof(rhs))
std::stack< stack_framet > call_stackt
const inverse_memory_mapt::value_type & address_to_object_record(const mp_integer &address) const
const dynamic_typest & get_dynamic_types()
std::vector< function_assignmentt > function_assignmentst
void allocate(const mp_integer &address, const mp_integer &size)
reserves memory block of size at address
typet concretize_type(const typet &type)
turns a variable length array type into a fixed array type
void read(const mp_integer &address, mp_vectort &dest) const
Reads a memory address and loads it into the dest variable.
mp_integer address_to_offset(const mp_integer &address) const
const symbol_table_baset & symbol_table
void step()
executes a single step and updates the program counter
std::unordered_map< irep_idt, mp_integer > memory_mapt
interpretert(const symbol_table_baset &_symbol_table, const goto_functionst &_goto_functions, message_handlert &_message_handler)
bool count_type_leaves(const typet &source_type, mp_integer &result)
Count the number of leaf subtypes of ty, a leaf type is a type that is not an array or a struct.
struct_typet::componentt get_component(const typet &object_type, const mp_integer &offset)
Retrieves the member at offset of an object of type object_type.
mp_integer base_address_to_alloc_size(const mp_integer &address) const
goto_programt::const_targett next_pc
bool evaluate_boolean(const exprt &expr)
mp_integer get_size(const typet &type)
Retrieves the actual size of the provided structured type.
void show_state()
displays the current position of the pc and corresponding code
void initialize(bool init)
Initializes the memory map of the interpreter and [optionally] runs up to the entry point (thus doing...
bool unbounded_size(const typet &)
void execute_other()
executes side effects of 'other' instructions
bool memory_offset_to_byte_offset(const typet &source_type, const mp_integer &cell_offset, mp_integer &result)
Similarly to the above, the interpreter's memory objects contain mp_integers that represent variable-...
std::map< irep_idt, typet > dynamic_typest
void read_unbounded(const mp_integer &address, mp_vectort &dest) const
goto_programt::const_targett pc
dynamic_typest dynamic_types
typet get_type(const irep_idt &id) const
returns the type object corresponding to id
const goto_functionst & goto_functions
std::pair< const irep_idt, const irep_idt > struct_member_idt
std::pair< irep_idt, irep_idt > assignment_idt
Class that provides messages with a built-in verbosity 'level'.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
const_iteratort find(uint64_t idx)
Expression to hold a symbol (variable)
The symbol table base class interface.
The type of an expression, extends irept.
Goto Programs with Functions.
#define CHECK_RETURN(CONDITION)
#define PRECONDITION(CONDITION)
irep_idt calling_function
function_assignmentst param_assignments
function_assignmentst exception_assignments
function_assignmentst return_assignments