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>
This commit is contained in:
Denis Shienkov
2020-08-26 15:24:42 +03:00
parent 5ddd83247c
commit 17d8f18d46
2 changed files with 44 additions and 1 deletions

View File

@@ -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

View File

@@ -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 &params) final;
void updateAll() final;