Skip to content

Add a pretty printer for irept #4960

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

NathanJPhillips
Copy link
Contributor

This is the pretty printer for irept that I use. It works in GDB directly but not in CLion and is therefore not enabled in this PR (users can adjust the load_cbmc_printers function to enable it). @JohnDumbell is planning on doing a full pretty printer for irept soon so having this in the code base may be a useful first step.

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

@JohnDumbell
Copy link
Contributor

That's really useful, thanks! Did CLion give anything useful in regards to errors or just not work?

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

@NathanJPhillips
Copy link
Contributor Author

NathanJPhillips commented Jul 30, 2019

Example output:

(gdb) p generic_parameters
$1 = std::vector of length 2, capacity 2 = {
  {<reference_typet> = "pointer" = {
      [sub[0]] = "struct_tag" = {
        [named_sub["identifier"]] = "java::java.lang.Object", [named_sub["#base_name"]] = "java.lang.Object", 
        [named_sub["#java_generic_parameter"]] = "1", 
        [named_sub["type_variables"]] = "" = {
          [sub[0]] = "struct_tag" = {
            [named_sub["identifier"]] = "java::com.diffblue.regression.GenericOuter::K"}}}, 
      [named_sub["width"]] = "64", 
      [named_sub["#reference"]] = "1"}, <No data fields>}, {<reference_typet> = "pointer" = {
      [sub[0]] = "struct_tag" = {
        [named_sub["identifier"]] = "java::java.lang.Object", [named_sub["#base_name"]] = "java.lang.Object", 
        [named_sub["#java_generic_parameter"]] = "1", 
        [named_sub["type_variables"]] = "" = {
          [sub[0]] = "struct_tag" = {
            [named_sub["identifier"]] = "java::com.diffblue.regression.GenericOuter$GenericInner::T"}}}, 
      [named_sub["width"]] = "64", 
      [named_sub["#reference"]] = "1"}, <No data fields>}}

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.

This doesn't work correctly in CLion, but it looks to be a CLion bug as using p on gdb directly produces the expected result - nice!

It does however need adding so people get the advantage

@@ -1,6 +1,43 @@
import gdb


def deconstruct_dstring(val):
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ Probably would have been easier to review if the refactoring of printing dstring was separate to the introduction of irep printing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That might be slightly overkill - the changes can be read top-to-bottom - only the last hunk is not related to this refactoring.

@NathanJPhillips NathanJPhillips requested a review from thk123 August 12, 2019 09:25
@NathanJPhillips NathanJPhillips merged commit 36dc29a into develop Aug 13, 2019
@NathanJPhillips NathanJPhillips deleted the NathanJPhillips/feature/irep-pretty-printer branch August 13, 2019 09:25
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.

5 participants