forked from qt-creator/qt-creator
debugger: kill command handler & company
This commit is contained in:
@@ -180,26 +180,6 @@ enum ModelRoles
|
|||||||
RequestActivationRole,
|
RequestActivationRole,
|
||||||
RequestContextMenuRole,
|
RequestContextMenuRole,
|
||||||
|
|
||||||
// Running
|
|
||||||
RequestExecContinueRole,
|
|
||||||
RequestExecInterruptRole,
|
|
||||||
RequestExecResetRole,
|
|
||||||
RequestExecStepRole,
|
|
||||||
RequestExecStepOutRole,
|
|
||||||
RequestExecNextRole,
|
|
||||||
RequestExecRunToLineRole,
|
|
||||||
RequestExecRunToFunctionRole,
|
|
||||||
RequestExecReturnFromFunctionRole,
|
|
||||||
RequestExecJumpToLineRole,
|
|
||||||
RequestExecWatchRole,
|
|
||||||
RequestExecSnapshotRole,
|
|
||||||
RequestExecFrameDownRole,
|
|
||||||
RequestExecFrameUpRole,
|
|
||||||
RequestExecDetachRole,
|
|
||||||
RequestExecExitRole,
|
|
||||||
RequestOperatedByInstructionTriggeredRole,
|
|
||||||
RequestExecuteCommandRole,
|
|
||||||
|
|
||||||
// Locals and Watchers
|
// Locals and Watchers
|
||||||
LocalsINameRole,
|
LocalsINameRole,
|
||||||
LocalsEditTypeRole, // A QVariant::type describing the item
|
LocalsEditTypeRole, // A QVariant::type describing the item
|
||||||
|
|||||||
@@ -50,7 +50,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/ifile.h>
|
#include <coreplugin/ifile.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <coreplugin/progressmanager/futureprogress.h>
|
#include <coreplugin/progressmanager/futureprogress.h>
|
||||||
|
|
||||||
@@ -180,30 +179,6 @@ const char *DebuggerEngine::stateName(int s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// CommandHandler
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class CommandHandler : public QStandardItemModel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit CommandHandler(DebuggerEngine *engine) : m_engine(engine) {}
|
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
|
||||||
QAbstractItemModel *model() { return this; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPointer<DebuggerEngine> m_engine;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool CommandHandler::setData(const QModelIndex &, const QVariant &value, int role)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(m_engine, qDebug() << value << role; return false);
|
|
||||||
m_engine->handleCommand(role, value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// DebuggerEnginePrivate
|
// DebuggerEnginePrivate
|
||||||
@@ -223,7 +198,6 @@ public:
|
|||||||
m_state(DebuggerNotReady),
|
m_state(DebuggerNotReady),
|
||||||
m_lastGoodState(DebuggerNotReady),
|
m_lastGoodState(DebuggerNotReady),
|
||||||
m_targetState(DebuggerNotReady),
|
m_targetState(DebuggerNotReady),
|
||||||
m_commandHandler(engine),
|
|
||||||
m_modulesHandler(),
|
m_modulesHandler(),
|
||||||
m_registerHandler(),
|
m_registerHandler(),
|
||||||
m_sourceFilesHandler(),
|
m_sourceFilesHandler(),
|
||||||
@@ -309,7 +283,6 @@ public:
|
|||||||
|
|
||||||
qint64 m_inferiorPid;
|
qint64 m_inferiorPid;
|
||||||
|
|
||||||
CommandHandler m_commandHandler;
|
|
||||||
ModulesHandler m_modulesHandler;
|
ModulesHandler m_modulesHandler;
|
||||||
RegisterHandler m_registerHandler;
|
RegisterHandler m_registerHandler;
|
||||||
SourceFilesHandler m_sourceFilesHandler;
|
SourceFilesHandler m_sourceFilesHandler;
|
||||||
@@ -389,105 +362,6 @@ void DebuggerEnginePrivate::slotEditBreakpoint()
|
|||||||
BreakWindow::editBreakpoint(breakPointData, ICore::instance()->mainWindow());
|
BreakWindow::editBreakpoint(breakPointData, ICore::instance()->mainWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEnginePrivate::handleContextMenuRequest(const QVariant ¶meters)
|
|
||||||
{
|
|
||||||
const QList<QVariant> list = parameters.toList();
|
|
||||||
QTC_ASSERT(list.size() == 3, qDebug() << list; return);
|
|
||||||
TextEditor::ITextEditor *editor =
|
|
||||||
(TextEditor::ITextEditor *)(list.at(0).value<quint64>());
|
|
||||||
const int lineNumber = list.at(1).toInt();
|
|
||||||
QMenu *menu = (QMenu *)(list.at(2).value<quint64>());
|
|
||||||
|
|
||||||
BreakpointData *data = 0;
|
|
||||||
QString fileName;
|
|
||||||
quint64 address = 0;
|
|
||||||
|
|
||||||
if (editor->property("DisassemblerView").toBool()) {
|
|
||||||
fileName = editor->file()->fileName();
|
|
||||||
QString line = editor->contents()
|
|
||||||
.section('\n', lineNumber - 1, lineNumber - 1);
|
|
||||||
BreakpointData needle;
|
|
||||||
address = DisassemblerViewAgent::addressFromDisassemblyLine(line);
|
|
||||||
needle.address = address;
|
|
||||||
needle.bpLineNumber = -1;
|
|
||||||
data = m_engine->breakHandler()->findSimilarBreakpoint(&needle);
|
|
||||||
} else {
|
|
||||||
fileName = editor->file()->fileName();
|
|
||||||
data = m_engine->breakHandler()->findBreakpoint(fileName, lineNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(fileName);
|
|
||||||
args.append(lineNumber);
|
|
||||||
args.append(address);
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
// existing breakpoint
|
|
||||||
const QString number = QString::fromAscii(data->bpNumber);
|
|
||||||
QAction *act;
|
|
||||||
if (number.isEmpty())
|
|
||||||
act = new QAction(tr("Remove Breakpoint"), menu);
|
|
||||||
else
|
|
||||||
act = new QAction(tr("Remove Breakpoint %1").arg(number), menu);
|
|
||||||
act->setData(args);
|
|
||||||
connect(act, SIGNAL(triggered()),
|
|
||||||
SLOT(breakpointSetRemoveMarginActionTriggered()));
|
|
||||||
menu->addAction(act);
|
|
||||||
|
|
||||||
QAction *act2;
|
|
||||||
if (data->enabled)
|
|
||||||
if (number.isEmpty())
|
|
||||||
act2 = new QAction(tr("Disable Breakpoint"), menu);
|
|
||||||
else
|
|
||||||
act2 = new QAction(tr("Disable Breakpoint %1").arg(number), menu);
|
|
||||||
else
|
|
||||||
if (number.isEmpty())
|
|
||||||
act2 = new QAction(tr("Enable Breakpoint"), menu);
|
|
||||||
else
|
|
||||||
act2 = new QAction(tr("Enable Breakpoint %1").arg(number), menu);
|
|
||||||
act2->setData(args);
|
|
||||||
connect(act2, SIGNAL(triggered()),
|
|
||||||
this, SLOT(breakpointEnableDisableMarginActionTriggered()));
|
|
||||||
menu->addAction(act2);
|
|
||||||
QAction *editAction;
|
|
||||||
if (number.isEmpty())
|
|
||||||
editAction = new QAction(tr("Edit Breakpoint..."), menu);
|
|
||||||
else
|
|
||||||
editAction = new QAction(tr("Edit Breakpoint %1...").arg(number), menu);
|
|
||||||
connect(editAction, SIGNAL(triggered()), SLOT(slotEditBreakpoint()));
|
|
||||||
editAction->setData(qVariantFromValue(data));
|
|
||||||
menu->addAction(editAction);
|
|
||||||
} else {
|
|
||||||
// non-existing
|
|
||||||
const QString text = address ?
|
|
||||||
tr("Set Breakpoint at 0x%1").arg(address, 0, 16) :
|
|
||||||
tr("Set Breakpoint at line %1").arg(lineNumber);
|
|
||||||
QAction *act = new QAction(text, menu);
|
|
||||||
act->setData(args);
|
|
||||||
connect(act, SIGNAL(triggered()),
|
|
||||||
SLOT(breakpointSetRemoveMarginActionTriggered()));
|
|
||||||
menu->addAction(act);
|
|
||||||
}
|
|
||||||
// Run to, jump to line below in stopped state.
|
|
||||||
if (state() == InferiorStopOk) {
|
|
||||||
menu->addSeparator();
|
|
||||||
const QString runText = DebuggerEngine::tr("Run to Line %1").
|
|
||||||
arg(lineNumber);
|
|
||||||
QAction *runToLineAction = new QAction(runText, menu);
|
|
||||||
runToLineAction->setData(args);
|
|
||||||
connect(runToLineAction, SIGNAL(triggered()), this, SLOT(slotRunToLine()));
|
|
||||||
menu->addAction(runToLineAction);
|
|
||||||
if (m_engine->debuggerCapabilities() & JumpToLineCapability) {
|
|
||||||
const QString jumpText = DebuggerEngine::tr("Jump to Line %1").
|
|
||||||
arg(lineNumber);
|
|
||||||
QAction *jumpToLineAction = new QAction(jumpText, menu);
|
|
||||||
menu->addAction(runToLineAction);
|
|
||||||
jumpToLineAction->setData(args);
|
|
||||||
connect(jumpToLineAction, SIGNAL(triggered()), this, SLOT(slotJumpToLine()));
|
|
||||||
menu->addAction(jumpToLineAction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -517,92 +391,6 @@ void DebuggerEngine::removeTooltip()
|
|||||||
hideDebuggerToolTip();
|
hideDebuggerToolTip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::handleCommand(int role, const QVariant &value)
|
|
||||||
{
|
|
||||||
removeTooltip();
|
|
||||||
|
|
||||||
switch (role) {
|
|
||||||
case RequestExecDetachRole:
|
|
||||||
detachDebugger();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecContinueRole:
|
|
||||||
continueInferior();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecInterruptRole:
|
|
||||||
requestInterruptInferior();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecResetRole:
|
|
||||||
notifyEngineIll(); // FIXME: check
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecStepRole:
|
|
||||||
executeStepX();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecStepOutRole:
|
|
||||||
executeStepOutX();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecNextRole:
|
|
||||||
executeStepNextX();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecRunToLineRole:
|
|
||||||
executeRunToLine();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecRunToFunctionRole:
|
|
||||||
executeRunToFunction();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecReturnFromFunctionRole:
|
|
||||||
executeReturnX();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecJumpToLineRole:
|
|
||||||
executeJumpToLine();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecWatchRole:
|
|
||||||
addToWatchWindow();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecExitRole:
|
|
||||||
d->queueShutdownInferior();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestActivationRole:
|
|
||||||
setActive(value.toBool());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecFrameDownRole:
|
|
||||||
frameDown();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecFrameUpRole:
|
|
||||||
frameUp();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestOperatedByInstructionTriggeredRole:
|
|
||||||
gotoLocation(stackHandler()->currentFrame(), true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestExecuteCommandRole:
|
|
||||||
executeDebuggerCommand(value.toString());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestContextMenuRole: {
|
|
||||||
QList<QVariant> list = value.toList();
|
|
||||||
QTC_ASSERT(list.size() == 3, break);
|
|
||||||
d->handleContextMenuRequest(list);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEngine::showModuleSymbols
|
void DebuggerEngine::showModuleSymbols
|
||||||
(const QString &moduleName, const Symbols &symbols)
|
(const QString &moduleName, const Symbols &symbols)
|
||||||
{
|
{
|
||||||
@@ -734,14 +522,6 @@ QAbstractItemModel *DebuggerEngine::sourceFilesModel() const
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractItemModel *DebuggerEngine::commandModel() const
|
|
||||||
{
|
|
||||||
QAbstractItemModel *model = d->m_commandHandler.model();
|
|
||||||
if (model->objectName().isEmpty()) // Make debugging easier.
|
|
||||||
model->setObjectName(objectName() + QLatin1String("CommandModel"));
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEngine::fetchMemory(MemoryViewAgent *, QObject *,
|
void DebuggerEngine::fetchMemory(MemoryViewAgent *, QObject *,
|
||||||
quint64 addr, quint64 length)
|
quint64 addr, quint64 length)
|
||||||
{
|
{
|
||||||
@@ -845,35 +625,6 @@ void DebuggerEngine::gotoLocation(const StackFrame &frame, bool setMarker)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::executeStepX()
|
|
||||||
{
|
|
||||||
resetLocation();
|
|
||||||
if (theDebuggerBoolSetting(OperateByInstruction))
|
|
||||||
executeStepI();
|
|
||||||
else
|
|
||||||
executeStep();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEngine::executeStepOutX()
|
|
||||||
{
|
|
||||||
resetLocation();
|
|
||||||
executeStepOut();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEngine::executeStepNextX()
|
|
||||||
{
|
|
||||||
resetLocation();
|
|
||||||
if (theDebuggerBoolSetting(OperateByInstruction))
|
|
||||||
executeNextI();
|
|
||||||
else
|
|
||||||
executeNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEngine::executeReturnX()
|
|
||||||
{
|
|
||||||
resetLocation();
|
|
||||||
executeReturn();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEngine::executeRunToLine()
|
void DebuggerEngine::executeRunToLine()
|
||||||
{
|
{
|
||||||
@@ -925,40 +676,11 @@ void DebuggerEngine::executeJumpToLine()
|
|||||||
executeJumpToLine(fileName, lineNumber);
|
executeJumpToLine(fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::addToWatchWindow()
|
|
||||||
{
|
|
||||||
// Requires a selection, but that's the only case we want anyway.
|
|
||||||
EditorManager *editorManager = EditorManager::instance();
|
|
||||||
if (!editorManager)
|
|
||||||
return;
|
|
||||||
IEditor *editor = editorManager->currentEditor();
|
|
||||||
if (!editor)
|
|
||||||
return;
|
|
||||||
ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor);
|
|
||||||
if (!textEditor)
|
|
||||||
return;
|
|
||||||
QTextCursor tc;
|
|
||||||
QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit*>(editor->widget());
|
|
||||||
if (ptEdit)
|
|
||||||
tc = ptEdit->textCursor();
|
|
||||||
QString exp;
|
|
||||||
if (tc.hasSelection()) {
|
|
||||||
exp = tc.selectedText();
|
|
||||||
} else {
|
|
||||||
int line, column;
|
|
||||||
exp = cppExpressionAt(textEditor, tc.position(), &line, &column);
|
|
||||||
}
|
|
||||||
if (exp.isEmpty())
|
|
||||||
return;
|
|
||||||
watchHandler()->watchExpression(exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called from RunControl.
|
// Called from RunControl.
|
||||||
void DebuggerEngine::handleStartFailed()
|
void DebuggerEngine::handleStartFailed()
|
||||||
{
|
{
|
||||||
showMessage("HANDLE RUNCONTROL START FAILED");
|
showMessage("HANDLE RUNCONTROL START FAILED");
|
||||||
d->m_runControl = 0;
|
d->m_runControl = 0;
|
||||||
|
|
||||||
d->m_progress.setProgressValue(900);
|
d->m_progress.setProgressValue(900);
|
||||||
d->m_progress.reportCanceled();
|
d->m_progress.reportCanceled();
|
||||||
d->m_progress.reportFinished();
|
d->m_progress.reportFinished();
|
||||||
@@ -973,7 +695,6 @@ void DebuggerEngine::handleFinished()
|
|||||||
stackHandler()->removeAll();
|
stackHandler()->removeAll();
|
||||||
threadsHandler()->removeAll();
|
threadsHandler()->removeAll();
|
||||||
watchHandler()->cleanup();
|
watchHandler()->cleanup();
|
||||||
|
|
||||||
d->m_progress.setProgressValue(1000);
|
d->m_progress.setProgressValue(1000);
|
||||||
d->m_progress.reportFinished();
|
d->m_progress.reportFinished();
|
||||||
}
|
}
|
||||||
@@ -1586,11 +1307,13 @@ DebuggerRunControl *DebuggerEngine::runControl() const
|
|||||||
return d->m_runControl;
|
return d->m_runControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::setToolTipExpression(const QPoint &, TextEditor::ITextEditor *, int)
|
void DebuggerEngine::setToolTipExpression
|
||||||
|
(const QPoint &, TextEditor::ITextEditor *, int)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::updateWatchData(const Internal::WatchData &, const Internal::WatchUpdateFlags &)
|
void DebuggerEngine::updateWatchData
|
||||||
|
(const Internal::WatchData &, const Internal::WatchUpdateFlags &)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1678,7 +1401,8 @@ void DebuggerEngine::selectThread(int)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::assignValueInDebugger(const Internal::WatchData *, const QString &, const QVariant &)
|
void DebuggerEngine::assignValueInDebugger
|
||||||
|
(const Internal::WatchData *, const QString &, const QVariant &)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1686,6 +1410,11 @@ void DebuggerEngine::detachDebugger()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerEngine::exitInferior()
|
||||||
|
{
|
||||||
|
d->queueShutdownInferior();
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerEngine::executeStep()
|
void DebuggerEngine::executeStep()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,9 +55,10 @@ class IOptionsPage;
|
|||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
class DebuggerRunControl;
|
|
||||||
class DebuggerPlugin;
|
|
||||||
class DebuggerEnginePrivate;
|
class DebuggerEnginePrivate;
|
||||||
|
class DebuggerPlugin;
|
||||||
|
class DebuggerPluginPrivate;
|
||||||
|
class DebuggerRunControl;
|
||||||
class QmlCppEngine;
|
class QmlCppEngine;
|
||||||
|
|
||||||
class DEBUGGER_EXPORT DebuggerStartParameters
|
class DEBUGGER_EXPORT DebuggerStartParameters
|
||||||
@@ -136,8 +137,10 @@ struct WatchUpdateFlags
|
|||||||
WatchUpdateFlags() : tryIncremental(false) {}
|
WatchUpdateFlags() : tryIncremental(false) {}
|
||||||
bool tryIncremental;
|
bool tryIncremental;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
|
|
||||||
// FIXME: DEBUGGER_EXPORT?
|
// FIXME: DEBUGGER_EXPORT?
|
||||||
class DEBUGGER_EXPORT DebuggerEngine : public QObject
|
class DEBUGGER_EXPORT DebuggerEngine : public QObject
|
||||||
{
|
{
|
||||||
@@ -148,7 +151,7 @@ public:
|
|||||||
virtual ~DebuggerEngine();
|
virtual ~DebuggerEngine();
|
||||||
|
|
||||||
virtual void setToolTipExpression(const QPoint & mousePos,
|
virtual void setToolTipExpression(const QPoint & mousePos,
|
||||||
TextEditor::ITextEditor * editor, int cursorPos);
|
TextEditor::ITextEditor *editor, int cursorPos);
|
||||||
void initializeFromTemplate(DebuggerEngine *other);
|
void initializeFromTemplate(DebuggerEngine *other);
|
||||||
|
|
||||||
virtual void updateWatchData(const Internal::WatchData &data,
|
virtual void updateWatchData(const Internal::WatchData &data,
|
||||||
@@ -185,7 +188,8 @@ public:
|
|||||||
virtual bool acceptsBreakpoint(const Internal::BreakpointData *);
|
virtual bool acceptsBreakpoint(const Internal::BreakpointData *);
|
||||||
virtual void selectThread(int index);
|
virtual void selectThread(int index);
|
||||||
|
|
||||||
virtual void assignValueInDebugger(const Internal::WatchData *w, const QString &expr, const QVariant &value);
|
virtual void assignValueInDebugger(const Internal::WatchData *data,
|
||||||
|
const QString &expr, const QVariant &value);
|
||||||
virtual void removeTooltip();
|
virtual void removeTooltip();
|
||||||
|
|
||||||
// Convenience
|
// Convenience
|
||||||
@@ -193,6 +197,7 @@ public:
|
|||||||
(int icon, const QString &title, const QString &text, int buttons = 0);
|
(int icon, const QString &title, const QString &text, int buttons = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
friend class DebuggerPluginPrivate;
|
||||||
virtual void detachDebugger();
|
virtual void detachDebugger();
|
||||||
virtual void executeStep();
|
virtual void executeStep();
|
||||||
virtual void executeStepOut() ;
|
virtual void executeStepOut() ;
|
||||||
@@ -203,11 +208,11 @@ protected:
|
|||||||
|
|
||||||
virtual void continueInferior();
|
virtual void continueInferior();
|
||||||
virtual void interruptInferior();
|
virtual void interruptInferior();
|
||||||
|
virtual void exitInferior();
|
||||||
|
|
||||||
virtual void requestInterruptInferior();
|
virtual void requestInterruptInferior();
|
||||||
|
|
||||||
virtual void executeRunToLine(const QString &fileName, int lineNumber);
|
virtual void executeRunToLine(const QString &fileName, int lineNumber);
|
||||||
|
|
||||||
virtual void executeRunToFunction(const QString &functionName);
|
virtual void executeRunToFunction(const QString &functionName);
|
||||||
virtual void executeJumpToLine(const QString &fileName, int lineNumber);
|
virtual void executeJumpToLine(const QString &fileName, int lineNumber);
|
||||||
virtual void executeDebuggerCommand(const QString &command);
|
virtual void executeDebuggerCommand(const QString &command);
|
||||||
@@ -228,7 +233,6 @@ public:
|
|||||||
Internal::SourceFilesHandler *sourceFilesHandler() const;
|
Internal::SourceFilesHandler *sourceFilesHandler() const;
|
||||||
Internal::BreakHandler *breakHandler() const;
|
Internal::BreakHandler *breakHandler() const;
|
||||||
|
|
||||||
virtual QAbstractItemModel *commandModel() const;
|
|
||||||
virtual QAbstractItemModel *modulesModel() const;
|
virtual QAbstractItemModel *modulesModel() const;
|
||||||
virtual QAbstractItemModel *registerModel() const;
|
virtual QAbstractItemModel *registerModel() const;
|
||||||
virtual QAbstractItemModel *stackModel() const;
|
virtual QAbstractItemModel *stackModel() const;
|
||||||
|
|||||||
@@ -48,11 +48,13 @@
|
|||||||
#include "moduleswindow.h"
|
#include "moduleswindow.h"
|
||||||
#include "registerwindow.h"
|
#include "registerwindow.h"
|
||||||
#include "snapshotwindow.h"
|
#include "snapshotwindow.h"
|
||||||
|
#include "stackhandler.h"
|
||||||
#include "stackwindow.h"
|
#include "stackwindow.h"
|
||||||
#include "sourcefileswindow.h"
|
#include "sourcefileswindow.h"
|
||||||
#include "threadswindow.h"
|
#include "threadswindow.h"
|
||||||
#include "watchhandler.h"
|
#include "watchhandler.h"
|
||||||
#include "watchwindow.h"
|
#include "watchwindow.h"
|
||||||
|
#include "watchutils.h"
|
||||||
|
|
||||||
#include "snapshothandler.h"
|
#include "snapshothandler.h"
|
||||||
#include "threadshandler.h"
|
#include "threadshandler.h"
|
||||||
@@ -105,6 +107,7 @@
|
|||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QDockWidget>
|
#include <QtGui/QDockWidget>
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
@@ -227,15 +230,18 @@
|
|||||||
// EngineShutdownRequested +
|
// EngineShutdownRequested +
|
||||||
// + +
|
// + +
|
||||||
// (calls *Engine->shutdownEngine()) <+-+-+-+-+-+-+-+-+-+-+-+-+-+'
|
// (calls *Engine->shutdownEngine()) <+-+-+-+-+-+-+-+-+-+-+-+-+-+'
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// {notify- {notify-
|
// {notify- {notify-
|
||||||
// Engine- Engine-
|
// Engine- Engine-
|
||||||
// ShutdownOk} ShutdownFailed}
|
// ShutdownOk} ShutdownFailed}
|
||||||
// + +
|
// + +
|
||||||
// EngineShutdownOk EngineShutdownFailed
|
// EngineShutdownOk EngineShutdownFailed
|
||||||
// * *
|
// * *
|
||||||
// DebuggerFinished
|
// DebuggerFinished
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
/* Here is a matching graph as a GraphViz graph. View it using
|
/* Here is a matching graph as a GraphViz graph. View it using
|
||||||
* \code
|
* \code
|
||||||
grep "^sg1:" debuggerplugin.cpp | cut -c5- | dot -osg1.ps -Tps && gv sg1.ps
|
grep "^sg1:" debuggerplugin.cpp | cut -c5- | dot -osg1.ps -Tps && gv sg1.ps
|
||||||
@@ -794,14 +800,6 @@ static bool isDebuggable(Core::IEditor *editor)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TextEditor::ITextEditor *currentTextEditor()
|
|
||||||
{
|
|
||||||
EditorManager *editorManager = EditorManager::instance();
|
|
||||||
if (!editorManager)
|
|
||||||
return 0;
|
|
||||||
Core::IEditor *editor = editorManager->currentEditor();
|
|
||||||
return qobject_cast<ITextEditor*>(editor);
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -851,7 +849,6 @@ public:
|
|||||||
explicit DebuggerPluginPrivate(DebuggerPlugin *plugin);
|
explicit DebuggerPluginPrivate(DebuggerPlugin *plugin);
|
||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *errorMessage);
|
bool initialize(const QStringList &arguments, QString *errorMessage);
|
||||||
void notifyCurrentEngine(int role, const QVariant &value = QVariant());
|
|
||||||
void connectEngine(DebuggerEngine *engine, bool notify = true);
|
void connectEngine(DebuggerEngine *engine, bool notify = true);
|
||||||
void disconnectEngine() { connectEngine(0); }
|
void disconnectEngine() { connectEngine(0); }
|
||||||
DebuggerEngine *currentEngine() const { return m_currentEngine; }
|
DebuggerEngine *currentEngine() const { return m_currentEngine; }
|
||||||
@@ -900,7 +897,6 @@ public slots:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onAction();
|
|
||||||
void setSimpleDockWidgetArrangement(Debugger::DebuggerLanguages activeLanguages);
|
void setSimpleDockWidgetArrangement(Debugger::DebuggerLanguages activeLanguages);
|
||||||
|
|
||||||
void editorOpened(Core::IEditor *editor);
|
void editorOpened(Core::IEditor *editor);
|
||||||
@@ -968,6 +964,111 @@ public slots:
|
|||||||
void scriptExpressionEntered(const QString &expression);
|
void scriptExpressionEntered(const QString &expression);
|
||||||
void coreShutdown();
|
void coreShutdown();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void handleExecDetach() { currentEngine()->detachDebugger(); }
|
||||||
|
void handleExecContinue() { currentEngine()->continueInferior(); }
|
||||||
|
void handleExecInterrupt() { currentEngine()->requestInterruptInferior(); }
|
||||||
|
void handleExecReset() { currentEngine()->notifyEngineIll(); } // FIXME: Check.
|
||||||
|
|
||||||
|
void handleExecStep()
|
||||||
|
{
|
||||||
|
resetLocation();
|
||||||
|
if (theDebuggerBoolSetting(OperateByInstruction))
|
||||||
|
currentEngine()->executeStepI();
|
||||||
|
else
|
||||||
|
currentEngine()->executeStep();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleExecNext()
|
||||||
|
{
|
||||||
|
resetLocation();
|
||||||
|
if (theDebuggerBoolSetting(OperateByInstruction))
|
||||||
|
currentEngine()->executeNextI();
|
||||||
|
else
|
||||||
|
currentEngine()->executeNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleExecStepOut() { resetLocation(); currentEngine()->executeStepOut(); }
|
||||||
|
void handleExecReturn() { resetLocation(); currentEngine()->executeReturn(); }
|
||||||
|
|
||||||
|
void handleExecJumpToLine()
|
||||||
|
{
|
||||||
|
//removeTooltip();
|
||||||
|
resetLocation();
|
||||||
|
currentEngine()->executeJumpToLine(); // FIXME: move code from engine here.
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleExecRunToLine()
|
||||||
|
{
|
||||||
|
//removeTooltip();
|
||||||
|
resetLocation();
|
||||||
|
currentEngine()->executeRunToLine(); // FIXME: move code from engine here.
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleExecRunToFunction()
|
||||||
|
{
|
||||||
|
resetLocation();
|
||||||
|
currentEngine()->executeRunToFunction(); // FIXME: move code from engine here.
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleAddToWatchWindow()
|
||||||
|
{
|
||||||
|
// Requires a selection, but that's the only case we want anyway.
|
||||||
|
EditorManager *editorManager = EditorManager::instance();
|
||||||
|
if (!editorManager)
|
||||||
|
return;
|
||||||
|
IEditor *editor = editorManager->currentEditor();
|
||||||
|
if (!editor)
|
||||||
|
return;
|
||||||
|
ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor);
|
||||||
|
if (!textEditor)
|
||||||
|
return;
|
||||||
|
QTextCursor tc;
|
||||||
|
QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit*>(editor->widget());
|
||||||
|
if (ptEdit)
|
||||||
|
tc = ptEdit->textCursor();
|
||||||
|
QString exp;
|
||||||
|
if (tc.hasSelection()) {
|
||||||
|
exp = tc.selectedText();
|
||||||
|
} else {
|
||||||
|
int line, column;
|
||||||
|
exp = cppExpressionAt(textEditor, tc.position(), &line, &column);
|
||||||
|
}
|
||||||
|
if (exp.isEmpty())
|
||||||
|
return;
|
||||||
|
currentEngine()->watchHandler()->watchExpression(exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleExecExit()
|
||||||
|
{
|
||||||
|
currentEngine()->exitInferior();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleFrameDown()
|
||||||
|
{
|
||||||
|
currentEngine()->frameDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleFrameUp()
|
||||||
|
{
|
||||||
|
currentEngine()->frameUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleOperateByInstructionTriggered()
|
||||||
|
{
|
||||||
|
currentEngine()->gotoLocation(
|
||||||
|
currentEngine()->stackHandler()->currentFrame(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetLocation()
|
||||||
|
{
|
||||||
|
// FIXME: code should be moved here.
|
||||||
|
currentEngine()->resetLocation();
|
||||||
|
//d->m_disassemblerViewAgent.resetLocation();
|
||||||
|
//d->m_stackHandler.setCurrentIndex(-1);
|
||||||
|
//plugin()->resetLocation();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerState m_state;
|
DebuggerState m_state;
|
||||||
DebuggerUISwitcher *m_uiSwitcher;
|
DebuggerUISwitcher *m_uiSwitcher;
|
||||||
@@ -1022,7 +1123,6 @@ public:
|
|||||||
QTreeView *m_returnWindow;
|
QTreeView *m_returnWindow;
|
||||||
QTreeView *m_localsWindow;
|
QTreeView *m_localsWindow;
|
||||||
QTreeView *m_watchersWindow;
|
QTreeView *m_watchersWindow;
|
||||||
QTreeView *m_commandWindow;
|
|
||||||
QAbstractItemView *m_registerWindow;
|
QAbstractItemView *m_registerWindow;
|
||||||
QAbstractItemView *m_modulesWindow;
|
QAbstractItemView *m_modulesWindow;
|
||||||
QAbstractItemView *m_snapshotWindow;
|
QAbstractItemView *m_snapshotWindow;
|
||||||
@@ -1159,7 +1259,6 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
|
|||||||
m_localsWindow->setObjectName(QLatin1String("CppDebugLocals"));
|
m_localsWindow->setObjectName(QLatin1String("CppDebugLocals"));
|
||||||
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
|
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
|
||||||
m_watchersWindow->setObjectName(QLatin1String("CppDebugWatchers"));
|
m_watchersWindow->setObjectName(QLatin1String("CppDebugWatchers"));
|
||||||
m_commandWindow = new QTreeView;
|
|
||||||
m_scriptConsoleWindow = new ScriptConsole;
|
m_scriptConsoleWindow = new ScriptConsole;
|
||||||
m_scriptConsoleWindow->setWindowTitle(tr("QML Script Console"));
|
m_scriptConsoleWindow->setWindowTitle(tr("QML Script Console"));
|
||||||
m_scriptConsoleWindow->setObjectName(QLatin1String("QMLScriptConsole"));
|
m_scriptConsoleWindow->setObjectName(QLatin1String("QMLScriptConsole"));
|
||||||
@@ -1177,114 +1276,93 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
// Watchers
|
// Watchers
|
||||||
connect(m_localsWindow->header(), SIGNAL(sectionResized(int,int,int)),
|
connect(m_localsWindow->header(), SIGNAL(sectionResized(int,int,int)),
|
||||||
this, SLOT(updateWatchersHeader(int,int,int)), Qt::QueuedConnection);
|
SLOT(updateWatchersHeader(int,int,int)), Qt::QueuedConnection);
|
||||||
|
|
||||||
m_actions.continueAction = new QAction(tr("Continue"), this);
|
QAction *act = 0;
|
||||||
m_actions.continueAction->setProperty(Role, RequestExecContinueRole);
|
|
||||||
m_actions.continueAction->setIcon(m_continueIcon);
|
|
||||||
|
|
||||||
m_actions.stopAction = new QAction(tr("Stop Debugger"), this);
|
act = m_actions.continueAction = new QAction(tr("Continue"), this);
|
||||||
m_actions.stopAction->setProperty(Role, RequestExecExitRole);
|
act->setIcon(m_continueIcon);
|
||||||
m_actions.stopAction->setIcon(m_stopIcon);
|
connect(act, SIGNAL(triggered()), SLOT(handleExecContinue()));
|
||||||
|
|
||||||
m_actions.interruptAction = new QAction(tr("Interrupt"), this);
|
act = m_actions.stopAction = new QAction(tr("Stop Debugger"), this);
|
||||||
m_actions.interruptAction->setIcon(m_interruptIcon);
|
act->setIcon(m_stopIcon);
|
||||||
m_actions.interruptAction->setProperty(Role, RequestExecInterruptRole);
|
connect(act, SIGNAL(triggered()), SLOT(handleExecExit()));
|
||||||
|
|
||||||
|
act = m_actions.interruptAction = new QAction(tr("Interrupt"), this);
|
||||||
|
act->setIcon(m_interruptIcon);
|
||||||
|
connect(act, SIGNAL(triggered()), SLOT(handleExecInterrupt()));
|
||||||
|
|
||||||
m_actions.undisturbableAction = new QAction(tr("Debugger is Busy"), this);
|
|
||||||
// A "disabled pause" seems to be a good choice.
|
// A "disabled pause" seems to be a good choice.
|
||||||
m_actions.undisturbableAction->setIcon(m_interruptIcon);
|
act = m_actions.undisturbableAction = new QAction(tr("Debugger is Busy"), this);
|
||||||
m_actions.undisturbableAction->setEnabled(false);
|
act->setIcon(m_interruptIcon);
|
||||||
|
act->setEnabled(false);
|
||||||
|
|
||||||
m_actions.resetAction = new QAction(tr("Abort Debugging"), this);
|
act = m_actions.resetAction = new QAction(tr("Abort Debugging"), this);
|
||||||
m_actions.resetAction->setProperty(Role, RequestExecResetRole);
|
act->setToolTip(tr("Aborts debugging and "
|
||||||
m_actions.resetAction->setToolTip(tr("Aborts debugging and "
|
|
||||||
"resets the debugger to the initial state."));
|
"resets the debugger to the initial state."));
|
||||||
|
connect(act, SIGNAL(triggered()), SLOT(handleExecReset()));
|
||||||
|
|
||||||
m_actions.nextAction = new QAction(tr("Step Over"), this);
|
act = m_actions.nextAction = new QAction(tr("Step Over"), this);
|
||||||
m_actions.nextAction->setProperty(Role, RequestExecNextRole);
|
act->setIcon(QIcon(__(":/debugger/images/debugger_stepover_small.png")));
|
||||||
m_actions.nextAction->setIcon(
|
connect(act, SIGNAL(triggered()), SLOT(handleExecNext()));
|
||||||
QIcon(__(":/debugger/images/debugger_stepover_small.png")));
|
|
||||||
|
|
||||||
m_actions.stepAction = new QAction(tr("Step Into"), this);
|
act = m_actions.stepAction = new QAction(tr("Step Into"), this);
|
||||||
m_actions.stepAction->setProperty(Role, RequestExecStepRole);
|
act->setIcon(QIcon(__(":/debugger/images/debugger_stepinto_small.png")));
|
||||||
m_actions.stepAction->setIcon(
|
connect(act, SIGNAL(triggered()), SLOT(handleExecStep()));
|
||||||
QIcon(__(":/debugger/images/debugger_stepinto_small.png")));
|
|
||||||
|
|
||||||
m_actions.stepOutAction = new QAction(tr("Step Out"), this);
|
act = m_actions.stepOutAction = new QAction(tr("Step Out"), this);
|
||||||
m_actions.stepOutAction->setProperty(Role, RequestExecStepOutRole);
|
act->setIcon(QIcon(__(":/debugger/images/debugger_stepout_small.png")));
|
||||||
m_actions.stepOutAction->setIcon(
|
connect(act, SIGNAL(triggered()), SLOT(handleExecStepOut()));
|
||||||
QIcon(__(":/debugger/images/debugger_stepout_small.png")));
|
|
||||||
|
|
||||||
m_actions.runToLineAction = new QAction(tr("Run to Line"), this);
|
act = m_actions.runToLineAction = new QAction(tr("Run to Line"), this);
|
||||||
m_actions.runToLineAction->setProperty(Role, RequestExecRunToLineRole);
|
connect(act, SIGNAL(triggered()), SLOT(handleExecRunToLine()));
|
||||||
|
|
||||||
m_actions.runToFunctionAction =
|
act = m_actions.runToFunctionAction =
|
||||||
new QAction(tr("Run to Outermost Function"), this);
|
new QAction(tr("Run to Outermost Function"), this);
|
||||||
m_actions.runToFunctionAction->setProperty(Role, RequestExecRunToFunctionRole);
|
connect(act, SIGNAL(triggered()), SLOT(handleExecRunToFunction()));
|
||||||
|
|
||||||
m_actions.returnFromFunctionAction =
|
act = m_actions.returnFromFunctionAction =
|
||||||
new QAction(tr("Immediately Return From Inner Function"), this);
|
new QAction(tr("Immediately Return From Inner Function"), this);
|
||||||
m_actions.returnFromFunctionAction->setProperty(Role, RequestExecReturnFromFunctionRole);
|
connect(act, SIGNAL(triggered()), SLOT(handleExecReturn()));
|
||||||
|
|
||||||
m_actions.jumpToLineAction = new QAction(tr("Jump to Line"), this);
|
act = m_actions.jumpToLineAction = new QAction(tr("Jump to Line"), this);
|
||||||
m_actions.jumpToLineAction->setProperty(Role, RequestExecJumpToLineRole);
|
connect(act, SIGNAL(triggered()), SLOT(handleExecJumpToLine()));
|
||||||
|
|
||||||
m_actions.breakAction = new QAction(tr("Toggle Breakpoint"), this);
|
act = m_actions.breakAction = new QAction(tr("Toggle Breakpoint"), this);
|
||||||
|
|
||||||
m_actions.watchAction1 = new QAction(tr("Add to Watch Window"), this);
|
act = m_actions.watchAction1 = new QAction(tr("Add to Watch Window"), this);
|
||||||
m_actions.watchAction1->setProperty(Role, RequestExecWatchRole);
|
connect(act, SIGNAL(triggered()), SLOT(handleAddToWatchWindow()));
|
||||||
m_actions.watchAction2 = new QAction(tr("Add to Watch Window"), this);
|
|
||||||
m_actions.watchAction2->setProperty(Role, RequestExecWatchRole);
|
act = m_actions.watchAction2 = new QAction(tr("Add to Watch Window"), this);
|
||||||
|
connect(act, SIGNAL(triggered()), SLOT(handleAddToWatchWindow()));
|
||||||
|
|
||||||
//m_actions.snapshotAction = new QAction(tr("Create Snapshot"), this);
|
//m_actions.snapshotAction = new QAction(tr("Create Snapshot"), this);
|
||||||
//m_actions.snapshotAction->setProperty(Role, RequestCreateSnapshotRole);
|
//m_actions.snapshotAction->setProperty(Role, RequestCreateSnapshotRole);
|
||||||
//m_actions.snapshotAction->setIcon(
|
//m_actions.snapshotAction->setIcon(
|
||||||
// QIcon(__(":/debugger/images/debugger_snapshot_small.png")));
|
// QIcon(__(":/debugger/images/debugger_snapshot_small.png")));
|
||||||
|
|
||||||
m_actions.reverseDirectionAction =
|
act = m_actions.reverseDirectionAction =
|
||||||
new QAction(tr("Reverse Direction"), this);
|
new QAction(tr("Reverse Direction"), this);
|
||||||
m_actions.reverseDirectionAction->setCheckable(true);
|
act->setCheckable(true);
|
||||||
m_actions.reverseDirectionAction->setChecked(false);
|
act->setChecked(false);
|
||||||
m_actions.reverseDirectionAction->setIcon(
|
act->setCheckable(false);
|
||||||
QIcon(__(":/debugger/images/debugger_reversemode_16.png")));
|
act->setIcon(QIcon(__(":/debugger/images/debugger_reversemode_16.png")));
|
||||||
m_actions.reverseDirectionAction->setIconVisibleInMenu(false);
|
act->setIconVisibleInMenu(false);
|
||||||
|
|
||||||
m_actions.frameDownAction =
|
act = m_actions.frameDownAction = new QAction(tr("Move to Called Frame"), this);
|
||||||
new QAction(tr("Move to Called Frame"), this);
|
connect(act, SIGNAL(triggered()), SLOT(handleFrameDown()));
|
||||||
m_actions.frameDownAction->setProperty(Role, RequestExecFrameDownRole);
|
|
||||||
m_actions.frameUpAction =
|
|
||||||
new QAction(tr("Move to Calling Frame"), this);
|
|
||||||
m_actions.frameUpAction->setProperty(Role, RequestExecFrameUpRole);
|
|
||||||
|
|
||||||
m_actions.reverseDirectionAction->setCheckable(false);
|
act = m_actions.frameUpAction = new QAction(tr("Move to Calling Frame"), this);
|
||||||
theDebuggerAction(OperateByInstruction)->
|
connect(act, SIGNAL(triggered()), SLOT(handleFrameUp()));
|
||||||
setProperty(Role, RequestOperatedByInstructionTriggeredRole);
|
|
||||||
|
connect(theDebuggerAction(OperateByInstruction), SIGNAL(triggered()),
|
||||||
|
SLOT(handleOperateByInstructionTriggered()));
|
||||||
|
|
||||||
connect(m_actions.continueAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.nextAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.stepAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.stepOutAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.runToLineAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.runToFunctionAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.jumpToLineAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.returnFromFunctionAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.watchAction1, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.watchAction2, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
//connect(m_actions.snapshotAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.frameDownAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.frameUpAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.stopAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.interruptAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(m_actions.resetAction, SIGNAL(triggered()), SLOT(onAction()));
|
|
||||||
connect(&m_statusTimer, SIGNAL(timeout()), SLOT(clearStatusMessage()));
|
connect(&m_statusTimer, SIGNAL(timeout()), SLOT(clearStatusMessage()));
|
||||||
|
|
||||||
connect(theDebuggerAction(ExecuteCommand), SIGNAL(triggered()),
|
connect(theDebuggerAction(ExecuteCommand), SIGNAL(triggered()),
|
||||||
SLOT(executeDebuggerCommand()));
|
SLOT(executeDebuggerCommand()));
|
||||||
|
|
||||||
connect(theDebuggerAction(OperateByInstruction), SIGNAL(triggered()),
|
|
||||||
SLOT(onAction()));
|
|
||||||
|
|
||||||
m_plugin->readSettings();
|
m_plugin->readSettings();
|
||||||
|
|
||||||
// Cpp/Qml ui setup
|
// Cpp/Qml ui setup
|
||||||
@@ -1397,8 +1475,8 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
m_detachAction = new QAction(this);
|
m_detachAction = new QAction(this);
|
||||||
m_detachAction->setText(tr("Detach Debugger"));
|
m_detachAction->setText(tr("Detach Debugger"));
|
||||||
m_detachAction->setProperty(Role, RequestExecDetachRole);
|
connect(m_detachAction, SIGNAL(triggered()),
|
||||||
connect(m_detachAction, SIGNAL(triggered()), SLOT(onAction()));
|
SLOT(handleExecDetach()));
|
||||||
|
|
||||||
|
|
||||||
Core::Command *cmd = 0;
|
Core::Command *cmd = 0;
|
||||||
@@ -1723,14 +1801,6 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
|
|||||||
core->updateAdditionalContexts(m_anyContext, Context());
|
core->updateAdditionalContexts(m_anyContext, Context());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::onAction()
|
|
||||||
{
|
|
||||||
QAction *act = qobject_cast<QAction *>(sender());
|
|
||||||
QTC_ASSERT(act, return);
|
|
||||||
const int role = act->property(Role).toInt();
|
|
||||||
notifyCurrentEngine(role);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::languagesChanged(const DebuggerLanguages &languages)
|
void DebuggerPluginPrivate::languagesChanged(const DebuggerLanguages &languages)
|
||||||
{
|
{
|
||||||
const bool debuggerIsCPP = (languages & CppLanguage);
|
const bool debuggerIsCPP = (languages & CppLanguage);
|
||||||
@@ -1778,13 +1848,6 @@ void DebuggerPluginPrivate::startExternalApplication()
|
|||||||
startDebugger(rc);
|
startDebugger(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::notifyCurrentEngine(int role, const QVariant &value)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(m_commandWindow, return);
|
|
||||||
if (m_commandWindow->model())
|
|
||||||
m_commandWindow->model()->setData(QModelIndex(), value, role);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::attachExternalApplication()
|
void DebuggerPluginPrivate::attachExternalApplication()
|
||||||
{
|
{
|
||||||
AttachExternalDialog dlg(mainWindow());
|
AttachExternalDialog dlg(mainWindow());
|
||||||
@@ -2007,11 +2070,95 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditor::ITextEditor *editor,
|
|||||||
if (!isDebuggable(editor))
|
if (!isDebuggable(editor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QList<QVariant> list;
|
BreakpointData *data = 0;
|
||||||
list.append(quint64(editor));
|
QString fileName;
|
||||||
list.append(lineNumber);
|
quint64 address = 0;
|
||||||
list.append(quint64(menu));
|
|
||||||
notifyCurrentEngine(RequestContextMenuRole, list);
|
if (editor->property("DisassemblerView").toBool()) {
|
||||||
|
fileName = editor->file()->fileName();
|
||||||
|
QString line = editor->contents()
|
||||||
|
.section('\n', lineNumber - 1, lineNumber - 1);
|
||||||
|
BreakpointData needle;
|
||||||
|
address = DisassemblerViewAgent::addressFromDisassemblyLine(line);
|
||||||
|
needle.address = address;
|
||||||
|
needle.bpLineNumber = -1;
|
||||||
|
data = m_breakHandler->findSimilarBreakpoint(&needle);
|
||||||
|
} else {
|
||||||
|
fileName = editor->file()->fileName();
|
||||||
|
data = m_breakHandler->findBreakpoint(fileName, lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(fileName);
|
||||||
|
args.append(lineNumber);
|
||||||
|
args.append(address);
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
// existing breakpoint
|
||||||
|
const QString number = QString::fromAscii(data->bpNumber);
|
||||||
|
QAction *act;
|
||||||
|
if (number.isEmpty())
|
||||||
|
act = new QAction(tr("Remove Breakpoint"), menu);
|
||||||
|
else
|
||||||
|
act = new QAction(tr("Remove Breakpoint %1").arg(number), menu);
|
||||||
|
act->setData(args);
|
||||||
|
connect(act, SIGNAL(triggered()),
|
||||||
|
SLOT(breakpointSetRemoveMarginActionTriggered()));
|
||||||
|
menu->addAction(act);
|
||||||
|
|
||||||
|
QAction *act2;
|
||||||
|
if (data->enabled)
|
||||||
|
if (number.isEmpty())
|
||||||
|
act2 = new QAction(tr("Disable Breakpoint"), menu);
|
||||||
|
else
|
||||||
|
act2 = new QAction(tr("Disable Breakpoint %1").arg(number), menu);
|
||||||
|
else
|
||||||
|
if (number.isEmpty())
|
||||||
|
act2 = new QAction(tr("Enable Breakpoint"), menu);
|
||||||
|
else
|
||||||
|
act2 = new QAction(tr("Enable Breakpoint %1").arg(number), menu);
|
||||||
|
act2->setData(args);
|
||||||
|
connect(act2, SIGNAL(triggered()),
|
||||||
|
this, SLOT(breakpointEnableDisableMarginActionTriggered()));
|
||||||
|
menu->addAction(act2);
|
||||||
|
QAction *editAction;
|
||||||
|
if (number.isEmpty())
|
||||||
|
editAction = new QAction(tr("Edit Breakpoint..."), menu);
|
||||||
|
else
|
||||||
|
editAction = new QAction(tr("Edit Breakpoint %1...").arg(number), menu);
|
||||||
|
connect(editAction, SIGNAL(triggered()), SLOT(slotEditBreakpoint()));
|
||||||
|
editAction->setData(qVariantFromValue(data));
|
||||||
|
menu->addAction(editAction);
|
||||||
|
} else {
|
||||||
|
// non-existing
|
||||||
|
const QString text = address ?
|
||||||
|
tr("Set Breakpoint at 0x%1").arg(address, 0, 16) :
|
||||||
|
tr("Set Breakpoint at line %1").arg(lineNumber);
|
||||||
|
QAction *act = new QAction(text, menu);
|
||||||
|
act->setData(args);
|
||||||
|
connect(act, SIGNAL(triggered()),
|
||||||
|
SLOT(breakpointSetRemoveMarginActionTriggered()));
|
||||||
|
menu->addAction(act);
|
||||||
|
}
|
||||||
|
// Run to, jump to line below in stopped state.
|
||||||
|
if (state() == InferiorStopOk) {
|
||||||
|
menu->addSeparator();
|
||||||
|
const QString runText =
|
||||||
|
DebuggerEngine::tr("Run to Line %1").arg(lineNumber);
|
||||||
|
QAction *runToLineAction = new QAction(runText, menu);
|
||||||
|
runToLineAction->setData(args);
|
||||||
|
connect(runToLineAction, SIGNAL(triggered()), SLOT(slotRunToLine()));
|
||||||
|
menu->addAction(runToLineAction);
|
||||||
|
if (currentEngine()->debuggerCapabilities() & JumpToLineCapability) {
|
||||||
|
const QString jumpText =
|
||||||
|
DebuggerEngine::tr("Jump to Line %1").arg(lineNumber);
|
||||||
|
QAction *jumpToLineAction = new QAction(jumpText, menu);
|
||||||
|
menu->addAction(runToLineAction);
|
||||||
|
jumpToLineAction->setData(args);
|
||||||
|
connect(jumpToLineAction, SIGNAL(triggered()), SLOT(slotJumpToLine()));
|
||||||
|
menu->addAction(jumpToLineAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::toggleBreakpoint()
|
void DebuggerPluginPrivate::toggleBreakpoint()
|
||||||
@@ -2101,9 +2248,8 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify)
|
|||||||
m_currentEngine = engine;
|
m_currentEngine = engine;
|
||||||
|
|
||||||
if (notify)
|
if (notify)
|
||||||
notifyCurrentEngine(RequestActivationRole, false);
|
engine->setActive(false);
|
||||||
|
|
||||||
m_commandWindow->setModel(engine->commandModel());
|
|
||||||
m_localsWindow->setModel(engine->localsModel());
|
m_localsWindow->setModel(engine->localsModel());
|
||||||
m_modulesWindow->setModel(engine->modulesModel());
|
m_modulesWindow->setModel(engine->modulesModel());
|
||||||
m_registerWindow->setModel(engine->registerModel());
|
m_registerWindow->setModel(engine->registerModel());
|
||||||
@@ -2116,7 +2262,7 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify)
|
|||||||
m_watchersWindow->setModel(engine->watchersModel());
|
m_watchersWindow->setModel(engine->watchersModel());
|
||||||
|
|
||||||
if (notify)
|
if (notify)
|
||||||
notifyCurrentEngine(RequestActivationRole, true);
|
engine->setActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void changeFontSize(QWidget *widget, qreal size)
|
static void changeFontSize(QWidget *widget, qreal size)
|
||||||
@@ -2542,7 +2688,7 @@ void DebuggerPluginPrivate::aboutToSaveSession()
|
|||||||
void DebuggerPluginPrivate::executeDebuggerCommand()
|
void DebuggerPluginPrivate::executeDebuggerCommand()
|
||||||
{
|
{
|
||||||
if (QAction *action = qobject_cast<QAction *>(sender()))
|
if (QAction *action = qobject_cast<QAction *>(sender()))
|
||||||
notifyCurrentEngine(RequestExecuteCommandRole, action->data().toString());
|
currentEngine()->executeDebuggerCommand(action->data().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
|
void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
|
||||||
@@ -2562,7 +2708,7 @@ void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
|
|||||||
|
|
||||||
void DebuggerPluginPrivate::scriptExpressionEntered(const QString &expression)
|
void DebuggerPluginPrivate::scriptExpressionEntered(const QString &expression)
|
||||||
{
|
{
|
||||||
notifyCurrentEngine(RequestExecuteCommandRole, expression);
|
currentEngine()->executeDebuggerCommand(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::openMemoryEditor()
|
void DebuggerPluginPrivate::openMemoryEditor()
|
||||||
@@ -2610,9 +2756,6 @@ DebuggerPlugin::~DebuggerPlugin()
|
|||||||
delete d->m_uiSwitcher;
|
delete d->m_uiSwitcher;
|
||||||
d->m_uiSwitcher = 0;
|
d->m_uiSwitcher = 0;
|
||||||
|
|
||||||
delete d->m_commandWindow;
|
|
||||||
d->m_commandWindow = 0;
|
|
||||||
|
|
||||||
delete d->m_snapshotHandler;
|
delete d->m_snapshotHandler;
|
||||||
d->m_snapshotHandler = 0;
|
d->m_snapshotHandler = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -254,11 +254,6 @@ void QmlCppEngine::assignValueInDebugger(const Internal::WatchData *w, const QSt
|
|||||||
d->m_activeEngine->assignValueInDebugger(w, expr, value);
|
d->m_activeEngine->assignValueInDebugger(w, expr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractItemModel *QmlCppEngine::commandModel() const
|
|
||||||
{
|
|
||||||
return d->m_activeEngine->commandModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
QAbstractItemModel *QmlCppEngine::modulesModel() const
|
QAbstractItemModel *QmlCppEngine::modulesModel() const
|
||||||
{
|
{
|
||||||
return d->m_cppEngine->modulesModel();
|
return d->m_cppEngine->modulesModel();
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ public:
|
|||||||
virtual void assignValueInDebugger(const Internal::WatchData *w,
|
virtual void assignValueInDebugger(const Internal::WatchData *w,
|
||||||
const QString &expr, const QVariant &value);
|
const QString &expr, const QVariant &value);
|
||||||
|
|
||||||
QAbstractItemModel *commandModel() const;
|
|
||||||
QAbstractItemModel *modulesModel() const;
|
QAbstractItemModel *modulesModel() const;
|
||||||
QAbstractItemModel *registerModel() const;
|
QAbstractItemModel *registerModel() const;
|
||||||
QAbstractItemModel *stackModel() const;
|
QAbstractItemModel *stackModel() const;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SnapshotWindow::rowActivated(const QModelIndex &index)
|
void SnapshotWindow::rowActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
m_snapshotHandler->activateSnapshot(index.row());
|
m_snapshotHandler->activateSnapshot(index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user