Skip to content

Commit bf717d3

Browse files
author
Daniel Kroening
committed
show function arguments in trace
1 parent 08cbe58 commit bf717d3

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

regression/cbmc/trace_show_function_calls/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ main.c
33
--trace --trace-show-function-calls
44
^EXIT=10$
55
^SIGNAL=0$
6-
Function call: function_to_call \(depth 2\)
6+
Function call: function_to_call\(-2147483647\) \(depth 2\)
77
Function return: function_to_call \(depth 1\)
8-
Function call: function_to_call \(depth 2\)
8+
Function call: function_to_call\(-2\) \(depth 2\)
99
^VERIFICATION FAILED$
1010
--
1111
^warning: ignoring

src/goto-programs/goto_trace.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,15 +444,34 @@ void show_goto_trace(
444444
case goto_trace_stept::typet::FUNCTION_CALL:
445445
function_depth++;
446446
if(options.show_function_calls)
447-
out << "\n#### Function call: " << step.function_identifier
448-
<< " (depth " << function_depth << ") ####\n";
447+
{
448+
out << "\n#### Function call: " << step.function_identifier;
449+
out << '(';
450+
451+
bool first = true;
452+
for(auto &arg : step.function_arguments)
453+
{
454+
if(first)
455+
first = false;
456+
else
457+
out << ", ";
458+
459+
out << from_expr(ns, step.function_identifier, arg);
460+
}
461+
462+
out << ") (depth " << function_depth << ") ####\n";
463+
}
449464
break;
465+
450466
case goto_trace_stept::typet::FUNCTION_RETURN:
451467
function_depth--;
452468
if(options.show_function_calls)
469+
{
453470
out << "\n#### Function return: " << step.function_identifier
454471
<< " (depth " << function_depth << ") ####\n";
472+
}
455473
break;
474+
456475
case goto_trace_stept::typet::SPAWN:
457476
case goto_trace_stept::typet::MEMORY_BARRIER:
458477
case goto_trace_stept::typet::ATOMIC_BEGIN:

0 commit comments

Comments
 (0)