Skip to content

Commit 8bea148

Browse files
Add stub for shadow memory instrumentation implementation
The actual implementation will be added incrementally in future PRs.
1 parent 5194a1f commit 8bea148

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

src/goto-symex/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ SRC = auto_objects.cpp \
1414
postcondition.cpp \
1515
precondition.cpp \
1616
renaming_level.cpp \
17+
shadow_memory.cpp \
1718
show_program.cpp \
1819
show_vcc.cpp \
1920
slice.cpp \

src/goto-symex/shadow_memory.cpp

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*******************************************************************\
2+
3+
Module: Symex Shadow Memory Instrumentation
4+
5+
Author: Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Symex Shadow Memory Instrumentation
11+
12+
#include "shadow_memory.h"
13+
14+
#include <util/fresh_symbol.h>
15+
16+
#include <langapi/language_util.h>
17+
18+
#include "goto_symex_state.h"
19+
20+
void shadow_memoryt::initialize_shadow_memory(
21+
goto_symex_statet &state,
22+
const exprt &expr,
23+
const shadow_memory_field_definitionst::field_definitiont &fields)
24+
{
25+
// To be implemented
26+
}
27+
28+
symbol_exprt shadow_memoryt::add_field(
29+
goto_symex_statet &state,
30+
const exprt &expr,
31+
const irep_idt &field_name,
32+
const typet &field_type)
33+
{
34+
// To be completed
35+
36+
const auto &function_symbol = ns.lookup(state.source.function_id);
37+
38+
symbolt &new_symbol = get_fresh_aux_symbol(
39+
field_type,
40+
id2string(state.source.function_id),
41+
SHADOW_MEMORY_PREFIX + from_expr(expr) + "__" + id2string(field_name),
42+
state.source.pc->source_location(),
43+
function_symbol.mode,
44+
state.symbol_table);
45+
46+
// Call some function on ns to silence the compiler in the meanwhile.
47+
ns.get_symbol_table();
48+
49+
return new_symbol.symbol_expr();
50+
}
51+
52+
void shadow_memoryt::symex_set_field(
53+
goto_symex_statet &state,
54+
const exprt::operandst &arguments)
55+
{
56+
// To be implemented
57+
}
58+
59+
void shadow_memoryt::symex_get_field(
60+
goto_symex_statet &state,
61+
const exprt &lhs,
62+
const exprt::operandst &arguments)
63+
{
64+
// To be implemented
65+
}
66+
67+
void shadow_memoryt::symex_field_static_init(
68+
goto_symex_statet &state,
69+
const ssa_exprt &lhs)
70+
{
71+
// To be implemented
72+
}
73+
74+
void shadow_memoryt::symex_field_static_init_string_constant(
75+
goto_symex_statet &state,
76+
const ssa_exprt &expr,
77+
const exprt &rhs)
78+
{
79+
// To be implemented
80+
}
81+
82+
void shadow_memoryt::symex_field_local_init(
83+
goto_symex_statet &state,
84+
const ssa_exprt &expr)
85+
{
86+
// To be implemented
87+
}
88+
89+
void shadow_memoryt::symex_field_dynamic_init(
90+
goto_symex_statet &state,
91+
const exprt &expr,
92+
const side_effect_exprt &code)
93+
{
94+
// To be implemented
95+
}
96+
97+
shadow_memory_field_definitionst shadow_memoryt::gather_field_declarations(
98+
abstract_goto_modelt &goto_model,
99+
message_handlert &message_handler)
100+
{
101+
// To be implemented
102+
103+
return shadow_memory_field_definitionst();
104+
}
105+
106+
void shadow_memoryt::convert_field_declaration(
107+
const code_function_callt &code_function_call,
108+
shadow_memory_field_definitionst::field_definitiont &fields)
109+
{
110+
// To be implemented
111+
}

0 commit comments

Comments
 (0)