Skip to content

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

Merged
merged 1 commit into from
Nov 8, 2018
Merged

Conversation

kroening
Copy link
Member

  • 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.

Copy link
Collaborator

@tautschnig tautschnig left a 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.

out << ' ';

const symbolt *function_symbol;
if(ns.lookup(source_location.get_function(), function_symbol))
Copy link
Collaborator

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.

@kroening kroening force-pushed the trace-function-name branch from 34db084 to 34f9ec1 Compare October 17, 2018 19:32
Copy link
Contributor

@allredj allredj left a 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

@kroening
Copy link
Member Author

Now with different approach, but same goal.

@kroening kroening assigned smowton and unassigned kroening Oct 20, 2018
@tautschnig
Copy link
Collaborator

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);
Copy link
Contributor

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)

@smowton
Copy link
Contributor

smowton commented Oct 21, 2018

Surely pretty vs., full name choices should be made in the pretty-printer rather than chosen when making the function symbols to begin with? goto_tracet::output has the namespace available, so if goto_tracet::stept::function_identifier was always a canonical name (i.e. in the namespace) that would seem like a natural place to choose to go for a particular representation

@kroening
Copy link
Member Author

Some discussion in #2149

@kroening
Copy link
Member Author

The current view is that the function (pretty name or identifier) should not be in source_locationt.
I.e., I will do a third, and entirely different approach to the goal of this PR.

@kroening
Copy link
Member Author

kroening commented Oct 23, 2018

A problem with that view is that gcc (not clang) prints error messages such as this:

x3.cpp: In function 'int main()':
x3.cpp:3:3: error: 'z' was not declared in this scope
   z;
   ^

This suggests use the pretty name.

@kroening kroening force-pushed the trace-function-name branch from 2d954a2 to 0610eaf Compare November 5, 2018 15:22
@kroening
Copy link
Member Author

kroening commented Nov 5, 2018

Here's yet another, completely new approach.

@kroening
Copy link
Member Author

kroening commented Nov 5, 2018

Please only review last commit.

{
if(!result.empty())
result += ' ';
result += " line " + id2string(source_location.get_line());
Copy link
Collaborator

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

Copy link
Member Author

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';
Copy link
Collaborator

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.

Copy link
Member Author

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.

@kroening kroening force-pushed the trace-function-name branch from 0610eaf to 1c44079 Compare November 5, 2018 15:37
@kroening kroening force-pushed the trace-function-name branch from 1c44079 to 1c4af7c Compare November 5, 2018 15:41
@tautschnig tautschnig assigned kroening and peterschrammel and unassigned smowton Nov 5, 2018
@kroening kroening force-pushed the trace-function-name branch 2 times, most recently from 0a08ee6 to 121ab0c Compare November 8, 2018 13:20
@kroening kroening force-pushed the trace-function-name branch from 121ab0c to 9375710 Compare November 8, 2018 13:52
Copy link
Contributor

@allredj allredj left a 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

@kroening kroening merged commit 4ecd33c into develop Nov 8, 2018
@kroening kroening deleted the trace-function-name branch November 8, 2018 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants