Skip to content

Commit 09dd4c4

Browse files
author
Daniel Kroening
committed
add arguments of function calls to goto_trace
1 parent 3304264 commit 09dd4c4

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

src/goto-programs/goto_trace.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ class goto_trace_stept
122122
// for function call/return
123123
irep_idt function_identifier;
124124

125+
// for function call
126+
std::vector<exprt> function_arguments;
127+
125128
/*! \brief outputs the trace step in ASCII to a given stream
126129
*/
127130
void output(

src/goto-symex/build_goto_trace.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,17 @@ void build_goto_trace(
304304
{
305305
goto_trace_step.lhs_object.make_nil();
306306
}
307+
307308
goto_trace_step.type = SSA_step.type;
308309
goto_trace_step.hidden = SSA_step.hidden;
309310
goto_trace_step.format_string = SSA_step.format_string;
310311
goto_trace_step.io_id = SSA_step.io_id;
311312
goto_trace_step.formatted = SSA_step.formatted;
312313
goto_trace_step.function_identifier = SSA_step.function_identifier;
314+
goto_trace_step.function_arguments = SSA_step.ssa_arguments;
315+
316+
for(auto &arg : goto_trace_step.function_arguments)
317+
arg = prop_conv.get(arg);
313318

314319
// update internal field for specific variables in the counterexample
315320
update_internal_field(SSA_step, goto_trace_step, ns);

src/goto-symex/symex_function_call.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,14 @@ void goto_symext::symex_function_call_code(
254254
return;
255255
}
256256

257+
// read the arguments -- before the locality renaming
258+
exprt::operandst arguments = call.arguments();
259+
for(auto &a : arguments)
260+
state.rename(a, ns);
261+
257262
// record the call
258-
target.function_call(state.guard.as_expr(), identifier, state.source);
263+
target.function_call(
264+
state.guard.as_expr(), identifier, arguments, state.source);
259265

260266
if(!goto_function.body_available())
261267
{
@@ -276,11 +282,6 @@ void goto_symext::symex_function_call_code(
276282
return;
277283
}
278284

279-
// read the arguments -- before the locality renaming
280-
exprt::operandst arguments=call.arguments();
281-
for(auto &a : arguments)
282-
state.rename(a, ns);
283-
284285
// produce a new frame
285286
PRECONDITION(!state.call_stack().empty());
286287
goto_symex_statet::framet &frame=state.new_frame();

src/goto-symex/symex_target.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ class symex_targett
105105
virtual void function_call(
106106
const exprt &guard,
107107
const irep_idt &function_identifier,
108-
const sourcet &source)=0;
108+
const std::vector<exprt> &ssa_arguments,
109+
const sourcet &source) = 0;
109110

110111
// record return from a function
111112
virtual void function_return(

src/goto-symex/symex_target_equation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ void symex_target_equationt::location(
210210
void symex_target_equationt::function_call(
211211
const exprt &guard,
212212
const irep_idt &function_identifier,
213+
const std::vector<exprt> &ssa_arguments,
213214
const sourcet &source)
214215
{
215216
SSA_steps.push_back(SSA_stept());
@@ -219,6 +220,7 @@ void symex_target_equationt::function_call(
219220
SSA_step.type = goto_trace_stept::typet::FUNCTION_CALL;
220221
SSA_step.source = source;
221222
SSA_step.function_identifier = function_identifier;
223+
SSA_step.ssa_arguments = ssa_arguments;
222224

223225
merge_ireps(SSA_step);
224226
}
@@ -705,6 +707,9 @@ void symex_target_equationt::merge_ireps(SSA_stept &SSA_step)
705707
for(auto &step : SSA_step.io_args)
706708
merge_irep(step);
707709

710+
for(auto &arg : SSA_step.ssa_arguments)
711+
merge_irep(arg);
712+
708713
// converted_io_args is merged in convert_io
709714
}
710715

src/goto-symex/symex_target_equation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class symex_target_equationt:public symex_targett
7575
virtual void function_call(
7676
const exprt &guard,
7777
const irep_idt &function_identifier,
78+
const std::vector<exprt> &ssa_arguments,
7879
const sourcet &source);
7980

8081
// record return from a function
@@ -232,6 +233,9 @@ class symex_target_equationt:public symex_targett
232233
// for function call/return
233234
irep_idt function_identifier;
234235

236+
// for function calls
237+
std::vector<exprt> ssa_arguments;
238+
235239
// for SHARED_READ/SHARED_WRITE and ATOMIC_BEGIN/ATOMIC_END
236240
unsigned atomic_section_id=0;
237241

0 commit comments

Comments
 (0)