-
Notifications
You must be signed in to change notification settings - Fork 277
added --compact-trace option [blocks: #3459] #3458
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
Conversation
847d368
to
36768b6
Compare
src/goto-programs/goto_trace.cpp
Outdated
// show pretty name until first '(' | ||
const auto &f_symbol = ns.lookup(step.called_function); | ||
const auto display_name = id2string(f_symbol.display_name()); | ||
const std::size_t open_par_pos = display_name.find('('); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the idea behind this filtering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A pretty name might be some_function(int, int); we want to show some_function(123, 456)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would the symbol's name include the type of the arguments? Is that in case of templates? But then operator()
would not be handled correctly. I feel I'm missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will drop for now
src/goto-programs/goto_trace.cpp
Outdated
const trace_optionst &options) | ||
{ | ||
// unsigned prev_step_nr=0; | ||
// bool first_step=true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -125,7 +125,21 @@ void goto_symext::parameter_assignments( | |||
} | |||
} | |||
|
|||
symex_assign(state, code_assignt(lhs, rhs)); | |||
assignment_typet assignment_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #3459 it says that this PR might be a candidate to test this, but there isn't a test here either?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now there! (Note absence of assignments to parameters in the trace).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test just seems to test what should be there, but does not have any pattern describing strings that should not occur (other than the usual "warning: ignoring")?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will revert to the state without #3459, and will then add the test there (after this one here is merged). The diff is then obvious.
0a87ae5
to
cfc1954
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: cfc1954).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92451767
cfc1954
to
bc61922
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: bc61922).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92461159
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various minor notes, otherwise looks ok.
if( | ||
step.assignment_type == | ||
goto_trace_stept::assignment_typet::ACTUAL_PARAMETER) | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Braces, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
cmdline.isset("trace") || cmdline.isset("stack-trace") || | ||
cmdline.isset("stop-on-fail")) | ||
cmdline.isset("trace") || cmdline.isset("compact-trace") || | ||
cmdline.isset("stack-trace") || cmdline.isset("stop-on-fail")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add braces for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/goto-programs/goto_trace.cpp
Outdated
if(!step.pc->source_location.is_nil()) | ||
{ | ||
out << " " << state_location(step, ns) << '\n'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No braces needed (usually a nit pick, but here it's inconsistent with a few lines further down).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
{ | ||
// show pretty name | ||
const auto &f_symbol = ns.lookup(step.called_function); | ||
out << f_symbol.display_name(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the above comment might just add confusion: symbolt
has a pretty_name
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
case goto_trace_stept::typet::CONSTRAINT: | ||
case goto_trace_stept::typet::SHARED_READ: | ||
case goto_trace_stept::typet::SHARED_WRITE: | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
7603bec
to
3b3e027
Compare
src/goto-programs/goto_trace.cpp
Outdated
|
||
case goto_trace_stept::typet::FUNCTION_CALL: | ||
// downwards arrow | ||
out << "\n" << messaget::faint << u8"\u21b3" << messaget::reset << ' '; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be '\n'
out << '('; | ||
|
||
{ | ||
bool first = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡
The pattern is very simple, but given the number of times we have this in the code base, it could be worth introducing something like this:
join(
step.function_arguments.begin(), step.function_arguments.end(),
[](arg) {out << from_expr(ns, step.function, arg);},
[]() {out << ", ";});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can already do this:
auto arg_strings = make_range(step.function_arguments).map<std::string>(
[&this](const exprt &arg) { return from_expr(ns, step.function, e); });
join_strings(out, arg_strings.begin(), arg_strings.end(), ", ");
And if the above works we should likely use it in lots of places :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The range type doesn't have a difference_type, and thus, that doesn't work.
Separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3b3e027
to
005bc12
Compare
This offers a denser way of viewing traces. The rationale is that traces are getting longer; furthermore, the new format makes it easier to spot function calls and the actual function parameters.
005bc12
to
b62ffe9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: b62ffe9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92941108
Uh oh!
There was an error while loading. Please reload this page.