From 0d956dca26e2b48f3bf5f61450ed4a73c3ce6a1b Mon Sep 17 00:00:00 2001 From: Thulinma Date: Mon, 7 Dec 2020 20:15:46 +0100 Subject: [PATCH] Improvements to MistUtilRAX --- lib/util.cpp | 2 ++ src/utils/util_rax.cpp | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/util.cpp b/lib/util.cpp index 0dc5e5dd..3c7c247e 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -569,6 +569,8 @@ namespace Util{ std::stringstream r; uint64_t delled = getDeleted(); uint64_t max = getEndPos(); + if (max - delled > getRCount()){max = delled + getRCount();} + if (max == 0){max = getRCount();} r << std::string(indent, ' ') << "RelAccX: " << getRCount() << " x " << getRSize() << "b @" << getOffset() << " (#" << getDeleted() << " - #" << getEndPos() - 1 << ")" << std::endl; for (uint64_t i = delled; i < max; ++i){ diff --git a/src/utils/util_rax.cpp b/src/utils/util_rax.cpp index 08c8e146..f586d9de 100644 --- a/src/utils/util_rax.cpp +++ b/src/utils/util_rax.cpp @@ -10,9 +10,8 @@ int main(int argc, char **argv){ } IPC::sharedPage f(argv[1], 0, false, false); const Util::RelAccX A(f.mapped, false); - if (A.isReady()){ - std::cout << A.toPrettyString() << std::endl; - }else{ + if (!A.isReady()){ std::cout << "Memory structure " << argv[1] << " is not ready" << std::endl; } + std::cout << A.toPrettyString() << std::endl; }