@@ -200,6 +200,23 @@ void memory_snapshot_harness_generatort::add_init_section(
200
200
: start_it)));
201
201
}
202
202
203
+ const symbolt &memory_snapshot_harness_generatort::fresh_symbol_copy (
204
+ const symbolt &snapshot_symbol,
205
+ symbol_tablet &symbol_table) const
206
+ {
207
+ symbolt &tmp_symbol = get_fresh_aux_symbol (
208
+ snapshot_symbol.type ,
209
+ " " ,
210
+ id2string (snapshot_symbol.base_name ),
211
+ snapshot_symbol.location ,
212
+ snapshot_symbol.mode ,
213
+ symbol_table);
214
+ tmp_symbol.is_static_lifetime = true ;
215
+ tmp_symbol.value = snapshot_symbol.value ;
216
+
217
+ return tmp_symbol;
218
+ }
219
+
203
220
code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals (
204
221
const symbol_tablet &snapshot,
205
222
goto_modelt &goto_model) const
@@ -210,10 +227,16 @@ code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals(
210
227
code_blockt code;
211
228
for (const auto &pair : snapshot)
212
229
{
213
- const symbolt &symbol = pair.second ;
214
- if (!symbol .is_static_lifetime )
230
+ const symbolt &snapshot_symbol = pair.second ;
231
+ if (!snapshot_symbol .is_static_lifetime )
215
232
continue ;
216
233
234
+ symbol_tablet &symbol_table = goto_model.symbol_table ;
235
+ const symbolt &symbol =
236
+ (symbol_table.lookup (snapshot_symbol.base_name ) != nullptr )
237
+ ? snapshot_symbol
238
+ : fresh_symbol_copy (snapshot_symbol, symbol_table);
239
+
217
240
if (variables_to_havoc.count (symbol.base_name ) == 0 )
218
241
{
219
242
code.add (code_assignt{symbol.symbol_expr (), symbol.value });
0 commit comments