Corrected bug where memory inspection panes were not automatically fetching data upon the first target halt

This commit is contained in:
Nav
2022-07-21 21:33:39 +01:00
parent 9d2625e8c4
commit 43f33a2e77
2 changed files with 12 additions and 7 deletions

View File

@@ -212,8 +212,8 @@ namespace Bloom::Widgets
readMemoryTask, readMemoryTask,
&ReadTargetMemory::targetMemoryRead, &ReadTargetMemory::targetMemoryRead,
this, this,
[this] (const Targets::TargetMemoryBuffer& buffer) { [this] (const Targets::TargetMemoryBuffer& data) {
this->onMemoryRead(buffer); this->onMemoryRead(data);
// Refresh the stack pointer if this is RAM. // Refresh the stack pointer if this is RAM.
if (this->targetMemoryDescriptor.type == Targets::TargetMemoryType::RAM) { if (this->targetMemoryDescriptor.type == Targets::TargetMemoryType::RAM) {
@@ -264,7 +264,7 @@ namespace Bloom::Widgets
void TargetMemoryInspectionPane::postActivate() { void TargetMemoryInspectionPane::postActivate() {
if ( if (
this->settings.refreshOnActivation (this->settings.refreshOnActivation || !this->data.has_value())
&& this->targetState == Targets::TargetState::STOPPED && this->targetState == Targets::TargetState::STOPPED
) { ) {
this->refreshMemoryValues([this] { this->refreshMemoryValues([this] {
@@ -344,7 +344,7 @@ namespace Bloom::Widgets
this->targetState = newState; this->targetState = newState;
if (newState == TargetState::STOPPED && this->activated) { if (newState == TargetState::STOPPED && this->activated) {
if (this->settings.refreshOnTargetStop) { if (this->settings.refreshOnTargetStop || !this->data.has_value()) {
this->refreshMemoryValues([this] { this->refreshMemoryValues([this] {
this->hexViewerWidget->setDisabled(false); this->hexViewerWidget->setDisabled(false);
}); });
@@ -368,8 +368,11 @@ namespace Bloom::Widgets
this->settings.refreshOnActivation = enabled; this->settings.refreshOnActivation = enabled;
} }
void TargetMemoryInspectionPane::onMemoryRead(const Targets::TargetMemoryBuffer& buffer) { void TargetMemoryInspectionPane::onMemoryRead(const Targets::TargetMemoryBuffer& data) {
this->hexViewerWidget->updateValues(buffer); assert(data.size() == this->targetMemoryDescriptor.size());
this->data = data;
this->hexViewerWidget->updateValues(this->data.value());
} }
void TargetMemoryInspectionPane::openMemoryRegionManagerWindow() { void TargetMemoryInspectionPane::openMemoryRegionManagerWindow() {

View File

@@ -48,6 +48,8 @@ namespace Bloom::Widgets
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor; const Targets::TargetMemoryDescriptor& targetMemoryDescriptor;
InsightWorker& insightWorker; InsightWorker& insightWorker;
std::optional<Targets::TargetMemoryBuffer> data;
QWidget* container = nullptr; QWidget* container = nullptr;
QWidget* titleBar = nullptr; QWidget* titleBar = nullptr;
@@ -69,7 +71,7 @@ namespace Bloom::Widgets
void onTargetStateChanged(Targets::TargetState newState); void onTargetStateChanged(Targets::TargetState newState);
void setRefreshOnTargetStopEnabled(bool enabled); void setRefreshOnTargetStopEnabled(bool enabled);
void setRefreshOnActivationEnabled(bool enabled); void setRefreshOnActivationEnabled(bool enabled);
void onMemoryRead(const Targets::TargetMemoryBuffer& buffer); void onMemoryRead(const Targets::TargetMemoryBuffer& data);
void openMemoryRegionManagerWindow(); void openMemoryRegionManagerWindow();
void onMemoryRegionsChange(); void onMemoryRegionsChange();
void onProgrammingModeEnabled(); void onProgrammingModeEnabled();