forked from qt-creator/qt-creator
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:
@@ -217,7 +217,8 @@ bool UvscEngine::hasCapability(unsigned cap) const
|
|||||||
| AddWatcherCapability
|
| AddWatcherCapability
|
||||||
| WatchWidgetsCapability
|
| WatchWidgetsCapability
|
||||||
| CreateFullBacktraceCapability
|
| CreateFullBacktraceCapability
|
||||||
| OperateByInstructionCapability);
|
| OperateByInstructionCapability
|
||||||
|
| ShowMemoryCapability);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UvscEngine::setRegisterValue(const QString &name, const QString &value)
|
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))
|
if (!m_client->setRegisterValue(registerIt->first, value))
|
||||||
return;
|
return;
|
||||||
reloadRegisters();
|
reloadRegisters();
|
||||||
|
updateMemoryViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UvscEngine::setPeripheralRegisterValue(quint64 address, quint64 value)
|
void UvscEngine::setPeripheralRegisterValue(quint64 address, quint64 value)
|
||||||
@@ -241,6 +243,7 @@ void UvscEngine::setPeripheralRegisterValue(quint64 address, quint64 value)
|
|||||||
if (!m_client->changeMemory(address, data))
|
if (!m_client->changeMemory(address, data))
|
||||||
return;
|
return;
|
||||||
reloadPeripheralRegisters();
|
reloadPeripheralRegisters();
|
||||||
|
updateMemoryViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UvscEngine::executeStepOver(bool byInstruction)
|
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()
|
void UvscEngine::reloadRegisters()
|
||||||
{
|
{
|
||||||
if (!isRegistersWindowVisible())
|
if (!isRegistersWindowVisible())
|
||||||
@@ -866,5 +887,21 @@ void UvscEngine::handleStoppingFailure(const QString &errorMessage)
|
|||||||
notifyInferiorStopFailed();
|
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 Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -72,6 +72,9 @@ public:
|
|||||||
|
|
||||||
void fetchDisassembler(DisassemblerAgent *agent) final;
|
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 reloadRegisters() final;
|
||||||
void reloadPeripheralRegisters() final;
|
void reloadPeripheralRegisters() final;
|
||||||
|
|
||||||
@@ -99,6 +102,9 @@ private slots:
|
|||||||
void handleExecutionFailure(const QString &errorMessage);
|
void handleExecutionFailure(const QString &errorMessage);
|
||||||
void handleStoppingFailure(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:
|
private:
|
||||||
void doUpdateLocals(const UpdateParameters ¶ms) final;
|
void doUpdateLocals(const UpdateParameters ¶ms) final;
|
||||||
void updateAll() final;
|
void updateAll() final;
|
||||||
|
Reference in New Issue
Block a user