Skip to content

Symex propagation: add output function #3527

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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/goto-symex/goto_symex_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Author: Daniel Kroening, [email protected]
#include <util/base_exceptions.h>
#include <util/exception_utils.h>
#include <util/expr_util.h>
#include <util/format.h>
#include <util/format_expr.h>
#include <util/invariant.h>
#include <util/prefix.h>
#include <util/std_expr.h>
Expand Down Expand Up @@ -780,3 +782,14 @@ void goto_symex_statet::print_backtrace(std::ostream &out) const
}
}
}

/// Print the constant propagation map in a human-friendly format.
/// This is primarily for use from the debugger; please don't delete me just
/// because there aren't any current callers.
void goto_symex_statet::output_propagation_map(std::ostream &out)
Copy link
Member

Choose a reason for hiding this comment

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

Documentation appreciated, otherwise there's a risk that this will be removed as unused in the next clean up.

{
for(const auto &name_value : propagation)
{
out << name_value.first << " <- " << format(name_value.second) << "\n";
}
}
1 change: 1 addition & 0 deletions src/goto-symex/goto_symex_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class goto_symex_statet final

// Map L1 names to (L2) constants
std::map<irep_idt, exprt> propagation;
void output_propagation_map(std::ostream &);
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't access any private field so it should be a static function (ideally taking a map as input).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The field really ought to be private though (it's only used by goto_symext functions, and could/should be hidden), so I'm inclined to leave this as-is

Copy link
Contributor

Choose a reason for hiding this comment

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

Add documentation saying this is used for debugging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added


enum levelt { L0=0, L1=1, L2=2 };

Expand Down