From 86670d8f1bce6f56be949e1d255c593f68b795cf Mon Sep 17 00:00:00 2001 From: Nav Date: Tue, 18 Jul 2023 22:27:50 +0100 Subject: [PATCH] Fixed difference count bug in snapshot diff viewer --- .../SnapshotDiff/SnapshotDiff.cpp | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.cpp index 522255c3..079ca29f 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.cpp @@ -316,13 +316,29 @@ namespace Bloom::Widgets const auto& dataA = *(this->hexViewerDataA); const auto& dataB = *(this->hexViewerDataB); + static const auto isAddressExcluded = [this] (Targets::TargetMemoryAddress address) { + for (const auto& excludedRegion : this->excludedRegionsA) { + if (excludedRegion.addressRange.contains(address)) { + return true; + } + } + + for (const auto& excludedRegion : this->excludedRegionsB) { + if (excludedRegion.addressRange.contains(address)) { + return true; + } + } + + return false; + }; + const auto& memoryStartAddress = this->memoryDescriptor.addressRange.startAddress; for (Targets::TargetMemoryBuffer::size_type i = 0; i < dataA.size(); ++i) { - if (dataA[i] != dataB[i]) { - this->differentialHexViewerSharedState.differences.insert( - memoryStartAddress + static_cast(i) - ); + const auto address = memoryStartAddress + static_cast(i); + + if (dataA[i] != dataB[i] && !isAddressExcluded(address)) { + this->differentialHexViewerSharedState.differences.insert(address); } }