diff --git a/src/plugins/debugger/uvsc/uvscengine.cpp b/src/plugins/debugger/uvsc/uvscengine.cpp index 38e95df1dbe..75e8bddb8d5 100644 --- a/src/plugins/debugger/uvsc/uvscengine.cpp +++ b/src/plugins/debugger/uvsc/uvscengine.cpp @@ -217,7 +217,8 @@ bool UvscEngine::hasCapability(unsigned cap) const | AddWatcherCapability | WatchWidgetsCapability | CreateFullBacktraceCapability - | OperateByInstructionCapability); + | OperateByInstructionCapability + | ShowMemoryCapability); } void UvscEngine::setRegisterValue(const QString &name, const QString &value) @@ -233,6 +234,7 @@ void UvscEngine::setRegisterValue(const QString &name, const QString &value) if (!m_client->setRegisterValue(registerIt->first, value)) return; reloadRegisters(); + updateMemoryViews(); } void UvscEngine::setPeripheralRegisterValue(quint64 address, quint64 value) @@ -241,6 +243,7 @@ void UvscEngine::setPeripheralRegisterValue(quint64 address, quint64 value) if (!m_client->changeMemory(address, data)) return; reloadPeripheralRegisters(); + updateMemoryViews(); } void UvscEngine::executeStepOver(bool byInstruction) @@ -473,6 +476,24 @@ void UvscEngine::fetchDisassembler(DisassemblerAgent *agent) } } +void UvscEngine::changeMemory(MemoryAgent *agent, quint64 address, const QByteArray &data) +{ + QTC_ASSERT(!data.isEmpty(), return); + if (!m_client->changeMemory(address, data)) + showMessage(tr("UVSC: Changing memory at address 0x%1 failed.").arg(address, 0, 16), LogMisc); + else + handleChangeMemory(agent, address, data); +} + +void UvscEngine::fetchMemory(MemoryAgent *agent, quint64 address, quint64 length) +{ + QByteArray data(int(length), 0); + if (!m_client->fetchMemory(address, data)) + showMessage(tr("UVSC: Fetching memory at address 0x%1 failed.").arg(address, 0, 16), LogMisc); + + handleFetchMemory(agent, address, data); +} + void UvscEngine::reloadRegisters() { if (!isRegistersWindowVisible()) @@ -866,5 +887,21 @@ void UvscEngine::handleStoppingFailure(const QString &errorMessage) notifyInferiorStopFailed(); } +void UvscEngine::handleFetchMemory(MemoryAgent *agent, quint64 address, const QByteArray &data) +{ + agent->addData(address, data); +} + +void UvscEngine::handleChangeMemory(MemoryAgent *agent, quint64 address, const QByteArray &data) +{ + Q_UNUSED(agent) + Q_UNUSED(address) + Q_UNUSED(data) + + updateLocals(); + reloadRegisters(); + reloadPeripheralRegisters(); +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/uvsc/uvscengine.h b/src/plugins/debugger/uvsc/uvscengine.h index ace70fd5c56..af61d8c2353 100644 --- a/src/plugins/debugger/uvsc/uvscengine.h +++ b/src/plugins/debugger/uvsc/uvscengine.h @@ -72,6 +72,9 @@ public: void fetchDisassembler(DisassemblerAgent *agent) final; + void changeMemory(MemoryAgent *agent, quint64 address, const QByteArray &data) final; + void fetchMemory(MemoryAgent *agent, quint64 address, quint64 length) final; + void reloadRegisters() final; void reloadPeripheralRegisters() final; @@ -99,6 +102,9 @@ private slots: void handleExecutionFailure(const QString &errorMessage); void handleStoppingFailure(const QString &errorMessage); + void handleFetchMemory(MemoryAgent *agent, quint64 address, const QByteArray &data); + void handleChangeMemory(MemoryAgent *agent, quint64 address, const QByteArray &data); + private: void doUpdateLocals(const UpdateParameters ¶ms) final; void updateAll() final;