forked from qt-creator/qt-creator
debugger: split debuggeragents.{h,cpp} int {memory,disassembler}agent.{h,cpp}
This commit is contained in:
@@ -40,9 +40,10 @@
|
|||||||
#include "cdboptions.h"
|
#include "cdboptions.h"
|
||||||
#include "cdbexceptionutils.h"
|
#include "cdbexceptionutils.h"
|
||||||
#include "cdbsymbolpathlisteditor.h"
|
#include "cdbsymbolpathlisteditor.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggercore.h"
|
|
||||||
#include "dbgwinutils.h"
|
#include "dbgwinutils.h"
|
||||||
|
#include "debuggercore.h"
|
||||||
|
#include "disassemblerviewagent.h"
|
||||||
|
#include "memoryviewagent.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
|
|||||||
@@ -40,7 +40,8 @@
|
|||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
#include "registerhandler.h"
|
#include "registerhandler.h"
|
||||||
#include "debuggeragents.h"
|
#include "disassembleragent.h"
|
||||||
|
#include "memoryagent.h"
|
||||||
#include "debuggertooltip.h"
|
#include "debuggertooltip.h"
|
||||||
#include "cdbparsehelpers.h"
|
#include "cdbparsehelpers.h"
|
||||||
#include "watchutils.h"
|
#include "watchutils.h"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ HEADERS += breakhandler.h \
|
|||||||
consolewindow.h \
|
consolewindow.h \
|
||||||
debugger_global.h \
|
debugger_global.h \
|
||||||
debuggeractions.h \
|
debuggeractions.h \
|
||||||
debuggeragents.h \
|
|
||||||
debuggercore.h \
|
debuggercore.h \
|
||||||
debuggerconstants.h \
|
debuggerconstants.h \
|
||||||
debuggerdialogs.h \
|
debuggerdialogs.h \
|
||||||
@@ -34,8 +33,10 @@ HEADERS += breakhandler.h \
|
|||||||
debuggerstreamops.h \
|
debuggerstreamops.h \
|
||||||
debuggerstringutils.h \
|
debuggerstringutils.h \
|
||||||
debuggertooltip.h \
|
debuggertooltip.h \
|
||||||
|
disassembleragent.h \
|
||||||
disassemblerlines.h \
|
disassemblerlines.h \
|
||||||
logwindow.h \
|
logwindow.h \
|
||||||
|
memoryagent.h \
|
||||||
moduleshandler.h \
|
moduleshandler.h \
|
||||||
moduleswindow.h \
|
moduleswindow.h \
|
||||||
name_demangler.h \
|
name_demangler.h \
|
||||||
@@ -65,7 +66,6 @@ SOURCES += breakhandler.cpp \
|
|||||||
breakwindow.cpp \
|
breakwindow.cpp \
|
||||||
consolewindow.cpp \
|
consolewindow.cpp \
|
||||||
debuggeractions.cpp \
|
debuggeractions.cpp \
|
||||||
debuggeragents.cpp \
|
|
||||||
debuggerdialogs.cpp \
|
debuggerdialogs.cpp \
|
||||||
debuggerengine.cpp \
|
debuggerengine.cpp \
|
||||||
debuggermainwindow.cpp \
|
debuggermainwindow.cpp \
|
||||||
@@ -73,8 +73,10 @@ SOURCES += breakhandler.cpp \
|
|||||||
debuggerrunner.cpp \
|
debuggerrunner.cpp \
|
||||||
debuggerstreamops.cpp \
|
debuggerstreamops.cpp \
|
||||||
debuggertooltip.cpp \
|
debuggertooltip.cpp \
|
||||||
|
disassembleragent.cpp \
|
||||||
disassemblerlines.cpp \
|
disassemblerlines.cpp \
|
||||||
logwindow.cpp \
|
logwindow.cpp \
|
||||||
|
memoryagent.cpp \
|
||||||
moduleshandler.cpp \
|
moduleshandler.cpp \
|
||||||
moduleswindow.cpp \
|
moduleswindow.cpp \
|
||||||
name_demangler.cpp \
|
name_demangler.cpp \
|
||||||
|
|||||||
@@ -30,13 +30,14 @@
|
|||||||
#include "debuggerengine.h"
|
#include "debuggerengine.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
#include "debuggerplugin.h"
|
#include "debuggerplugin.h"
|
||||||
#include "debuggerrunner.h"
|
#include "debuggerrunner.h"
|
||||||
#include "debuggerstringutils.h"
|
#include "debuggerstringutils.h"
|
||||||
#include "debuggertooltip.h"
|
#include "debuggertooltip.h"
|
||||||
|
|
||||||
|
#include "memoryagent.h"
|
||||||
|
#include "disassembleragent.h"
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "moduleshandler.h"
|
#include "moduleshandler.h"
|
||||||
#include "registerhandler.h"
|
#include "registerhandler.h"
|
||||||
@@ -1418,6 +1419,17 @@ bool DebuggerEngine::isCppBreakpoint(const BreakpointParameters &p)
|
|||||||
&& !p.fileName.endsWith(QLatin1String(".js"), Qt::CaseInsensitive);
|
&& !p.fileName.endsWith(QLatin1String(".js"), Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerEngine::openMemoryView(quint64 address)
|
||||||
|
{
|
||||||
|
(void) new MemoryViewAgent(this, address);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerEngine::openDisassemblerView(const StackFrame &frame)
|
||||||
|
{
|
||||||
|
DisassemblerViewAgent *agent = new DisassemblerViewAgent(this);
|
||||||
|
agent->setFrame(frame, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
#include "debuggerengine.moc"
|
#include "debuggerengine.moc"
|
||||||
|
|||||||
@@ -160,8 +160,10 @@ public:
|
|||||||
void startDebugger(DebuggerRunControl *runControl);
|
void startDebugger(DebuggerRunControl *runControl);
|
||||||
|
|
||||||
virtual void watchPoint(const QPoint &);
|
virtual void watchPoint(const QPoint &);
|
||||||
|
virtual void openMemoryView(quint64 addr);
|
||||||
virtual void fetchMemory(Internal::MemoryViewAgent *, QObject *,
|
virtual void fetchMemory(Internal::MemoryViewAgent *, QObject *,
|
||||||
quint64 addr, quint64 length);
|
quint64 addr, quint64 length);
|
||||||
|
virtual void openDisassemblerView(const Internal::StackFrame &frame);
|
||||||
virtual void fetchDisassembler(Internal::DisassemblerViewAgent *);
|
virtual void fetchDisassembler(Internal::DisassemblerViewAgent *);
|
||||||
virtual void activateFrame(int index);
|
virtual void activateFrame(int index);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "debuggerplugin.h"
|
#include "debuggerplugin.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
#include "debuggerdialogs.h"
|
#include "debuggerdialogs.h"
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "breakwindow.h"
|
#include "breakwindow.h"
|
||||||
#include "consolewindow.h"
|
#include "consolewindow.h"
|
||||||
|
#include "disassembleragent.h"
|
||||||
#include "logwindow.h"
|
#include "logwindow.h"
|
||||||
#include "moduleswindow.h"
|
#include "moduleswindow.h"
|
||||||
#include "registerwindow.h"
|
#include "registerwindow.h"
|
||||||
@@ -2430,7 +2430,7 @@ void DebuggerPluginPrivate::openMemoryEditor()
|
|||||||
{
|
{
|
||||||
AddressDialog dialog;
|
AddressDialog dialog;
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
(void) new MemoryViewAgent(currentEngine(), dialog.address());
|
currentEngine()->openMemoryView(dialog.address());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::coreShutdown()
|
void DebuggerPluginPrivate::coreShutdown()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "debuggeragents.h"
|
#include "disassembleragent.h"
|
||||||
|
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "debuggerengine.h"
|
#include "debuggerengine.h"
|
||||||
@@ -36,10 +36,9 @@
|
|||||||
#include "stackframe.h"
|
#include "stackframe.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
#include <coreplugin/mimedatabase.h>
|
||||||
|
|
||||||
#include <texteditor/basetextdocument.h>
|
#include <texteditor/basetextdocument.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
@@ -49,143 +48,15 @@
|
|||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtCore/QMetaObject>
|
|
||||||
#include <QtCore/QTimer>
|
|
||||||
|
|
||||||
#include <QtGui/QMessageBox>
|
|
||||||
#include <QtGui/QPlainTextEdit>
|
|
||||||
#include <QtGui/QTextBlock>
|
#include <QtGui/QTextBlock>
|
||||||
#include <QtGui/QTextCursor>
|
|
||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// MemoryViewAgent
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class MemoryViewAgent
|
|
||||||
|
|
||||||
Objects form this class are created in response to user actions in
|
|
||||||
the Gui for showing raw memory from the inferior. After creation
|
|
||||||
it handles communication between the engine and the bineditor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace { const int DataRange = 1024 * 1024; }
|
|
||||||
|
|
||||||
MemoryViewAgent::MemoryViewAgent(Debugger::DebuggerEngine *engine, quint64 addr)
|
|
||||||
: QObject(engine), m_engine(engine)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(engine, /**/);
|
|
||||||
createBinEditor(addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
MemoryViewAgent::MemoryViewAgent(Debugger::DebuggerEngine *engine, const QString &addr)
|
|
||||||
: QObject(engine), m_engine(engine)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(engine, /**/);
|
|
||||||
bool ok = true;
|
|
||||||
createBinEditor(addr.toULongLong(&ok, 0));
|
|
||||||
//qDebug() << " ADDRESS: " << addr << addr.toUInt(&ok, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
MemoryViewAgent::~MemoryViewAgent()
|
|
||||||
{
|
|
||||||
EditorManager *editorManager = EditorManager::instance();
|
|
||||||
QList<IEditor *> editors;
|
|
||||||
foreach (QPointer<IEditor> editor, m_editors)
|
|
||||||
if (editor)
|
|
||||||
editors.append(editor.data());
|
|
||||||
editorManager->closeEditors(editors);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryViewAgent::createBinEditor(quint64 addr)
|
|
||||||
{
|
|
||||||
EditorManager *editorManager = EditorManager::instance();
|
|
||||||
QString titlePattern = tr("Memory $");
|
|
||||||
IEditor *editor = editorManager->openEditorWithContents(
|
|
||||||
Core::Constants::K_DEFAULT_BINARY_EDITOR_ID,
|
|
||||||
&titlePattern);
|
|
||||||
if (editor) {
|
|
||||||
connect(editor->widget(),
|
|
||||||
SIGNAL(lazyDataRequested(Core::IEditor *, quint64,bool)),
|
|
||||||
SLOT(fetchLazyData(Core::IEditor *, quint64,bool)));
|
|
||||||
connect(editor->widget(),
|
|
||||||
SIGNAL(newWindowRequested(quint64)),
|
|
||||||
SLOT(createBinEditor(quint64)));
|
|
||||||
connect(editor->widget(),
|
|
||||||
SIGNAL(newRangeRequested(Core::IEditor *, quint64)),
|
|
||||||
SLOT(provideNewRange(Core::IEditor*,quint64)));
|
|
||||||
connect(editor->widget(),
|
|
||||||
SIGNAL(startOfFileRequested(Core::IEditor *)),
|
|
||||||
SLOT(handleStartOfFileRequested(Core::IEditor*)));
|
|
||||||
connect(editor->widget(),
|
|
||||||
SIGNAL(endOfFileRequested(Core::IEditor *)),
|
|
||||||
SLOT(handleEndOfFileRequested(Core::IEditor*)));
|
|
||||||
m_editors << editor;
|
|
||||||
editorManager->activateEditor(editor);
|
|
||||||
QMetaObject::invokeMethod(editor->widget(), "setNewWindowRequestAllowed");
|
|
||||||
QMetaObject::invokeMethod(editor->widget(), "setLazyData",
|
|
||||||
Q_ARG(quint64, addr), Q_ARG(int, DataRange), Q_ARG(int, BinBlockSize));
|
|
||||||
} else {
|
|
||||||
showMessageBox(QMessageBox::Warning,
|
|
||||||
tr("No memory viewer available"),
|
|
||||||
tr("The memory contents cannot be shown as no viewer plugin "
|
|
||||||
"for binary data has been loaded."));
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryViewAgent::fetchLazyData(IEditor *editor, quint64 block, bool sync)
|
|
||||||
{
|
|
||||||
Q_UNUSED(sync); // FIXME: needed support for incremental searching
|
|
||||||
m_engine->fetchMemory(this, editor, BinBlockSize * block, BinBlockSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryViewAgent::addLazyData(QObject *editorToken, quint64 addr,
|
|
||||||
const QByteArray &ba)
|
|
||||||
{
|
|
||||||
IEditor *editor = qobject_cast<IEditor *>(editorToken);
|
|
||||||
if (editor && editor->widget()) {
|
|
||||||
Core::EditorManager::instance()->activateEditor(editor);
|
|
||||||
QMetaObject::invokeMethod(editor->widget(), "addLazyData",
|
|
||||||
Q_ARG(quint64, addr / BinBlockSize), Q_ARG(QByteArray, ba));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryViewAgent::provideNewRange(IEditor *editor, quint64 address)
|
|
||||||
{
|
|
||||||
QMetaObject::invokeMethod(editor->widget(), "setLazyData",
|
|
||||||
Q_ARG(quint64, address), Q_ARG(int, DataRange),
|
|
||||||
Q_ARG(int, BinBlockSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since we are not dealing with files, we take these signals to mean
|
|
||||||
// "move to start/end of range". This seems to make more sense than
|
|
||||||
// jumping to the start or end of the address space, respectively.
|
|
||||||
void MemoryViewAgent::handleStartOfFileRequested(IEditor *editor)
|
|
||||||
{
|
|
||||||
QMetaObject::invokeMethod(editor->widget(),
|
|
||||||
"setCursorPosition", Q_ARG(int, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryViewAgent::handleEndOfFileRequested(IEditor *editor)
|
|
||||||
{
|
|
||||||
QMetaObject::invokeMethod(editor->widget(),
|
|
||||||
"setCursorPosition", Q_ARG(int, DataRange - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// DisassemblerViewAgent
|
// DisassemblerViewAgent
|
||||||
@@ -27,16 +27,14 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef DEBUGGER_AGENTS_H
|
#ifndef DEBUGGER_DISASSEMBLERAGENT_H
|
||||||
#define DEBUGGER_AGENTS_H
|
#define DEBUGGER_DISASSEMBLERAGENT_H
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <QtCore/QHash>
|
|
||||||
#include <QtCore/QPointer>
|
|
||||||
#include <QtCore/QVector>
|
|
||||||
|
|
||||||
#include "disassemblerlines.h"
|
#include "disassemblerlines.h"
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IEditor;
|
class IEditor;
|
||||||
}
|
}
|
||||||
@@ -51,40 +49,13 @@ class StackFrame;
|
|||||||
class DisassemblerViewAgent;
|
class DisassemblerViewAgent;
|
||||||
class DisassemblerViewAgentPrivate;
|
class DisassemblerViewAgentPrivate;
|
||||||
|
|
||||||
class MemoryViewAgent : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
// Called from Gui
|
|
||||||
explicit MemoryViewAgent(Debugger::DebuggerEngine *engine, quint64 startaddr);
|
|
||||||
explicit MemoryViewAgent(Debugger::DebuggerEngine *engine, const QString &startaddr);
|
|
||||||
~MemoryViewAgent();
|
|
||||||
|
|
||||||
enum { BinBlockSize = 1024 };
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
// Called from Engine
|
|
||||||
void addLazyData(QObject *editorToken, quint64 addr, const QByteArray &data);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_SLOT void createBinEditor(quint64 startAddr);
|
|
||||||
Q_SLOT void fetchLazyData(Core::IEditor *, quint64 block, bool sync);
|
|
||||||
Q_SLOT void provideNewRange(Core::IEditor *editor, quint64 address);
|
|
||||||
Q_SLOT void handleStartOfFileRequested(Core::IEditor *editor);
|
|
||||||
Q_SLOT void handleEndOfFileRequested(Core::IEditor *editor);
|
|
||||||
|
|
||||||
QList<QPointer<Core::IEditor> > m_editors;
|
|
||||||
QPointer<Debugger::DebuggerEngine> m_engine;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DisassemblerViewAgent : public QObject
|
class DisassemblerViewAgent : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType)
|
Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType)
|
||||||
public:
|
public:
|
||||||
// Called from Gui
|
// Called from Gui
|
||||||
explicit DisassemblerViewAgent(Debugger::DebuggerEngine *engine);
|
explicit DisassemblerViewAgent(DebuggerEngine *engine);
|
||||||
~DisassemblerViewAgent();
|
~DisassemblerViewAgent();
|
||||||
|
|
||||||
void setFrame(const StackFrame &frame, bool tryMixed, bool setMarker);
|
void setFrame(const StackFrame &frame, bool tryMixed, bool setMarker);
|
||||||
@@ -105,6 +76,7 @@ public:
|
|||||||
|
|
||||||
// Return address of an assembly line "0x0dfd bla"
|
// Return address of an assembly line "0x0dfd bla"
|
||||||
static quint64 addressFromDisassemblyLine(const QString &data);
|
static quint64 addressFromDisassemblyLine(const QString &data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DisassemblerViewAgentPrivate *d;
|
DisassemblerViewAgentPrivate *d;
|
||||||
};
|
};
|
||||||
@@ -113,4 +85,4 @@ private:
|
|||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
#endif // DEBUGGER_WATCHWINDOW_H
|
#endif // DEBUGGER_DISASSEMBLERAGENT_H
|
||||||
@@ -31,11 +31,6 @@
|
|||||||
|
|
||||||
#include "gdbengine.h"
|
#include "gdbengine.h"
|
||||||
|
|
||||||
#include "gdboptionspage.h"
|
|
||||||
#include "debuggercore.h"
|
|
||||||
#include "debuggerplugin.h"
|
|
||||||
#include "debuggerrunner.h"
|
|
||||||
|
|
||||||
#include "attachgdbadapter.h"
|
#include "attachgdbadapter.h"
|
||||||
#include "coregdbadapter.h"
|
#include "coregdbadapter.h"
|
||||||
#include "localplaingdbadapter.h"
|
#include "localplaingdbadapter.h"
|
||||||
@@ -45,13 +40,18 @@
|
|||||||
#include "trkgdbadapter.h"
|
#include "trkgdbadapter.h"
|
||||||
#include "tcftrkgdbadapter.h"
|
#include "tcftrkgdbadapter.h"
|
||||||
|
|
||||||
#include "watchutils.h"
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggertooltip.h"
|
#include "debuggercore.h"
|
||||||
|
#include "debuggerplugin.h"
|
||||||
|
#include "debuggerrunner.h"
|
||||||
#include "debuggerstringutils.h"
|
#include "debuggerstringutils.h"
|
||||||
|
#include "debuggertooltip.h"
|
||||||
|
#include "disassembleragent.h"
|
||||||
#include "gdbmi.h"
|
#include "gdbmi.h"
|
||||||
|
#include "gdboptionspage.h"
|
||||||
|
#include "memoryagent.h"
|
||||||
|
#include "watchutils.h"
|
||||||
|
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "moduleshandler.h"
|
#include "moduleshandler.h"
|
||||||
@@ -62,16 +62,12 @@
|
|||||||
#include "threadshandler.h"
|
#include "threadshandler.h"
|
||||||
#include "watchhandler.h"
|
#include "watchhandler.h"
|
||||||
|
|
||||||
#include "sourcefileswindow.h"
|
|
||||||
|
|
||||||
#include "debuggerdialogs.h"
|
|
||||||
#include "logwindow.h"
|
#include "logwindow.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
#include <utils/fancymainwindow.h>
|
|
||||||
#include <texteditor/itexteditor.h>
|
|
||||||
#include <projectexplorer/toolchain.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
#include <projectexplorer/toolchain.h>
|
||||||
|
#include <texteditor/itexteditor.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "ipcenginehost.h"
|
#include "ipcenginehost.h"
|
||||||
|
|
||||||
#include "ipcengineguest.h"
|
#include "ipcengineguest.h"
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "breakpoint.h"
|
#include "breakpoint.h"
|
||||||
@@ -38,15 +39,17 @@
|
|||||||
#include "watchhandler.h"
|
#include "watchhandler.h"
|
||||||
#include "watchutils.h"
|
#include "watchutils.h"
|
||||||
#include "threadshandler.h"
|
#include "threadshandler.h"
|
||||||
#include "debuggeragents.h"
|
#include "disassembleragent.h"
|
||||||
|
#include "memoryagent.h"
|
||||||
#include "debuggerstreamops.h"
|
#include "debuggerstreamops.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
#include <QLocalSocket>
|
#include <QLocalSocket>
|
||||||
|
|
||||||
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#include "debuggerdialogs.h"
|
#include "debuggerdialogs.h"
|
||||||
#include "debuggerplugin.h"
|
#include "debuggerplugin.h"
|
||||||
#include "debuggerstringutils.h"
|
#include "debuggerstringutils.h"
|
||||||
#include "coreplugin/icore.h"
|
|
||||||
|
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "breakpoint.h"
|
#include "breakpoint.h"
|
||||||
@@ -46,9 +45,12 @@
|
|||||||
#include "watchhandler.h"
|
#include "watchhandler.h"
|
||||||
#include "watchutils.h"
|
#include "watchutils.h"
|
||||||
#include "threadshandler.h"
|
#include "threadshandler.h"
|
||||||
#include "debuggeragents.h"
|
#include "disassembleragent.h"
|
||||||
|
#include "memoryagent.h"
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|||||||
159
src/plugins/debugger/memoryagent.cpp
Normal file
159
src/plugins/debugger/memoryagent.cpp
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** Commercial Usage
|
||||||
|
**
|
||||||
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||||
|
** accordance with the Qt Commercial License Agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** If you are unsure which license is appropriate for your use, please
|
||||||
|
** contact the sales department at http://qt.nokia.com/contact.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "memoryagent.h"
|
||||||
|
|
||||||
|
#include "debuggerengine.h"
|
||||||
|
#include "debuggercore.h"
|
||||||
|
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// MemoryViewAgent
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class MemoryViewAgent
|
||||||
|
|
||||||
|
Objects form this class are created in response to user actions in
|
||||||
|
the Gui for showing raw memory from the inferior. After creation
|
||||||
|
it handles communication between the engine and the bineditor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace { const int DataRange = 1024 * 1024; }
|
||||||
|
|
||||||
|
MemoryViewAgent::MemoryViewAgent(Debugger::DebuggerEngine *engine, quint64 addr)
|
||||||
|
: QObject(engine), m_engine(engine)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(engine, /**/);
|
||||||
|
createBinEditor(addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
MemoryViewAgent::~MemoryViewAgent()
|
||||||
|
{
|
||||||
|
EditorManager *editorManager = EditorManager::instance();
|
||||||
|
QList<IEditor *> editors;
|
||||||
|
foreach (QPointer<IEditor> editor, m_editors)
|
||||||
|
if (editor)
|
||||||
|
editors.append(editor.data());
|
||||||
|
editorManager->closeEditors(editors);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemoryViewAgent::createBinEditor(quint64 addr)
|
||||||
|
{
|
||||||
|
EditorManager *editorManager = EditorManager::instance();
|
||||||
|
QString titlePattern = tr("Memory $");
|
||||||
|
IEditor *editor = editorManager->openEditorWithContents(
|
||||||
|
Core::Constants::K_DEFAULT_BINARY_EDITOR_ID,
|
||||||
|
&titlePattern);
|
||||||
|
if (editor) {
|
||||||
|
connect(editor->widget(),
|
||||||
|
SIGNAL(lazyDataRequested(Core::IEditor *, quint64,bool)),
|
||||||
|
SLOT(fetchLazyData(Core::IEditor *, quint64,bool)));
|
||||||
|
connect(editor->widget(),
|
||||||
|
SIGNAL(newWindowRequested(quint64)),
|
||||||
|
SLOT(createBinEditor(quint64)));
|
||||||
|
connect(editor->widget(),
|
||||||
|
SIGNAL(newRangeRequested(Core::IEditor *, quint64)),
|
||||||
|
SLOT(provideNewRange(Core::IEditor*,quint64)));
|
||||||
|
connect(editor->widget(),
|
||||||
|
SIGNAL(startOfFileRequested(Core::IEditor *)),
|
||||||
|
SLOT(handleStartOfFileRequested(Core::IEditor*)));
|
||||||
|
connect(editor->widget(),
|
||||||
|
SIGNAL(endOfFileRequested(Core::IEditor *)),
|
||||||
|
SLOT(handleEndOfFileRequested(Core::IEditor*)));
|
||||||
|
m_editors << editor;
|
||||||
|
editorManager->activateEditor(editor);
|
||||||
|
QMetaObject::invokeMethod(editor->widget(), "setNewWindowRequestAllowed");
|
||||||
|
QMetaObject::invokeMethod(editor->widget(), "setLazyData",
|
||||||
|
Q_ARG(quint64, addr), Q_ARG(int, DataRange), Q_ARG(int, BinBlockSize));
|
||||||
|
} else {
|
||||||
|
showMessageBox(QMessageBox::Warning,
|
||||||
|
tr("No memory viewer available"),
|
||||||
|
tr("The memory contents cannot be shown as no viewer plugin "
|
||||||
|
"for binary data has been loaded."));
|
||||||
|
deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemoryViewAgent::fetchLazyData(IEditor *editor, quint64 block, bool sync)
|
||||||
|
{
|
||||||
|
Q_UNUSED(sync); // FIXME: needed support for incremental searching
|
||||||
|
m_engine->fetchMemory(this, editor, BinBlockSize * block, BinBlockSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemoryViewAgent::addLazyData(QObject *editorToken, quint64 addr,
|
||||||
|
const QByteArray &ba)
|
||||||
|
{
|
||||||
|
IEditor *editor = qobject_cast<IEditor *>(editorToken);
|
||||||
|
if (editor && editor->widget()) {
|
||||||
|
Core::EditorManager::instance()->activateEditor(editor);
|
||||||
|
QMetaObject::invokeMethod(editor->widget(), "addLazyData",
|
||||||
|
Q_ARG(quint64, addr / BinBlockSize), Q_ARG(QByteArray, ba));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemoryViewAgent::provideNewRange(IEditor *editor, quint64 address)
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(editor->widget(), "setLazyData",
|
||||||
|
Q_ARG(quint64, address), Q_ARG(int, DataRange),
|
||||||
|
Q_ARG(int, BinBlockSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since we are not dealing with files, we take these signals to mean
|
||||||
|
// "move to start/end of range". This seems to make more sense than
|
||||||
|
// jumping to the start or end of the address space, respectively.
|
||||||
|
void MemoryViewAgent::handleStartOfFileRequested(IEditor *editor)
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(editor->widget(),
|
||||||
|
"setCursorPosition", Q_ARG(int, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemoryViewAgent::handleEndOfFileRequested(IEditor *editor)
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(editor->widget(),
|
||||||
|
"setCursorPosition", Q_ARG(int, DataRange - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
75
src/plugins/debugger/memoryagent.h
Normal file
75
src/plugins/debugger/memoryagent.h
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** Commercial Usage
|
||||||
|
**
|
||||||
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||||
|
** accordance with the Qt Commercial License Agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** If you are unsure which license is appropriate for your use, please
|
||||||
|
** contact the sales department at http://qt.nokia.com/contact.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DEBUGGER_MEMORYAGENT_H
|
||||||
|
#define DEBUGGER_MEMORYAGENT_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class IEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
|
||||||
|
class DebuggerEngine;
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class MemoryViewAgent : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Called from Gui
|
||||||
|
explicit MemoryViewAgent(DebuggerEngine *engine, quint64 startaddr);
|
||||||
|
~MemoryViewAgent();
|
||||||
|
|
||||||
|
enum { BinBlockSize = 1024 };
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
// Called from Engine
|
||||||
|
void addLazyData(QObject *editorToken, quint64 addr, const QByteArray &data);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_SLOT void createBinEditor(quint64 startAddr);
|
||||||
|
Q_SLOT void fetchLazyData(Core::IEditor *, quint64 block, bool sync);
|
||||||
|
Q_SLOT void provideNewRange(Core::IEditor *editor, quint64 address);
|
||||||
|
Q_SLOT void handleStartOfFileRequested(Core::IEditor *editor);
|
||||||
|
Q_SLOT void handleEndOfFileRequested(Core::IEditor *editor);
|
||||||
|
|
||||||
|
QList<QPointer<Core::IEditor> > m_editors;
|
||||||
|
QPointer<DebuggerEngine> m_engine;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
|
#endif // DEBUGGER_MEMORYAGENT_H
|
||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "registerwindow.h"
|
#include "registerwindow.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
#include "debuggerengine.h"
|
#include "debuggerengine.h"
|
||||||
@@ -237,7 +236,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
else if (act == actReload)
|
else if (act == actReload)
|
||||||
engine->reloadRegisters();
|
engine->reloadRegisters();
|
||||||
else if (act == actShowMemory)
|
else if (act == actShowMemory)
|
||||||
(void) new MemoryViewAgent(engine, address);
|
engine->openMemoryView(address.toULongLong(0, 0));
|
||||||
else if (act == act16)
|
else if (act == act16)
|
||||||
handler->setNumberBase(16);
|
handler->setNumberBase(16);
|
||||||
else if (act == act10)
|
else if (act == act10)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
#include "debuggerengine.h"
|
#include "debuggerengine.h"
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
#include "debuggerengine.h"
|
#include "debuggerengine.h"
|
||||||
@@ -159,11 +158,9 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
else if (act == actAlwaysAdjust)
|
else if (act == actAlwaysAdjust)
|
||||||
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
|
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
|
||||||
else if (act == actShowMemory)
|
else if (act == actShowMemory)
|
||||||
(void) new MemoryViewAgent(currentEngine(), address);
|
engine->openMemoryView(address);
|
||||||
else if (act == actShowDisassembler) {
|
else if (act == actShowDisassembler)
|
||||||
DisassemblerViewAgent *agent = new DisassemblerViewAgent(engine);
|
engine->openDisassemblerView(frame);
|
||||||
agent->setFrame(frame, true, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::copyContentsToClipboard()
|
void StackWindow::copyContentsToClipboard()
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
#include "debuggerengine.h"
|
#include "debuggerengine.h"
|
||||||
#include "watchutils.h"
|
#include "watchutils.h"
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "watchwindow.h"
|
#include "watchwindow.h"
|
||||||
|
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "debuggeragents.h"
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
@@ -456,13 +455,13 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
} else if (act == actInsertNewWatchItem) {
|
} else if (act == actInsertNewWatchItem) {
|
||||||
watchExpression(QString());
|
watchExpression(QString());
|
||||||
} else if (act == actOpenMemoryEditAtVariableAddress) {
|
} else if (act == actOpenMemoryEditAtVariableAddress) {
|
||||||
(void) new MemoryViewAgent(currentEngine(), address);
|
currentEngine()->openMemoryView(address);
|
||||||
} else if (act == actOpenMemoryEditAtPointerValue) {
|
} else if (act == actOpenMemoryEditAtPointerValue) {
|
||||||
(void) new MemoryViewAgent(currentEngine(), pointerValue);
|
currentEngine()->openMemoryView(pointerValue);
|
||||||
} else if (act == actOpenMemoryEditor) {
|
} else if (act == actOpenMemoryEditor) {
|
||||||
AddressDialog dialog;
|
AddressDialog dialog;
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
(void) new MemoryViewAgent(currentEngine(), dialog.address());
|
currentEngine()->openMemoryView(dialog.address());
|
||||||
} else if (act == actSetWatchpointAtVariableAddress) {
|
} else if (act == actSetWatchpointAtVariableAddress) {
|
||||||
setWatchpoint(address);
|
setWatchpoint(address);
|
||||||
} else if (act == actSetWatchpointAtPointerValue) {
|
} else if (act == actSetWatchpointAtPointerValue) {
|
||||||
|
|||||||
Reference in New Issue
Block a user