Skip to content

Fix & enable irept pretty-printer #5031

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

Conversation

JohnDumbell
Copy link
Contributor

@JohnDumbell JohnDumbell commented Aug 15, 2019

Makes minor changes to the existing irept pretty-printer to make it work in CLion and then enable it. Marked as do-not-merge for now as I start using it locally to make sure there's no obvious problems.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • 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).
  • 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.

@thk123
Copy link
Contributor

thk123 commented Aug 15, 2019

AFAICT this doesn't print the .id() for ireps that have children - I think this is a bit of a problem - can we at least have it is as a fake entry in the children:

id symbol
[0] ..
[identifier] ...

?

Will definitely give this a play though!

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: 6e96ad5).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/123400062

@JohnDumbell
Copy link
Contributor Author

I'm going to make it so that it goes child: {id}, so:

0: symbol
statement: assignment

Means we can drop the fake child element, condense the tree a little and also add the missing info back in. Will make things much clearer, even if we are abusing the heck out of the pretty-printer at this stage.

Copy link
Contributor

@NathanJPhillips NathanJPhillips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but can we see the output in plain old GDB before approving?

# If we have no children it means we're actually a value node, so
# return the value of the node and a throw-away second value.
if sub_count == 0 and named_sub_count == 0:
yield (self.to_string(), self.val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just not return any children?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needed this originally, doesn't anymore so has been removed.

@JohnDumbell JohnDumbell force-pushed the jd/enhancement/pretty-printers branch from 6e96ad5 to 350ec40 Compare August 16, 2019 11:21
@JohnDumbell
Copy link
Contributor Author

JohnDumbell commented Aug 16, 2019

Pushed a change that means we get a more succinct tree in CLion, like so:

cleaned_pretty_printer

(Nodes with [...] can be expanded, quoted things are values)

But as the pretty-printer is an array it makes the p command in GDB directly a little less useful, as it omits any data about the position which we use to add more context:

{<exprt> = {<irept> = "code" = {"nil", "symbol" = {"code" = {"empty", "", "1"}, "__CPROVER_initialize"}, "arguments", "empty", "nil", "function_call"}, <No data fields>}, <No data fields>}

I'll try the map quickly and see if that can work, but I really like the way it looks right now.

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: 350ec40).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/123501029

@codecov-io
Copy link

codecov-io commented Aug 16, 2019

Codecov Report

Merging #5031 into develop will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5031   +/-   ##
========================================
  Coverage    69.71%   69.71%           
========================================
  Files         1322     1322           
  Lines       109429   109429           
========================================
  Hits         76287    76287           
  Misses       33142    33142
Impacted Files Coverage Δ
jbmc/src/java_bytecode/remove_java_new.cpp 98.47% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ea03e4...3a344a4. Read the comment docs.

@JohnDumbell
Copy link
Contributor Author

JohnDumbell commented Aug 16, 2019

I've added the option to switch between GDB/CLion pretty-printing mode as I didn't want to sacrifice either view. Example of the CLion mode is above, this is what GDB mode looks like:

$1 = {<exprt> = {<irept> = "code" = {[0] = "nil", [1] = "symbol" = {[type] = "code" = {[return_type] = "empty", [parameters] = "", [#java_method_type] = "1"}, [identifier] = "__CPROVER_initialize"}, [2] = "arguments", [type] = "empty", [#source_location] = "nil", [statement] = "function_call"}, <No data fields>}, <No data fields>}

@JohnDumbell JohnDumbell force-pushed the jd/enhancement/pretty-printers branch from 350ec40 to c749cd4 Compare August 16, 2019 12:29
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: c749cd4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/123508581

@@ -0,0 +1,3 @@
{
"clion_pretty_printers": true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline 😄

@JohnDumbell JohnDumbell force-pushed the jd/enhancement/pretty-printers branch from c749cd4 to 08b703a Compare September 17, 2019 16:07
@JohnDumbell
Copy link
Contributor Author

@thk123 Can I get an approval please, want to merge this soon. Owens been helping me test, and I've been able to use it personally for a few days and seems solid enough for general use.

Three things that are still on the to-do at this point:

  1. Fix instructiont properly. This might take a while.
  2. Make it so you don't have to expand a hierarchy to get the useful info. Shouldn't be too tricky, but it's a minor annoyance right now.
  3. Add an ID to the root node that mimics how it works otherwise ([symbol], etc), as it's the only piece of data that's not currently shown. (Adding a fake ID node to the top node is clumsy and fiddly, adding one to every node is just bloated, all other options require some experimentation which right now I don't have time for.

Copy link
Contributor

@thk123 thk123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Truly you are doing the Lords work. I just gave this a spin and it is amazing 😍

image

@JohnDumbell JohnDumbell force-pushed the jd/enhancement/pretty-printers branch from 08b703a to bfd2313 Compare September 19, 2019 09:25
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: bfd2313).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/128316637

@JohnDumbell JohnDumbell force-pushed the jd/enhancement/pretty-printers branch from c6f2844 to 3a344a4 Compare September 19, 2019 10:56
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.

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: c6f2844).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/128327640
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

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: 3a344a4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/128331097

@JohnDumbell JohnDumbell merged commit da454ce into diffblue:develop Sep 19, 2019
@owen-mc-diffblue owen-mc-diffblue deleted the jd/enhancement/pretty-printers branch September 19, 2019 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants