diff options
| author | Denis Shienkov <denis.shienkov@gmail.com> | 2020-08-26 15:24:42 +0300 |
|---|---|---|
| committer | Denis Shienkov <denis.shienkov@gmail.com> | 2020-08-31 10:14:06 +0000 |
| commit | 17d8f18d4667b7c1fff6ac9cbd5869f039ea604d (patch) | |
| tree | 436b0af33e3e6a1f9b824535df34ee705e1fceff | |
| parent | 5ddd83247c47b50d27c533c6060c17a4f3d26849 (diff) | |
| download | qt-creator-17d8f18d4667b7c1fff6ac9cbd5869f039ea604d.tar.gz | |
Debugger: Implement 'show memory' feature for UVSC engine
This commit implements a possibility to open the memory viewer/editor
for the specified address.
Take into account that it is impossible to open a memory viewer/editor
for a specific local variable or a stack, because the UVSC engine
does not provide an addresses for a local variables.
Change-Id: Ib65a9f9ba2534283c7e3404bc66785767c926053
Reviewed-by: hjk <hjk@qt.io>
| -rw-r--r-- | src/plugins/debugger/uvsc/uvscengine.cpp | 39 | ||||
| -rw-r--r-- | src/plugins/debugger/uvsc/uvscengine.h | 6 |
2 files changed, 44 insertions, 1 deletions
diff --git a/src/plugins/debugger/uvsc/uvscengine.cpp b/src/plugins/debugger/uvsc/uvscengine.cpp index 38e95df1db..75e8bddb8d 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 ace70fd5c5..af61d8c235 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; |
