Skip to content

Commit 0976572

Browse files
Pass shadow_memory to symex_assignt
We need to call the shadow memory instrumentation API from there.
1 parent e2639a5 commit 0976572

File tree

7 files changed

+42
-13
lines changed

7 files changed

+42
-13
lines changed

src/goto-symex/goto_symex.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void goto_symext::symex_assign(
104104
assignment_type = symex_targett::assignment_typet::HIDDEN;
105105

106106
symex_assignt symex_assign{
107-
state, assignment_type, ns, symex_config, target};
107+
shadow_memory, state, assignment_type, ns, symex_config, target};
108108

109109
// Try to constant propagate potential side effects of the assignment, when
110110
// simplification is turned on and there is one thread only. Constant
@@ -118,8 +118,9 @@ void goto_symext::symex_assign(
118118
}
119119

120120
exprt::operandst lhs_if_then_else_conditions;
121-
symex_assign.assign_rec(
122-
lhs, expr_skeletont{}, rhs, lhs_if_then_else_conditions);
121+
symex_assignt{
122+
shadow_memory, state, assignment_type, ns, symex_config, target}
123+
.assign_rec(lhs, expr_skeletont{}, rhs, lhs_if_then_else_conditions);
123124
}
124125
}
125126

src/goto-symex/symex_assign.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "symex_assign.h"
1313

14-
#include "expr_skeleton.h"
15-
#include "goto_symex_state.h"
1614
#include <util/byte_operators.h>
1715
#include <util/expr_util.h>
16+
#include <util/pointer_expr.h>
1817
#include <util/range.h>
1918

20-
#include "symex_config.h"
19+
#include "c_types.h"
20+
#include "expr_skeleton.h"
21+
#include "goto_symex_state.h"
2122

2223
// We can either use with_exprt or update_exprt when building expressions that
2324
// modify components of an array or a struct. Set USE_UPDATE to use

src/goto-symex/symex_assign.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ Author: Romain Brenguier, [email protected]
1212
#ifndef CPROVER_GOTO_SYMEX_SYMEX_ASSIGN_H
1313
#define CPROVER_GOTO_SYMEX_SYMEX_ASSIGN_H
1414

15-
#include "symex_target.h"
1615
#include <util/expr.h>
1716

17+
#include "goto_symex.h"
18+
#include "shadow_memory.h"
19+
#include "symex_target.h"
20+
1821
class byte_extract_exprt;
1922
class expr_skeletont;
2023
class goto_symex_statet;
@@ -26,12 +29,14 @@ class symex_assignt
2629
{
2730
public:
2831
symex_assignt(
32+
shadow_memoryt &shadow_memory,
2933
goto_symex_statet &state,
3034
symex_targett::assignment_typet assignment_type,
3135
const namespacet &ns,
3236
const symex_configt &symex_config,
3337
symex_targett &target)
34-
: state(state),
38+
: shadow_memory(shadow_memory),
39+
state(state),
3540
assignment_type(assignment_type),
3641
ns(ns),
3742
symex_config(symex_config),
@@ -56,6 +61,7 @@ class symex_assignt
5661
exprt::operandst &guard);
5762

5863
private:
64+
shadow_memoryt &shadow_memory;
5965
goto_symex_statet &state;
6066
symex_targett::assignment_typet assignment_type;
6167
const namespacet &ns;

src/goto-symex/symex_clean_expr.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ void goto_symext::lift_let(statet &state, const let_exprt &let_expr)
184184

185185
exprt::operandst value_assignment_guard;
186186
symex_assignt{
187-
state, symex_targett::assignment_typet::HIDDEN, ns, symex_config, target}
187+
shadow_memory,
188+
state,
189+
symex_targett::assignment_typet::HIDDEN,
190+
ns,
191+
symex_config,
192+
target}
188193
.assign_symbol(
189194
to_ssa_expr(state.rename<L1>(let_expr.symbol(), ns).get()),
190195
expr_skeletont{},

src/goto-symex/symex_dereference.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,12 @@ goto_symext::cache_dereference(exprt &dereference_result, statet &state)
230230
lift_lets(state, cache_value);
231231

232232
auto assign = symex_assignt{
233-
state, symex_targett::assignment_typet::STATE, ns, symex_config, target};
233+
shadow_memory,
234+
state,
235+
symex_targett::assignment_typet::STATE,
236+
ns,
237+
symex_config,
238+
target};
234239

235240
auto cache_symbol_expr = cache_symbol.symbol_expr();
236241
assign.assign_symbol(

src/goto-symex/symex_function_call.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ void goto_symext::parameter_assignments(
130130
rhs = clean_expr(std::move(rhs), state, false);
131131

132132
exprt::operandst lhs_conditions;
133-
symex_assignt{state, assignment_type, ns, symex_config, target}
133+
symex_assignt{
134+
shadow_memory, state, assignment_type, ns, symex_config, target}
134135
.assign_rec(lhs, expr_skeletont{}, rhs, lhs_conditions);
135136
}
136137

src/goto-symex/symex_start_thread.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ void goto_symext::symex_start_thread(statet &state)
9494
exprt::operandst lhs_conditions;
9595
state.record_events.push(false);
9696
symex_assignt{
97-
state, symex_targett::assignment_typet::HIDDEN, ns, symex_config, target}
97+
shadow_memory,
98+
state,
99+
symex_targett::assignment_typet::HIDDEN,
100+
ns,
101+
symex_config,
102+
target}
98103
.assign_symbol(lhs_l1, expr_skeletont{}, rhs, lhs_conditions);
99104
const exprt l2_lhs = state.rename(lhs_l1, ns).get();
100105
state.record_events.pop();
@@ -140,7 +145,12 @@ void goto_symext::symex_start_thread(statet &state)
140145

141146
exprt::operandst lhs_conditions;
142147
symex_assignt{
143-
state, symex_targett::assignment_typet::HIDDEN, ns, symex_config, target}
148+
shadow_memory,
149+
state,
150+
symex_targett::assignment_typet::HIDDEN,
151+
ns,
152+
symex_config,
153+
target}
144154
.assign_symbol(lhs, expr_skeletont{}, rhs, lhs_conditions);
145155
}
146156
}

0 commit comments

Comments
 (0)