From c8347207103574e7b8d93340ca064a6bfe63b9bb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 19 Apr 2011 13:57:25 +0200 Subject: [PATCH] Debugger[CDB]: Interrupt to fetch memory if required. --- src/plugins/debugger/cdb/cdbengine.cpp | 25 +++++++++++++++++-------- src/plugins/debugger/cdb/cdbengine.h | 2 ++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 686c5c864b4..1edd49299e6 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -1512,18 +1512,23 @@ void CdbEngine::handleDisassembler(const CdbBuiltinCommandPtr &command) void CdbEngine::fetchMemory(MemoryAgent *agent, QObject *editor, quint64 addr, quint64 length) { - if (!m_accessible) { - qWarning("Internal error: Attempt to read memory from inaccessible session: %s", Q_FUNC_INFO); - return; - } if (debug) qDebug("CdbEngine::fetchMemory %llu bytes from 0x%llx", length, addr); + const MemoryViewCookie cookie(agent, editor, addr, length); + if (m_accessible) { + postFetchMemory(cookie); + } else { + doInterruptInferiorCustomSpecialStop(qVariantFromValue(cookie)); + } +} +void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie) +{ QByteArray args; ByteArrayInputStream str(args); - str << addr << ' ' << length; - const QVariant cookie = qVariantFromValue(MemoryViewCookie(agent, editor, addr, length)); - postExtensionCommand("memory", args, 0, &CdbEngine::handleMemory, 0, cookie); + str << cookie.address << ' ' << cookie.length; + postExtensionCommand("memory", args, 0, &CdbEngine::handleMemory, 0, + qVariantFromValue(cookie)); } void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, const QByteArray &data) @@ -1547,7 +1552,7 @@ void CdbEngine::handleMemory(const CdbExtensionCommandPtr &command) memViewCookie.agent->addLazyData(memViewCookie.editorToken, memViewCookie.address, data); } else { - showMessage(QString::fromLocal8Bit(command->errorMessage), LogError); + showMessage(QString::fromLocal8Bit(command->errorMessage), LogWarning); } } @@ -2781,6 +2786,10 @@ void CdbEngine::handleCustomSpecialStop(const QVariant &v) postCommand(cdbWriteMemoryCommand(changeData.address, changeData.data), 0); return; } + if (qVariantCanConvert(v)) { + postFetchMemory(qVariantValue(v)); + return; + } } } // namespace Internal diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index b1b7b93756b..54eaa626138 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -54,6 +54,7 @@ class DisassemblerAgent; struct CdbBuiltinCommand; struct CdbExtensionCommand; struct CdbOptions; +struct MemoryViewCookie; class ByteArrayInputStream; class GdbMi; @@ -209,6 +210,7 @@ private: void syncOperateByInstruction(bool operateByInstruction); void postWidgetAtCommand(); void handleCustomSpecialStop(const QVariant &v); + void postFetchMemory(const MemoryViewCookie &c); void evaluateExpression(QByteArray exp, const QVariant &cookie = QVariant()); // Builtin commands