diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-07-20 16:46:38 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-07-20 16:46:38 +0800 |
commit | b105e1ef0310454a96899d5fb815257a7fda88f0 (patch) | |
tree | 3907f89ad928d4edcd6ca876ee0313378b00fe5b | |
parent | 49a3ab205b9fc5b6ae64c928071cb40ca1b0ce50 (diff) | |
download | mrust-b105e1ef0310454a96899d5fb815257a7fda88f0.tar.gz |
standalone_miri - Improved logging for allocation tags
-rw-r--r-- | tools/standalone_miri/miri.cpp | 2 | ||||
-rw-r--r-- | tools/standalone_miri/value.cpp | 16 | ||||
-rw-r--r-- | tools/standalone_miri/value.hpp | 5 |
3 files changed, 16 insertions, 7 deletions
diff --git a/tools/standalone_miri/miri.cpp b/tools/standalone_miri/miri.cpp index 3d28c542..d9402aa3 100644 --- a/tools/standalone_miri/miri.cpp +++ b/tools/standalone_miri/miri.cpp @@ -1459,6 +1459,7 @@ bool InterpreterThread::step_one(Value& out_thread_result) if( !this->call_path(rv, *fcn_p, ::std::move(sub_args)) ) { // Early return, don't want to update stmt_idx yet + LOG_DEBUG("- Non-immediate return, do not advance yet"); return false; } } @@ -1534,6 +1535,7 @@ InterpreterThread::StackFrame::StackFrame(const Function& fcn, ::std::vector<Val bb_idx(0), stmt_idx(0) { + LOG_DEBUG("- Initializing " << fcn.m_mir.locals.size() << " locals"); this->locals.reserve( fcn.m_mir.locals.size() ); for(const auto& ty : fcn.m_mir.locals) { diff --git a/tools/standalone_miri/value.cpp b/tools/standalone_miri/value.cpp index 3a479bce..4318d289 100644 --- a/tools/standalone_miri/value.cpp +++ b/tools/standalone_miri/value.cpp @@ -13,6 +13,12 @@ #include <algorithm> #include "debug.hpp" +::std::ostream& operator<<(::std::ostream& os, const Allocation* x) +{ + os << "A(" << static_cast<const void*>(x) << " " << x->tag() << ")"; + return os; +} + FfiLayout FfiLayout::new_const_bytes(size_t s) { return FfiLayout { @@ -53,6 +59,7 @@ AllocationHandle Allocation::new_alloc(size_t size, ::std::string tag) rv->data.resize( (size + 8-1) / 8 ); // QWORDS rv->mask.resize( (size + 8-1) / 8 ); // bitmap bytes //LOG_DEBUG(rv << " ALLOC"); + LOG_DEBUG(rv); return AllocationHandle(rv); } AllocationHandle::AllocationHandle(const AllocationHandle& x): @@ -319,11 +326,6 @@ void Allocation::check_bytes_valid(size_t ofs, size_t size) const } } } -::std::ostream& operator<<(::std::ostream& os, const Allocation* x) -{ - os << static_cast<const void*>(x) << " A(" << x->tag() << ")"; - return os; -} void Allocation::mark_bytes_valid(size_t ofs, size_t size) { assert( ofs+size <= this->mask.size() * 8 ); @@ -868,7 +870,7 @@ extern ::std::ostream& operator<<(::std::ostream& os, const ValueRef& v) case RelocationPtr::Ty::Allocation: { const auto& alloc = alloc_ptr.alloc(); - os << "A(" << alloc.tag() << ")@" << v.m_offset << "+" << v.m_size << " "; + os << &alloc << "@" << v.m_offset << "+" << v.m_size << " "; auto flags = os.flags(); os << ::std::hex; @@ -923,7 +925,7 @@ extern ::std::ostream& operator<<(::std::ostream& os, const ValueRef& v) { const auto& alloc = *v.m_value->allocation; - os << "A(" << alloc.tag() << ")@" << v.m_offset << "+" << v.m_size << " "; + os << &alloc << "@" << v.m_offset << "+" << v.m_size << " "; auto flags = os.flags(); os << ::std::hex; diff --git a/tools/standalone_miri/value.hpp b/tools/standalone_miri/value.hpp index 8db17f03..59a570f0 100644 --- a/tools/standalone_miri/value.hpp +++ b/tools/standalone_miri/value.hpp @@ -303,6 +303,11 @@ struct Value: Value(); Value(::HIR::TypeRef ty); + //Value(const Value&) = delete; + //Value(Value&&) = default; + //Value& operator=(const Value&) = delete; + //Value& operator=(Value&&) = default; + static Value with_size(size_t size, bool have_allocation); static Value new_fnptr(const ::HIR::Path& fn_path); static Value new_ffiptr(FFIPointer ffi); |