-
Notifications
You must be signed in to change notification settings - Fork 277
Refinement iteration printing #5237
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
Refinement iteration printing #5237
Conversation
3faf008
to
c20f285
Compare
@@ -19,7 +19,8 @@ symex_bmc_incremental_one_loopt::symex_bmc_incremental_one_loopt( | |||
symex_target_equationt &target, | |||
const optionst &options, | |||
path_storaget &path_storage, | |||
guard_managert &guard_manager) | |||
guard_managert &guard_manager, | |||
ui_message_handlert::uit output_xml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the name could be made more accurate.
@@ -10,6 +10,7 @@ | |||
#define CPROVER_GOTO_CHECKER_SYMEX_BMC_INCREMENTAL_ONE_LOOP_H | |||
|
|||
#include "symex_bmc.h" | |||
#include <util/ui_message.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess you don't need this one anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed for ui_message_handlert::uit
declaration
c20f285
to
89203e2
Compare
@xbauch comments addressed |
xmlt xml("current-unwinding"); | ||
xml.data = std::to_string(unwind); | ||
log.statistics() << xml; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also output a current-unwinding
item for PLAIN
and JSON_UI
? So the same information is output independent of the ui.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
eb4bef2
to
019afa7
Compare
const std::string unwind_num = std::to_string(unwind); | ||
switch(output_ui) | ||
{ | ||
case ui_message_handlert::uit::PLAIN: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know there are a few other places in the codebase where this sort of switch happens, so I'm not going to block this PR on this issue :-) But it's really ugly in general... I'm wondering if we could come up with an API extension to message handlers. Perhaps some pseudo code like this:
/// Individual implementations inside message handlers
keyValueMessagePair(string[] words, string value) {
/// words == ["current","unwinding"]
/// output would be:
/// "Current unwinding: value" for PLAIN
/// xmlt xml("current-unwinding"); xml.data = value; for XML
/// json_objectt json; json["currentUnwinding"] = json_numbert(value); for JSON
}
// then as a client, we could just use:
log.statistics() << output_ui.keyValueMessagePair(["current","unwinding"],unwind) << messaget::eom;
Obviously suitable C++ plumbing needed :-) - but hopefully that explains the idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I started having a go at making just a general way of logging structured data, but didn't want to hold up this PR for t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a shame we have to do all the message handler faff, but thats an API gap, rather than anything specific to this PR, so ignoring that, I'm happy for this to go in.
I'm not totally convinced by my approach for finding out whether XML is turned on. I'm not really clear on why you can't always just pipe some xml to the message handler, and let it figure out what to do with it. (Ideally, for example, if you send xml to json-ui, then it outputs equivalent json)Went for something much simpler, might raise a seperate PR to make the handling of this stuff less ad-hoc.