From 667ce0f1ef33c32fbe2d1836fc1b334066e244ca Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Sat, 25 Jun 2022 21:02:58 +0100 Subject: Improve the message for when large arrays become symbolic. Only print this warning once per array. Add test case. --- lib/Core/Memory.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp index f2f679ad..efc23612 100644 --- a/lib/Core/Memory.cpp +++ b/lib/Core/Memory.cpp @@ -375,19 +375,23 @@ ref ObjectState::read8(unsigned offset) const { } ref ObjectState::read8(ref offset) const { - assert(!isa(offset) && "constant offset passed to symbolic read8"); + assert(!isa(offset) && + "constant offset passed to symbolic read8"); unsigned base, size; fastRangeCheckOffset(offset, &base, &size); flushRangeForRead(base, size); - if (size>4096) { + if (size > 4096) { std::string allocInfo; object->getAllocInfo(allocInfo); - klee_warning_once(0, "flushing %d bytes on read, may be slow and/or crash: %s", - size, - allocInfo.c_str()); + klee_warning_once( + nullptr, + "Symbolic memory access will send the following array of %d bytes to " + "the constraint solver -- large symbolic arrays may cause significant " + "performance issues: %s", + size, allocInfo.c_str()); } - + return ReadExpr::create(getUpdates(), ZExtExpr::create(offset, Expr::Int32)); } @@ -413,19 +417,23 @@ void ObjectState::write8(unsigned offset, ref value) { } void ObjectState::write8(ref offset, ref value) { - assert(!isa(offset) && "constant offset passed to symbolic write8"); + assert(!isa(offset) && + "constant offset passed to symbolic write8"); unsigned base, size; fastRangeCheckOffset(offset, &base, &size); flushRangeForWrite(base, size); - if (size>4096) { + if (size > 4096) { std::string allocInfo; object->getAllocInfo(allocInfo); - klee_warning_once(0, "flushing %d bytes on read, may be slow and/or crash: %s", - size, - allocInfo.c_str()); + klee_warning_once( + nullptr, + "Symbolic memory access will send the following array of %d bytes to " + "the constraint solver -- large symbolic arrays may cause significant " + "performance issues: %s", + size, allocInfo.c_str()); } - + updates.extend(ZExtExpr::create(offset, Expr::Int32), value); } -- cgit 1.4.1