Skip to content

Commit 25e3a47

Browse files
author
Enrico Steffinlongo
committed
Renamed shadow memory log guard
Renamed shadow memory log guard SM_DEBUG to SHADOW_MEMORY_DEBUG
1 parent 8c4acc1 commit 25e3a47

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

src/goto-symex/shadow_memory.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void shadow_memoryt::symex_set_field(
111111

112112
// get value set
113113
replace_invalid_object_by_null(expr);
114-
#ifdef DEBUG_SM
114+
#ifdef DEBUG_SHADOW_MEMORY
115115
log_set_field(ns, log, field_name, expr, value);
116116
#endif
117117
std::vector<exprt> value_set = state.value_set.get_value_set(expr, ns);
@@ -143,7 +143,7 @@ void shadow_memoryt::symex_set_field(
143143
<< messaget::eom;
144144
}
145145
const exprt lhs = deref_expr(*maybe_lhs);
146-
#ifdef DEBUG_SM
146+
#ifdef DEBUG_SHADOW_MEMORY
147147
log.debug() << "Shadow memory: LHS: " << format(lhs) << messaget::eom;
148148
#endif
149149
if(lhs.type().id() == ID_empty)
@@ -168,7 +168,7 @@ void shadow_memoryt::symex_set_field(
168168
expr_initializer(lhs.type(), expr.source_location(), ns, casted_rhs);
169169
CHECK_RETURN(per_byte_rhs.has_value());
170170

171-
#ifdef DEBUG_SM
171+
#ifdef DEBUG_SHADOW_MEMORY
172172
log.debug() << "Shadow memory: RHS: " << format(per_byte_rhs.value())
173173
<< messaget::eom;
174174
#endif
@@ -312,7 +312,7 @@ void shadow_memoryt::symex_get_field(
312312
log.debug() << "Shadow memory: mux size get_field: " << mux_size
313313
<< messaget::eom;
314314
}
315-
#ifdef DEBUG_SM
315+
#ifdef DEBUG_SHADOW_MEMORY
316316
log.debug() << "Shadow memory: RHS: " << format(rhs) << messaget::eom;
317317
#endif
318318
// TODO: create the assignment of __CPROVER_shadow_memory_get_field

src/goto-symex/shadow_memory_util.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ Author: Peter Schrammel
2323
#include <util/ssa_expr.h>
2424
#include <util/std_expr.h>
2525

26+
#include <langapi/language_util.h>
2627
#include <solvers/flattening/boolbv_width.h>
2728

28-
// TODO: change DEBUG_SM to DEBUG_SHADOW_MEMORY (it also appears in other files)
29-
3029
irep_idt extract_field_name(const exprt &string_expr)
3130
{
3231
if(can_cast_expr<typecast_exprt>(string_expr))
@@ -125,7 +124,7 @@ void log_value_set(
125124
const messaget &log,
126125
const std::vector<exprt> &value_set)
127126
{
128-
#ifdef DEBUG_SM
127+
#ifdef DEBUG_SHADOW_MEMORY
129128
log.conditional_output(
130129
log.debug(), [ns, value_set](messaget::mstreamt &mstream) {
131130
for(const auto &e : value_set)
@@ -145,7 +144,7 @@ void log_value_set_match(
145144
const exprt &expr,
146145
const value_set_dereferencet::valuet &shadow_dereference)
147146
{
148-
#ifdef DEBUG_SM
147+
#ifdef DEBUG_SHADOW_MEMORY
149148
log.conditional_output(
150149
log.debug(),
151150
[ns,
@@ -174,7 +173,7 @@ void log_value_set_match(
174173
const exprt &expr)
175174
{
176175
// Leave guards rename to DEBUG_SHADOW_MEMORY
177-
#ifdef DEBUG_SM
176+
#ifdef DEBUG_SHADOW_MEMORY
178177
log.conditional_output(
179178
log.debug(), [ns, address, expr](messaget::mstreamt &mstream) {
180179
mstream << "Shadow memory: value_set_match: " << format(address)
@@ -188,7 +187,7 @@ void log_try_shadow_address(
188187
const messaget &log,
189188
const shadow_memory_statet::shadowed_addresst &shadowed_address)
190189
{
191-
#ifdef DEBUG_SM
190+
#ifdef DEBUG_SHADOW_MEMORY
192191
log.conditional_output(
193192
log.debug(), [ns, shadowed_address](messaget::mstreamt &mstream) {
194193
mstream << "Shadow memory: trying shadowed address: "
@@ -203,7 +202,7 @@ void log_cond(
203202
const char *cond_text,
204203
const exprt &cond)
205204
{
206-
#ifdef DEBUG_SM
205+
#ifdef DEBUG_SHADOW_MEMORY
207206
log.conditional_output(
208207
log.debug(), [ns, cond_text, cond](messaget::mstreamt &mstream) {
209208
mstream << "Shadow memory: " << cond_text << ": " << format(cond)
@@ -218,7 +217,7 @@ static void log_are_types_incompatible(
218217
const shadow_memory_statet::shadowed_addresst &shadowed_address,
219218
const messaget &log)
220219
{
221-
#ifdef DEBUG_SM
220+
#ifdef DEBUG_SHADOW_MEMORY
222221
log.debug() << "Shadow memory: incompatible types "
223222
<< from_type(ns, "", expr.type()) << ", "
224223
<< from_type(ns, "", shadowed_address.address.type())
@@ -718,7 +717,7 @@ static value_set_dereferencet::valuet get_shadow_dereference(
718717
shadowed_object.object() = shadow;
719718
value_set_dereferencet::valuet shadow_dereference =
720719
value_set_dereferencet::build_reference_to(shadowed_object, expr, ns);
721-
#ifdef DEBUG_SM
720+
#ifdef DEBUG_SHADOW_MEMORY
722721
log.debug() << "Shadow memory: shadow-deref: "
723722
<< format(shadow_dereference.value) << messaget::eom;
724723
#endif
@@ -842,7 +841,7 @@ std::vector<std::pair<exprt, exprt>> get_shadow_dereference_candidates(
842841

843842
if(base_cond.is_true() && expr_cond.is_true())
844843
{
845-
#ifdef DEBUG_SM
844+
#ifdef DEBUG_SHADOW_MEMORY
846845
log.debug() << "exact match" << messaget::eom;
847846
#endif
848847
exact_match = true;
@@ -855,7 +854,7 @@ std::vector<std::pair<exprt, exprt>> get_shadow_dereference_candidates(
855854
{
856855
// No point looking at further shadow addresses
857856
// as only one of them can match.
858-
#ifdef DEBUG_SM
857+
#ifdef DEBUG_SHADOW_MEMORY
859858
log.debug() << "base match" << messaget::eom;
860859
#endif
861860
result.clear();
@@ -864,7 +863,7 @@ std::vector<std::pair<exprt, exprt>> get_shadow_dereference_candidates(
864863
}
865864
else
866865
{
867-
#ifdef DEBUG_SM
866+
#ifdef DEBUG_SHADOW_MEMORY
868867
log.debug() << "conditional match" << messaget::eom;
869868
#endif
870869
result.emplace_back(and_exprt(base_cond, expr_cond), value);
@@ -932,7 +931,7 @@ bool check_value_set_contains_only_null_ptr(
932931
if(value_set.size() == 1 && contains_null_or_invalid(value_set, null_pointer))
933932
{
934933
// TODO: duplicated in log_value_set_match
935-
#ifdef DEBUG_SM
934+
#ifdef DEBUG_SHADOW_MEMORY
936935
log.conditional_output(
937936
log.debug(), [ns, null_pointer, expr](messaget::mstreamt &mstream) {
938937
mstream << "Shadow memory: value set match: " << format(null_pointer)
@@ -963,7 +962,7 @@ get_shadow_memory_for_matched_object(
963962

964963
if(!are_types_compatible(expr.type(), shadowed_address.address.type()))
965964
{
966-
#ifdef DEBUG_SM
965+
#ifdef DEBUG_SHADOW_MEMORY
967966
log.debug() << "Shadow memory: incompatible types "
968967
<< from_type(ns, "", expr.type()) << ", "
969968
<< from_type(ns, "", shadowed_address.address.type())
@@ -1017,7 +1016,7 @@ get_shadow_memory_for_matched_object(
10171016

10181017
if(base_cond.is_true() && expr_cond.is_true())
10191018
{
1020-
#ifdef DEBUG_SM
1019+
#ifdef DEBUG_SHADOW_MEMORY
10211020
log.debug() << "exact match" << messaget::eom;
10221021
#endif
10231022
exact_match = true;
@@ -1030,7 +1029,7 @@ get_shadow_memory_for_matched_object(
10301029
{
10311030
// No point looking at further shadow addresses
10321031
// as only one of them can match.
1033-
#ifdef DEBUG_SM
1032+
#ifdef DEBUG_SHADOW_MEMORY
10341033
log.debug() << "base match" << messaget::eom;
10351034
#endif
10361035
result.clear();
@@ -1039,7 +1038,7 @@ get_shadow_memory_for_matched_object(
10391038
}
10401039
else
10411040
{
1042-
#ifdef DEBUG_SM
1041+
#ifdef DEBUG_SHADOW_MEMORY
10431042
log.debug() << "conditional match" << messaget::eom;
10441043
#endif
10451044
result.emplace_back(

src/goto-symex/shadow_memory_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Author: Peter Schrammel
1919

2020
#include "goto_symex_state.h" // IWYU pragma: keep
2121

22+
// To enable logging of Shadow Memory functions define DEBUG_SHADOW_MEMORY
23+
2224
class exprt;
2325
class typet;
2426

0 commit comments

Comments
 (0)