Skip to content

extend plain trace to show function calls and returns #2516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions regression/cbmc/hex_trace/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
int main()
{
int a;
unsigned int b;
a = 0;
a = -100;
a = 2147483647;
b = a*2;
a = -2147483647;
__CPROVER_assert(0,"");

}
14 changes: 14 additions & 0 deletions regression/cbmc/hex_trace/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CORE
main.c
--trace-hex --trace
^EXIT=10$
^SIGNAL=0$
a=0 \s*\(0x0\)
b=0ul? \s*\(0x0\)
a=-100 \s*\(0xFFFFFF9C\)
a=2147483647 \s*\(0x7FFFFFFF\)
b=4294967294ul? \s*\(0xFFFFFFFE\)
a=-2147483647 \s*\(0x80000001\)
^VERIFICATION FAILED$
--
^warning: ignoring
23 changes: 23 additions & 0 deletions regression/cbmc/trace_show_code/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
int function_to_call(int a)
{
int local = 1;
return a+local;
}


int main()
{
int a, c;
unsigned int b;
a = 0;
c = -100;
a = function_to_call(a) + function_to_call(c);
if(a < 0)
b = function_to_call(b);

if(c < 0)
b = -function_to_call(b);

__CPROVER_assert(0,"");

}
19 changes: 19 additions & 0 deletions regression/cbmc/trace_show_code/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CORE
main.c
--trace --trace-show-code
^EXIT=10$
^SIGNAL=0$
local = 1
int a
int c
unsigned int b
a = 0;
c = -100;
function_to_call\(a\)
function_to_call\(c\)
a = return_value_function_to_call \+ return_value_function_to_call
function_to_call\(\(signed int\)b\)
b = \(unsigned int\)return_value_function_to_call
^VERIFICATION FAILED$
--
^warning: ignoring
22 changes: 22 additions & 0 deletions regression/cbmc/trace_show_function_calls/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
int function_to_call(int a)
{
int local = 1;
return a+local;
}


int main()
{
int a;
unsigned int b;
a = 0;
a = -100;
a = 2147483647;
b = a*2;
a = -2147483647;
a = function_to_call(a);
b = function_to_call(b);

__CPROVER_assert(0,"");

}
11 changes: 11 additions & 0 deletions regression/cbmc/trace_show_function_calls/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--trace --trace-show-function-calls
^EXIT=10$
^SIGNAL=0$
Function call: function_to_call \(depth 2\)
Function return: function_to_call \(depth 1\)
Function call: function_to_call \(depth 2\)
^VERIFICATION FAILED$
--
^warning: ignoring
3 changes: 2 additions & 1 deletion src/cbmc/all_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ void bmc_all_propertiest::report(const cover_goalst &cover_goals)
if(g.second.status==goalt::statust::FAILURE)
{
result() << "\n" << "Trace for " << g.first << ":" << "\n";
show_goto_trace(result(), bmc.ns, g.second.goto_trace);
show_goto_trace(
result(), bmc.ns, g.second.goto_trace, bmc.trace_options());
}
}
result() << eom;
Expand Down
2 changes: 1 addition & 1 deletion src/cbmc/bmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void bmct::error_trace()
{
case ui_message_handlert::uit::PLAIN:
result() << "Counterexample:" << eom;
show_goto_trace(result(), ns, goto_trace);
show_goto_trace(result(), ns, goto_trace, trace_options());
result() << eom;
break;

Expand Down
Loading