From adb450d1113c999b71e48f1c103d2f51ace5fd0d Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 10 Dec 2022 21:38:08 +0000 Subject: [PATCH] Set stale data flag in TargetMemoryInspectionPane, when the relevant memory type has been written to --- src/Insight/Insight.cpp | 11 +++++++++++ src/Insight/Insight.hpp | 1 + src/Insight/InsightSignals.hpp | 1 + .../TargetMemoryInspectionPane.cpp | 17 +++++++++++++++++ .../TargetMemoryInspectionPane.hpp | 4 ++++ 5 files changed, 34 insertions(+) diff --git a/src/Insight/Insight.cpp b/src/Insight/Insight.cpp index 4038bfcd..addd97ab 100644 --- a/src/Insight/Insight.cpp +++ b/src/Insight/Insight.cpp @@ -90,6 +90,10 @@ namespace Bloom std::bind(&Insight::onTargetRegistersWrittenEvent, this, std::placeholders::_1) ); + this->eventListener.registerCallbackForEventType( + std::bind(&Insight::onTargetMemoryWrittenEvent, this, std::placeholders::_1) + ); + this->eventListener.registerCallbackForEventType( std::bind(&Insight::onProgrammingModeEnabledEvent, this, std::placeholders::_1) ); @@ -338,6 +342,13 @@ namespace Bloom emit this->insightSignals->targetRegistersWritten(event.registers, event.createdTimestamp); } + void Insight::onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& event) { + emit this->insightSignals->targetMemoryWritten( + event.memoryType, + Targets::TargetMemoryAddressRange(event.startAddress, event.startAddress + (event.size - 1)) + ); + } + void Insight::onTargetControllerStateChangedEvent(const Events::TargetControllerStateChanged& event) { using TargetController::TargetControllerState; diff --git a/src/Insight/Insight.hpp b/src/Insight/Insight.hpp index 1a8db870..7957dbf9 100644 --- a/src/Insight/Insight.hpp +++ b/src/Insight/Insight.hpp @@ -123,6 +123,7 @@ namespace Bloom void onTargetResumedEvent(const Events::TargetExecutionResumed& event); void onTargetResetEvent(const Events::TargetReset& event); void onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event); + void onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& event); void onTargetControllerStateChangedEvent(const Events::TargetControllerStateChanged& event); void onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event); void onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event); diff --git a/src/Insight/InsightSignals.hpp b/src/Insight/InsightSignals.hpp index 68453623..475c23ae 100644 --- a/src/Insight/InsightSignals.hpp +++ b/src/Insight/InsightSignals.hpp @@ -33,6 +33,7 @@ namespace Bloom void targetStateUpdated(Bloom::Targets::TargetState newState); void targetReset(); void targetRegistersWritten(const Bloom::Targets::TargetRegisters& targetRegisters, const QDateTime& timestamp); + void targetMemoryWritten(Bloom::Targets::TargetMemoryType memoryType, Targets::TargetMemoryAddressRange addressRange); void targetControllerSuspended(); void targetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor); void programmingModeEnabled(); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp index 54976f15..3a310053 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp @@ -20,6 +20,7 @@ namespace Bloom::Widgets using Bloom::Targets::TargetMemoryDescriptor; using Bloom::Targets::TargetMemoryType; + using Bloom::Targets::TargetMemoryAddressRange; TargetMemoryInspectionPane::TargetMemoryInspectionPane( const TargetMemoryDescriptor& targetMemoryDescriptor, @@ -213,6 +214,13 @@ namespace Bloom::Widgets &TargetMemoryInspectionPane::onProgrammingModeDisabled ); + QObject::connect( + insightSignals, + &InsightSignals::targetMemoryWritten, + this, + &TargetMemoryInspectionPane::onTargetMemoryWritten + ); + // Restore the state if (this->state.attached) { this->attach(); @@ -511,6 +519,15 @@ namespace Bloom::Widgets this->refreshButton->setDisabled(disabled); } + void TargetMemoryInspectionPane::onTargetMemoryWritten( + TargetMemoryType memoryType, + TargetMemoryAddressRange addressRange + ) { + if (memoryType == this->targetMemoryDescriptor.type) { + this->setStaleData(this->data.has_value()); + } + } + void TargetMemoryInspectionPane::setStaleData(bool staleData) { this->staleData = staleData; this->staleDataLabelContainer->setVisible(this->staleData); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp index 1873e5ef..02fdc9f6 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp @@ -80,6 +80,10 @@ namespace Bloom::Widgets void onTargetReset(); void onProgrammingModeEnabled(); void onProgrammingModeDisabled(); + void onTargetMemoryWritten( + Bloom::Targets::TargetMemoryType memoryType, + Targets::TargetMemoryAddressRange addressRange + ); void setStaleData(bool staleData); }; }