diff --git a/src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.cpp b/src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.cpp index 926eb87f..27e9d2e0 100644 --- a/src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.cpp +++ b/src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.cpp @@ -62,6 +62,7 @@ void CaptureMemorySnapshot::run(TargetControllerService& targetControllerService (memorySize - this->data->size()) >= readSize ? readSize : static_cast(memorySize - this->data->size()), + true, {} ); diff --git a/src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp b/src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp index 9580413b..bf67f86b 100644 --- a/src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp +++ b/src/Insight/InsightWorker/Tasks/ReadTargetMemory.cpp @@ -43,6 +43,7 @@ void ReadTargetMemory::run(TargetControllerService& targetControllerService) { (this->size - data.size()) >= readSize ? readSize : static_cast(this->size - data.size()), + true, this->excludedAddressRanges ); diff --git a/src/Services/TargetControllerService.cpp b/src/Services/TargetControllerService.cpp index a0f9e148..10370d16 100644 --- a/src/Services/TargetControllerService.cpp +++ b/src/Services/TargetControllerService.cpp @@ -183,6 +183,7 @@ namespace Services TargetMemoryType memoryType, TargetMemoryAddress startAddress, TargetMemorySize bytes, + bool bypassCache, const std::set& excludedAddressRanges ) const { return this->commandManager.sendCommandAndWaitForResponse( @@ -190,6 +191,7 @@ namespace Services memoryType, startAddress, bytes, + bypassCache, excludedAddressRanges ), this->defaultTimeout, diff --git a/src/Services/TargetControllerService.hpp b/src/Services/TargetControllerService.hpp index b0baac19..123e65ff 100644 --- a/src/Services/TargetControllerService.hpp +++ b/src/Services/TargetControllerService.hpp @@ -109,6 +109,7 @@ namespace Services * @param memoryType * @param startAddress * @param bytes + * @param bypassCache * @param excludedAddressRanges * @return */ @@ -116,6 +117,7 @@ namespace Services Targets::TargetMemoryType memoryType, Targets::TargetMemoryAddress startAddress, Targets::TargetMemorySize bytes, + bool bypassCache = false, const std::set& excludedAddressRanges = {} ) const; diff --git a/src/TargetController/Commands/ReadTargetMemory.hpp b/src/TargetController/Commands/ReadTargetMemory.hpp index b62f02e0..a22d7aa7 100644 --- a/src/TargetController/Commands/ReadTargetMemory.hpp +++ b/src/TargetController/Commands/ReadTargetMemory.hpp @@ -21,17 +21,25 @@ namespace TargetController::Commands Targets::TargetMemoryType memoryType; Targets::TargetMemoryAddress startAddress; Targets::TargetMemorySize bytes; + + /** + * Currently, we only cache program memory. This flag has no effect when reading from other memories. + */ + bool bypassCache; + std::set excludedAddressRanges; ReadTargetMemory( Targets::TargetMemoryType memoryType, Targets::TargetMemoryAddress startAddress, Targets::TargetMemorySize bytes, - const std::set& excludedAddressRanges + bool bypassCache = false, + const std::set& excludedAddressRanges = {} ) : memoryType(memoryType) , startAddress(startAddress) , bytes(bytes) + , bypassCache(bypassCache) , excludedAddressRanges(excludedAddressRanges) {}; diff --git a/src/TargetController/TargetControllerComponent.cpp b/src/TargetController/TargetControllerComponent.cpp index dcac939d..3510f119 100644 --- a/src/TargetController/TargetControllerComponent.cpp +++ b/src/TargetController/TargetControllerComponent.cpp @@ -802,6 +802,7 @@ namespace TargetController const auto& targetDescriptor = this->getTargetDescriptor(); if ( command.memoryType == targetDescriptor.programMemoryType + && !command.bypassCache && this->environmentConfig.targetConfig.programMemoryCache ) { assert(this->programMemoryCache);