This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] exploded-graph-rewriter: Implement a --diff mode.
ClosedPublic

Authored by NoQ on May 31 2019, 5:04 PM.

Details

Summary

Implement a mode in which the rewriter prints differences between adjacent program states rather than the whole states. The whole state is still printed for nodes with multiple predecessors (because merge diffs were annoying to implement and it's still nice to have the full state occasionally) and for leaf nodes (because they're the important ones).

The diffs are computed "semantically" as opposed to plain text diffs. I.e., the diff algorithm is hand-crafted separately for every state trait, taking the underlying data structures into account. This is especially nice for Environment because textual diffs would have been terrible. This, of course, produces quite some boilerplate, but i think it's isolated enough to not bother me that much.

Diff Detail

Repository
rL LLVM

Event Timeline

NoQ created this revision.May 31 2019, 5:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2019, 5:04 PM
NoQ added a comment.May 31 2019, 5:04 PM

I'll add some tests as soon as i'm sure tests for this thing actually work (by landing D62638).

NoQ updated this revision to Diff 202514.May 31 2019, 5:11 PM

Remove "-" from program point dumps because it resembles a removal marker in diffs.

In D62761#1525917, @NoQ wrote:

Remove "-" from program point dumps because it resembles a removal marker in diffs.

Could you add an image? I have not seen any problematic stuff, just that.

NoQ added a comment.Jun 11 2019, 4:54 PM
In D62761#1525917, @NoQ wrote:

Remove "-" from program point dumps because it resembles a removal marker in diffs.

Could you add an image? I have not seen any problematic stuff, just that.


The minus signs in "Program points: - one - two - three" are confusing.

Charusso accepted this revision.Jun 11 2019, 4:57 PM

I asked for the new behavior, but I think it should be cool.

This revision is now accepted and ready to land.Jun 11 2019, 4:57 PM
NoQ added a comment.Jun 11 2019, 5:00 PM

I asked for the new behavior, but I think it should be cool.

The new behavior is on the original screenshot, i just uploaded the wrong patch initially >.<

In D62761#1539143, @NoQ wrote:

I asked for the new behavior, but I think it should be cool.

The new behavior is on the original screenshot, i just uploaded the wrong patch initially >.<

No problem, thanks for the screenshot and for the clarification!

NoQ marked an inline comment as done.Jun 14 2019, 2:24 PM
NoQ added inline comments.
clang/utils/analyzer/exploded-graph-rewriter.py
170–171 ↗(On Diff #202514)

This is broken due to possible collisions in cluster keys (eg., two variables with the same name but different scopes).
I guess i'll have to add a unique key to the cluster dump, i.e., a MemRegion pointer.

Charusso marked an inline comment as done.Jun 14 2019, 2:41 PM
Charusso added inline comments.
clang/utils/analyzer/exploded-graph-rewriter.py
170–171 ↗(On Diff #202514)

It is a good idea, thanks for fixing these errors!

Szelethus set the repository for this revision to rC Clang.Jun 16 2019, 8:44 AM
NoQ updated this revision to Diff 205177.Jun 17 2019, 1:53 PM

Add tests, rebase.

Charusso added inline comments.Jun 17 2019, 1:59 PM
clang/utils/analyzer/exploded-graph-rewriter.py
287 ↗(On Diff #205177)

Ugh, wait with that a little-bit. I have forgot to create a patch! We have to escape the escapes.
E.g. "\x42" -> "\\x42".

NoQ marked an inline comment as done.Jun 17 2019, 2:00 PM
NoQ added inline comments.
clang/utils/analyzer/exploded-graph-rewriter.py
287 ↗(On Diff #205177)

Yay!

Charusso accepted this revision.Jun 17 2019, 4:16 PM
Charusso marked an inline comment as done.

Thanks for the main development! Could I start to reduce the size with my SVG-magic? What do you think about make it more SVG-based on the styling side?

clang/utils/analyzer/exploded-graph-rewriter.py
375 ↗(On Diff #202514)

Good catch!

NoQ updated this revision to Diff 205443.Jun 18 2019, 2:59 PM

Don't try to sneak in an unrelated change.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2019, 4:32 PM