-
Notifications
You must be signed in to change notification settings - Fork 274
goto traces now show pretty function names #3194
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
kroening
commented
Oct 17, 2018
- Each commit message has a non-empty body, explaining why the change was made.
- n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
- Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
- n/a My commit message includes data points confirming performance improvements (if claimed).
- My PR is restricted to a single feature or bugfix.
- White-space or formatting changes outside the feature-related changed lines are in commits of their own.
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.
There is one (in my opinion: major) issue I have commented on below. Other than that I think we should consider moving this kind of code to source_locationt
rather than doing it in here as the very same should be useful in other places as well.
src/goto-programs/goto_trace.cpp
Outdated
out << ' '; | ||
|
||
const symbolt *function_symbol; | ||
if(ns.lookup(source_location.get_function(), function_symbol)) |
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 this is sort of a type error: source_location.get_function()
is what may be in the source code, but need not match what we use for symbol names. It may work, but I think we should not encourage more of this sort.
34db084
to
34f9ec1
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: 34f9ec1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88312033
34f9ec1
to
2d954a2
Compare
Now with different approach, but same goal. |
This reminds me of #2149 (review). We should probably turn this into a concerted effort. |
@@ -856,7 +856,7 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table) | |||
code_declt declare_cloned(local_symexpr); | |||
|
|||
source_locationt location; | |||
location.set_function(local_name); | |||
location.set_function(local_symbol.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.
This isn't a function name (clone_symbol
refers to a function name in this case)
Surely pretty vs., full name choices should be made in the pretty-printer rather than chosen when making the function symbols to begin with? |
Some discussion in #2149 |
The current view is that the function (pretty name or identifier) should not be in source_locationt. |
A problem with that view is that gcc (not clang) prints error messages such as this:
This suggests use the pretty name. |
2d954a2
to
0610eaf
Compare
Here's yet another, completely new approach. |
Please only review last commit. |
src/goto-programs/goto_trace.cpp
Outdated
{ | ||
if(!result.empty()) | ||
result += ' '; | ||
result += " line " + id2string(source_location.get_line()); |
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 the extra space before line
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
@@ -335,7 +366,10 @@ void show_full_goto_trace( | |||
out << '\n'; | |||
out << messaget::red << "Violated property:" << messaget::reset << '\n'; | |||
if(!step.pc->source_location.is_nil()) | |||
out << " " << step.pc->source_location << '\n'; | |||
{ | |||
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.
This will now have an extra thread number but I suppose that's ok.
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.
Yes; did contemplate that, and decided that this is desirable. There may well be a context switch just before the failing assertion.
0610eaf
to
1c44079
Compare
1c44079
to
1c4af7c
Compare
0a08ee6
to
121ab0c
Compare
121ab0c
to
9375710
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.
Diffblue compatibility check is currently unavailable.
Please create manual bump.
(cbmc commit: 9375710).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90721202