This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] dump() environment frame-by-frame.
ClosedPublic

Authored by NoQ on Jan 25 2018, 12:09 PM.

Details

Summary

Like this:

Expressions by stack frame:
#0 Calling bar at line 9
(0x7fbe2a60ea10,0x7fbe2b86ca30) x : 1 S32b
#1 Calling foo
(0x7fbe2a60e2e0,0x7fbe2b86cc98) bar : &code{bar}
(0x7fbe2a60e2e0,0x7fbe2b86cce0) x : 0 S32b

Or in exploded graph:

This way it's instantly obvious which x is equal to 1 and which x is equal to 0.

Additionally, the separate section for the backtrace is removed from the graphviz dumps, and the respective code is deduplicated with LocationContext::dumpStack() which is also used for crash dumps.

It might be not clear where is the current location context in some cases (or annoying to supply location context every time you want to dump the program state - it is not even necessarily available), so i made a simple auto-detection of the freshest location context in which the environment has at least one entry, which would be run unless the context is specified explicitly.

The dump is a bit weird for blocks, but nevertheless it represents how the analyzer currently works:

Diff Detail

Repository
rL LLVM

Event Timeline

NoQ created this revision.Jan 25 2018, 12:09 PM
NoQ added a comment.Jan 25 2018, 1:32 PM

Also printing the location context pointer on every line is redundant, but putting it on the frame line would clamp up the crash dump with weird pointers and also make the frame lines in the state dump visually similar to the environment entry lines.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 8 2018, 2:29 PM
This revision was automatically updated to reflect the committed changes.