forked from qt-creator/qt-creator
debugger: more handler/window refactoring
This commit is contained in:
@@ -214,36 +214,9 @@ enum ModelRoles
|
|||||||
LocalsPointerValueRole, // Pointer value (address) as quint64
|
LocalsPointerValueRole, // Pointer value (address) as quint64
|
||||||
LocalsIsWatchpointAtAddressRole,
|
LocalsIsWatchpointAtAddressRole,
|
||||||
LocalsIsWatchpointAtPointerValueRole,
|
LocalsIsWatchpointAtPointerValueRole,
|
||||||
RequestShowInEditorRole,
|
|
||||||
RequestWatchPointRole,
|
|
||||||
RequestToggleWatchRole,
|
|
||||||
RequestToolTipByExpressionRole,
|
|
||||||
RequestClearCppCodeModelSnapshotRole,
|
|
||||||
RequestWatchExpressionRole,
|
|
||||||
RequestRemoveWatchExpressionRole,
|
|
||||||
|
|
||||||
// Stack
|
|
||||||
StackFrameAddressRole,
|
|
||||||
RequestActivateFrameRole,
|
|
||||||
RequestReloadFullStackRole,
|
|
||||||
RequestShowMemoryRole,
|
|
||||||
RequestShowDisassemblerRole,
|
|
||||||
|
|
||||||
// Modules
|
|
||||||
RequestReloadModulesRole,
|
|
||||||
RequestExamineModulesRole,
|
|
||||||
RequestModuleSymbolsRole,
|
|
||||||
RequestAllSymbolsRole,
|
|
||||||
RequestOpenFileRole,
|
|
||||||
|
|
||||||
// Snapshots
|
// Snapshots
|
||||||
SnapshotCapabilityRole,
|
SnapshotCapabilityRole,
|
||||||
RequestCreateSnapshotRole,
|
|
||||||
RequestActivateSnapshotRole,
|
|
||||||
RequestRemoveSnapshotRole,
|
|
||||||
|
|
||||||
// Sources
|
|
||||||
RequestReloadSourceFilesRole,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DebuggerEngineType
|
enum DebuggerEngineType
|
||||||
|
@@ -224,10 +224,10 @@ public:
|
|||||||
m_lastGoodState(DebuggerNotReady),
|
m_lastGoodState(DebuggerNotReady),
|
||||||
m_targetState(DebuggerNotReady),
|
m_targetState(DebuggerNotReady),
|
||||||
m_commandHandler(engine),
|
m_commandHandler(engine),
|
||||||
m_modulesHandler(engine),
|
m_modulesHandler(),
|
||||||
m_registerHandler(),
|
m_registerHandler(),
|
||||||
m_sourceFilesHandler(engine),
|
m_sourceFilesHandler(),
|
||||||
m_stackHandler(engine),
|
m_stackHandler(),
|
||||||
m_threadsHandler(),
|
m_threadsHandler(),
|
||||||
m_watchHandler(engine),
|
m_watchHandler(engine),
|
||||||
m_disassemblerViewAgent(engine),
|
m_disassemblerViewAgent(engine),
|
||||||
@@ -248,25 +248,29 @@ public slots:
|
|||||||
void doInterruptInferior();
|
void doInterruptInferior();
|
||||||
void doFinishDebugger();
|
void doFinishDebugger();
|
||||||
|
|
||||||
void queueRunEngine() {
|
void queueRunEngine()
|
||||||
|
{
|
||||||
m_engine->setState(EngineRunRequested);
|
m_engine->setState(EngineRunRequested);
|
||||||
m_engine->showMessage(_("QUEUE: RUN ENGINE"));
|
m_engine->showMessage(_("QUEUE: RUN ENGINE"));
|
||||||
QTimer::singleShot(0, this, SLOT(doRunEngine()));
|
QTimer::singleShot(0, this, SLOT(doRunEngine()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void queueShutdownEngine() {
|
void queueShutdownEngine()
|
||||||
|
{
|
||||||
m_engine->setState(EngineShutdownRequested);
|
m_engine->setState(EngineShutdownRequested);
|
||||||
m_engine->showMessage(_("QUEUE: SHUTDOWN ENGINE"));
|
m_engine->showMessage(_("QUEUE: SHUTDOWN ENGINE"));
|
||||||
QTimer::singleShot(0, this, SLOT(doShutdownEngine()));
|
QTimer::singleShot(0, this, SLOT(doShutdownEngine()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void queueShutdownInferior() {
|
void queueShutdownInferior()
|
||||||
|
{
|
||||||
m_engine->setState(InferiorShutdownRequested);
|
m_engine->setState(InferiorShutdownRequested);
|
||||||
m_engine->showMessage(_("QUEUE: SHUTDOWN INFERIOR"));
|
m_engine->showMessage(_("QUEUE: SHUTDOWN INFERIOR"));
|
||||||
QTimer::singleShot(0, this, SLOT(doShutdownInferior()));
|
QTimer::singleShot(0, this, SLOT(doShutdownInferior()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void queueFinishDebugger() {
|
void queueFinishDebugger()
|
||||||
|
{
|
||||||
QTC_ASSERT(state() == EngineShutdownOk
|
QTC_ASSERT(state() == EngineShutdownOk
|
||||||
|| state() == EngineShutdownFailed, qDebug() << state());
|
|| state() == EngineShutdownFailed, qDebug() << state());
|
||||||
m_engine->setState(DebuggerFinished);
|
m_engine->setState(DebuggerFinished);
|
||||||
@@ -274,7 +278,8 @@ public slots:
|
|||||||
QTimer::singleShot(0, this, SLOT(doFinishDebugger()));
|
QTimer::singleShot(0, this, SLOT(doFinishDebugger()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void raiseApplication() {
|
void raiseApplication()
|
||||||
|
{
|
||||||
QTC_ASSERT(m_runControl, return);
|
QTC_ASSERT(m_runControl, return);
|
||||||
m_runControl->bringApplicationToForeground(m_inferiorPid);
|
m_runControl->bringApplicationToForeground(m_inferiorPid);
|
||||||
}
|
}
|
||||||
@@ -514,30 +519,9 @@ void DebuggerEngine::removeTooltip()
|
|||||||
|
|
||||||
void DebuggerEngine::handleCommand(int role, const QVariant &value)
|
void DebuggerEngine::handleCommand(int role, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (role != RequestToolTipByExpressionRole)
|
removeTooltip();
|
||||||
removeTooltip();
|
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case RequestActivateFrameRole:
|
|
||||||
activateFrame(value.toInt());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestReloadFullStackRole:
|
|
||||||
reloadFullStack();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestReloadSourceFilesRole:
|
|
||||||
reloadSourceFiles();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestReloadModulesRole:
|
|
||||||
reloadModules();
|
|
||||||
break;
|
|
||||||
|
|
||||||
//case RequestReloadRegistersRole:
|
|
||||||
// reloadRegisters();
|
|
||||||
// break;
|
|
||||||
|
|
||||||
case RequestExecDetachRole:
|
case RequestExecDetachRole:
|
||||||
detachDebugger();
|
detachDebugger();
|
||||||
break;
|
break;
|
||||||
@@ -590,10 +574,6 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value)
|
|||||||
d->queueShutdownInferior();
|
d->queueShutdownInferior();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RequestCreateSnapshotRole:
|
|
||||||
createSnapshot();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestActivationRole:
|
case RequestActivationRole:
|
||||||
setActive(value.toBool());
|
setActive(value.toBool());
|
||||||
break;
|
break;
|
||||||
@@ -614,29 +594,12 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value)
|
|||||||
executeDebuggerCommand(value.toString());
|
executeDebuggerCommand(value.toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RequestToolTipByExpressionRole: {
|
|
||||||
QList<QVariant> list = value.toList();
|
|
||||||
QTC_ASSERT(list.size() == 3, break);
|
|
||||||
QPoint point = list.at(0).value<QPoint>();
|
|
||||||
TextEditor::ITextEditor *editor = // Eeks.
|
|
||||||
(TextEditor::ITextEditor *)(list.at(1).value<quint64>());
|
|
||||||
int pos = list.at(2).toInt();
|
|
||||||
setToolTipExpression(point, editor, pos);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RequestContextMenuRole: {
|
case RequestContextMenuRole: {
|
||||||
QList<QVariant> list = value.toList();
|
QList<QVariant> list = value.toList();
|
||||||
QTC_ASSERT(list.size() == 3, break);
|
QTC_ASSERT(list.size() == 3, break);
|
||||||
d->handleContextMenuRequest(list);
|
d->handleContextMenuRequest(list);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case RequestShowMemoryRole: {
|
|
||||||
qDebug() << "CREATING MEMORY VIEW";
|
|
||||||
(void) MemoryViewAgent(this, "0x0");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -823,7 +823,7 @@ struct DebuggerActions
|
|||||||
QAction *jumpToLineAction; // in the Debug menu
|
QAction *jumpToLineAction; // in the Debug menu
|
||||||
QAction *returnFromFunctionAction;
|
QAction *returnFromFunctionAction;
|
||||||
QAction *nextAction;
|
QAction *nextAction;
|
||||||
QAction *snapshotAction;
|
//QAction *snapshotAction;
|
||||||
QAction *watchAction1; // in the Debug menu
|
QAction *watchAction1; // in the Debug menu
|
||||||
QAction *watchAction2; // in the text editor context menu
|
QAction *watchAction2; // in the text editor context menu
|
||||||
QAction *breakAction;
|
QAction *breakAction;
|
||||||
@@ -854,19 +854,29 @@ public:
|
|||||||
void notifyCurrentEngine(int role, const QVariant &value = QVariant());
|
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; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateWatchersHeader(int section, int, int newSize)
|
void updateWatchersHeader(int section, int, int newSize)
|
||||||
{ m_watchersWindow->header()->resizeSection(section, newSize); }
|
{
|
||||||
|
m_watchersWindow->header()->resizeSection(section, newSize);
|
||||||
|
}
|
||||||
|
|
||||||
void sourceFilesDockToggled(bool on)
|
void sourceFilesDockToggled(bool on)
|
||||||
{ if (on) notifyCurrentEngine(RequestReloadSourceFilesRole); }
|
{
|
||||||
|
if (on)
|
||||||
|
m_currentEngine->reloadSourceFiles();
|
||||||
|
}
|
||||||
|
|
||||||
void modulesDockToggled(bool on)
|
void modulesDockToggled(bool on)
|
||||||
{ if (on) notifyCurrentEngine(RequestReloadModulesRole); }
|
{
|
||||||
|
if (on)
|
||||||
|
m_currentEngine->reloadModules();
|
||||||
|
}
|
||||||
|
|
||||||
void registerDockToggled(bool on)
|
void registerDockToggled(bool on)
|
||||||
{
|
{
|
||||||
if (on && m_currentEngine)
|
if (on)
|
||||||
m_currentEngine->reloadRegisters();
|
m_currentEngine->reloadRegisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1137,8 +1147,6 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
m_registerWindow = new RegisterWindow;
|
m_registerWindow = new RegisterWindow;
|
||||||
m_registerWindow->setObjectName(QLatin1String("CppDebugRegisters"));
|
m_registerWindow->setObjectName(QLatin1String("CppDebugRegisters"));
|
||||||
m_snapshotWindow = new SnapshotWindow;
|
|
||||||
m_snapshotWindow->setObjectName(QLatin1String("CppDebugSnapshots"));
|
|
||||||
m_stackWindow = new StackWindow;
|
m_stackWindow = new StackWindow;
|
||||||
m_stackWindow->setObjectName(QLatin1String("CppDebugStack"));
|
m_stackWindow->setObjectName(QLatin1String("CppDebugStack"));
|
||||||
m_sourceFilesWindow = new SourceFilesWindow;
|
m_sourceFilesWindow = new SourceFilesWindow;
|
||||||
@@ -1160,6 +1168,8 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
// Snapshot
|
// Snapshot
|
||||||
m_snapshotHandler = new SnapshotHandler;
|
m_snapshotHandler = new SnapshotHandler;
|
||||||
|
m_snapshotWindow = new SnapshotWindow(m_snapshotHandler);
|
||||||
|
m_snapshotWindow->setObjectName(QLatin1String("CppDebugSnapshots"));
|
||||||
m_snapshotWindow->setModel(m_snapshotHandler->model());
|
m_snapshotWindow->setModel(m_snapshotHandler->model());
|
||||||
|
|
||||||
// Debug mode setup
|
// Debug mode setup
|
||||||
@@ -1227,10 +1237,10 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
|
|||||||
m_actions.watchAction2 = new QAction(tr("Add to Watch Window"), this);
|
m_actions.watchAction2 = new QAction(tr("Add to Watch Window"), this);
|
||||||
m_actions.watchAction2->setProperty(Role, RequestExecWatchRole);
|
m_actions.watchAction2->setProperty(Role, RequestExecWatchRole);
|
||||||
|
|
||||||
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 =
|
m_actions.reverseDirectionAction =
|
||||||
new QAction(tr("Reverse Direction"), this);
|
new QAction(tr("Reverse Direction"), this);
|
||||||
@@ -1261,7 +1271,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
|
|||||||
connect(m_actions.returnFromFunctionAction, SIGNAL(triggered()), SLOT(onAction()));
|
connect(m_actions.returnFromFunctionAction, SIGNAL(triggered()), SLOT(onAction()));
|
||||||
connect(m_actions.watchAction1, SIGNAL(triggered()), SLOT(onAction()));
|
connect(m_actions.watchAction1, SIGNAL(triggered()), SLOT(onAction()));
|
||||||
connect(m_actions.watchAction2, SIGNAL(triggered()), SLOT(onAction()));
|
connect(m_actions.watchAction2, SIGNAL(triggered()), SLOT(onAction()));
|
||||||
connect(m_actions.snapshotAction, SIGNAL(triggered()), SLOT(onAction()));
|
//connect(m_actions.snapshotAction, SIGNAL(triggered()), SLOT(onAction()));
|
||||||
connect(m_actions.frameDownAction, SIGNAL(triggered()), SLOT(onAction()));
|
connect(m_actions.frameDownAction, SIGNAL(triggered()), SLOT(onAction()));
|
||||||
connect(m_actions.frameUpAction, SIGNAL(triggered()), SLOT(onAction()));
|
connect(m_actions.frameUpAction, SIGNAL(triggered()), SLOT(onAction()));
|
||||||
connect(m_actions.stopAction, SIGNAL(triggered()), SLOT(onAction()));
|
connect(m_actions.stopAction, SIGNAL(triggered()), SLOT(onAction()));
|
||||||
@@ -1514,11 +1524,11 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
|
|||||||
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
||||||
|
|
||||||
|
|
||||||
cmd = am->registerAction(m_actions.snapshotAction,
|
//cmd = am->registerAction(m_actions.snapshotAction,
|
||||||
Constants::SNAPSHOT, cppDebuggercontext);
|
// Constants::SNAPSHOT, cppDebuggercontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(Constants::SNAPSHOT_KEY));
|
//cmd->setDefaultKeySequence(QKeySequence(Constants::SNAPSHOT_KEY));
|
||||||
cmd->setAttribute(Command::CA_Hide);
|
//cmd->setAttribute(Command::CA_Hide);
|
||||||
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
//m_uiSwitcher->addMenuAction(cmd, CppLanguage);
|
||||||
|
|
||||||
cmd = am->registerAction(m_actions.frameDownAction,
|
cmd = am->registerAction(m_actions.frameDownAction,
|
||||||
Constants::FRAME_DOWN, cppDebuggercontext);
|
Constants::FRAME_DOWN, cppDebuggercontext);
|
||||||
@@ -2025,7 +2035,8 @@ void DebuggerPluginPrivate::requestMark(ITextEditor *editor, int lineNumber)
|
|||||||
toggleBreakpoint(editor->file()->fileName(), lineNumber);
|
toggleBreakpoint(editor->file()->fileName(), lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::showToolTip(ITextEditor *editor, const QPoint &point, int pos)
|
void DebuggerPluginPrivate::showToolTip(ITextEditor *editor,
|
||||||
|
const QPoint &point, int pos)
|
||||||
{
|
{
|
||||||
if (!isDebuggable(editor))
|
if (!isDebuggable(editor))
|
||||||
return;
|
return;
|
||||||
@@ -2033,12 +2044,7 @@ void DebuggerPluginPrivate::showToolTip(ITextEditor *editor, const QPoint &point
|
|||||||
return;
|
return;
|
||||||
if (state() != InferiorStopOk)
|
if (state() != InferiorStopOk)
|
||||||
return;
|
return;
|
||||||
|
currentEngine()->setToolTipExpression(point, editor, pos);
|
||||||
QList<QVariant> list;
|
|
||||||
list.append(point);
|
|
||||||
list.append(quint64(editor));
|
|
||||||
list.append(pos);
|
|
||||||
notifyCurrentEngine(RequestToolTipByExpressionRole, list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerRunControl *DebuggerPluginPrivate::createDebugger
|
DebuggerRunControl *DebuggerPluginPrivate::createDebugger
|
||||||
@@ -2264,7 +2270,7 @@ void DebuggerPluginPrivate::setInitialState()
|
|||||||
m_actions.watchAction1->setEnabled(true);
|
m_actions.watchAction1->setEnabled(true);
|
||||||
m_actions.watchAction2->setEnabled(true);
|
m_actions.watchAction2->setEnabled(true);
|
||||||
m_actions.breakAction->setEnabled(true);
|
m_actions.breakAction->setEnabled(true);
|
||||||
m_actions.snapshotAction->setEnabled(false);
|
//m_actions.snapshotAction->setEnabled(false);
|
||||||
theDebuggerAction(OperateByInstruction)->setEnabled(false);
|
theDebuggerAction(OperateByInstruction)->setEnabled(false);
|
||||||
|
|
||||||
m_actions.stopAction->setEnabled(false);
|
m_actions.stopAction->setEnabled(false);
|
||||||
@@ -2393,7 +2399,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
|||||||
m_actions.watchAction1->setEnabled(true);
|
m_actions.watchAction1->setEnabled(true);
|
||||||
m_actions.watchAction2->setEnabled(true);
|
m_actions.watchAction2->setEnabled(true);
|
||||||
m_actions.breakAction->setEnabled(true);
|
m_actions.breakAction->setEnabled(true);
|
||||||
m_actions.snapshotAction->setEnabled(stopped && (caps & SnapshotCapability));
|
//m_actions.snapshotAction->setEnabled(stopped && (caps & SnapshotCapability));
|
||||||
|
|
||||||
theDebuggerAction(OperateByInstruction)->setEnabled(stopped);
|
theDebuggerAction(OperateByInstruction)->setEnabled(stopped);
|
||||||
|
|
||||||
@@ -2562,11 +2568,8 @@ void DebuggerPluginPrivate::scriptExpressionEntered(const QString &expression)
|
|||||||
void DebuggerPluginPrivate::openMemoryEditor()
|
void DebuggerPluginPrivate::openMemoryEditor()
|
||||||
{
|
{
|
||||||
AddressDialog dialog;
|
AddressDialog dialog;
|
||||||
if (dialog.exec() != QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
return;
|
(void) new MemoryViewAgent(currentEngine(), dialog.address());
|
||||||
QTC_ASSERT(m_watchersWindow, return);
|
|
||||||
m_watchersWindow->model()->setData(
|
|
||||||
QModelIndex(), dialog.address(), RequestShowMemoryRole);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::coreShutdown()
|
void DebuggerPluginPrivate::coreShutdown()
|
||||||
@@ -2874,6 +2877,11 @@ Internal::BreakHandler *DebuggerPlugin::breakHandler() const
|
|||||||
return d->m_breakHandler;
|
return d->m_breakHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Internal::SnapshotHandler *DebuggerPlugin::snapshotHandler() const
|
||||||
|
{
|
||||||
|
return d->m_snapshotHandler;
|
||||||
|
}
|
||||||
|
|
||||||
DebuggerEngine *DebuggerPlugin::currentEngine() const
|
DebuggerEngine *DebuggerPlugin::currentEngine() const
|
||||||
{
|
{
|
||||||
return d->m_currentEngine;
|
return d->m_currentEngine;
|
||||||
|
@@ -57,6 +57,7 @@ class DebuggerStartParameters;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class BreakHandler;
|
class BreakHandler;
|
||||||
|
class SnapshotHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DEBUGGER_EXPORT DebuggerPlugin : public ExtensionSystem::IPlugin
|
class DEBUGGER_EXPORT DebuggerPlugin : public ExtensionSystem::IPlugin
|
||||||
@@ -91,6 +92,7 @@ public:
|
|||||||
|
|
||||||
void openTextEditor(const QString &titlePattern, const QString &contents);
|
void openTextEditor(const QString &titlePattern, const QString &contents);
|
||||||
Internal::BreakHandler *breakHandler() const;
|
Internal::BreakHandler *breakHandler() const;
|
||||||
|
Internal::SnapshotHandler *snapshotHandler() const;
|
||||||
DebuggerEngine *currentEngine() const;
|
DebuggerEngine *currentEngine() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "moduleshandler.h"
|
#include "moduleshandler.h"
|
||||||
#include "debuggerengine.h"
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -45,41 +44,8 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ModulesModel : public QAbstractItemModel
|
ModulesModel::ModulesModel(ModulesHandler *parent)
|
||||||
{ // Needs tr - context.
|
: QAbstractItemModel(parent)
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ModulesModel(ModulesHandler *parent, DebuggerEngine *engine);
|
|
||||||
|
|
||||||
// QAbstractItemModel
|
|
||||||
int columnCount(const QModelIndex &parent) const
|
|
||||||
{ return parent.isValid() ? 0 : 5; }
|
|
||||||
int rowCount(const QModelIndex &parent) const
|
|
||||||
{ return parent.isValid() ? 0 : m_modules.size(); }
|
|
||||||
QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
|
|
||||||
QModelIndex index(int row, int column, const QModelIndex &) const
|
|
||||||
{ return createIndex(row, column); }
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
|
||||||
|
|
||||||
void clearModel();
|
|
||||||
void addModule(const Module &module);
|
|
||||||
void removeModule(const QString &moduleName);
|
|
||||||
void setModules(const Modules &modules);
|
|
||||||
void updateModule(const QString &moduleName, const Module &module);
|
|
||||||
|
|
||||||
const Modules &modules() const { return m_modules; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int indexOfModule(const QString &name) const;
|
|
||||||
|
|
||||||
DebuggerEngine *m_engine;
|
|
||||||
Modules m_modules;
|
|
||||||
};
|
|
||||||
|
|
||||||
ModulesModel::ModulesModel(ModulesHandler *parent, DebuggerEngine *engine)
|
|
||||||
: QAbstractItemModel(parent), m_engine(engine)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QVariant ModulesModel::headerData(int section,
|
QVariant ModulesModel::headerData(int section,
|
||||||
@@ -101,12 +67,6 @@ QVariant ModulesModel::headerData(int section,
|
|||||||
|
|
||||||
QVariant ModulesModel::data(const QModelIndex &index, int role) const
|
QVariant ModulesModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (role == EngineCapabilitiesRole)
|
|
||||||
return m_engine->debuggerCapabilities();
|
|
||||||
|
|
||||||
if (role == EngineActionsEnabledRole)
|
|
||||||
return m_engine->debuggerActionsEnabled();
|
|
||||||
|
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
if (row < 0 || row >= m_modules.size())
|
if (row < 0 || row >= m_modules.size())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@@ -153,34 +113,6 @@ QVariant ModulesModel::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModulesModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
|
||||||
{
|
|
||||||
Q_UNUSED(index);
|
|
||||||
|
|
||||||
switch (role) {
|
|
||||||
case RequestReloadModulesRole:
|
|
||||||
m_engine->reloadModules();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case RequestExamineModulesRole:
|
|
||||||
m_engine->examineModules();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case RequestModuleSymbolsRole:
|
|
||||||
m_engine->loadSymbols(value.toString());
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case RequestAllSymbolsRole:
|
|
||||||
m_engine->loadAllSymbols();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case RequestOpenFileRole:
|
|
||||||
m_engine->openFile(value.toString());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModulesModel::addModule(const Module &m)
|
void ModulesModel::addModule(const Module &m)
|
||||||
{
|
{
|
||||||
beginInsertRows(QModelIndex(), m_modules.size(), m_modules.size());
|
beginInsertRows(QModelIndex(), m_modules.size(), m_modules.size());
|
||||||
@@ -234,9 +166,9 @@ void ModulesModel::updateModule(const QString &moduleName, const Module &module)
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ModulesHandler::ModulesHandler(DebuggerEngine *engine)
|
ModulesHandler::ModulesHandler()
|
||||||
{
|
{
|
||||||
m_model = new ModulesModel(this, engine);
|
m_model = new ModulesModel(this);
|
||||||
m_proxyModel = new QSortFilterProxyModel(this);
|
m_proxyModel = new QSortFilterProxyModel(this);
|
||||||
m_proxyModel->setSourceModel(m_model);
|
m_proxyModel->setSourceModel(m_model);
|
||||||
}
|
}
|
||||||
@@ -279,4 +211,3 @@ Modules ModulesHandler::modules() const
|
|||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
#include "moduleshandler.moc"
|
|
||||||
|
@@ -32,20 +32,15 @@
|
|||||||
|
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QtGui/QSortFilterProxyModel>
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QAbstractItemModel;
|
|
||||||
class QSortFilterProxyModel;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
class DebuggerEngine;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ModulesModel;
|
class ModulesModel;
|
||||||
|
class ModulesHandler;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -96,6 +91,45 @@ public:
|
|||||||
typedef QList<Module> Modules;
|
typedef QList<Module> Modules;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// ModulesModel
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class ModulesModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
// Needs tr - context.
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ModulesModel(ModulesHandler *parent);
|
||||||
|
|
||||||
|
// QAbstractItemModel
|
||||||
|
int columnCount(const QModelIndex &parent) const
|
||||||
|
{ return parent.isValid() ? 0 : 5; }
|
||||||
|
int rowCount(const QModelIndex &parent) const
|
||||||
|
{ return parent.isValid() ? 0 : m_modules.size(); }
|
||||||
|
QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
|
||||||
|
QModelIndex index(int row, int column, const QModelIndex &) const
|
||||||
|
{ return createIndex(row, column); }
|
||||||
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
|
||||||
|
void clearModel();
|
||||||
|
void addModule(const Module &module);
|
||||||
|
void removeModule(const QString &moduleName);
|
||||||
|
void setModules(const Modules &modules);
|
||||||
|
void updateModule(const QString &moduleName, const Module &module);
|
||||||
|
|
||||||
|
const Modules &modules() const { return m_modules; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int indexOfModule(const QString &name) const;
|
||||||
|
|
||||||
|
Modules m_modules;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// ModulesHandler
|
// ModulesHandler
|
||||||
@@ -107,7 +141,7 @@ class ModulesHandler : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ModulesHandler(DebuggerEngine *engine);
|
ModulesHandler();
|
||||||
|
|
||||||
QAbstractItemModel *model() const;
|
QAbstractItemModel *model() const;
|
||||||
|
|
||||||
|
@@ -29,8 +29,10 @@
|
|||||||
|
|
||||||
#include "moduleswindow.h"
|
#include "moduleswindow.h"
|
||||||
|
|
||||||
#include "debuggerconstants.h"
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
|
#include "debuggerconstants.h"
|
||||||
|
#include "debuggerengine.h"
|
||||||
|
#include "debuggerplugin.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
@@ -51,6 +53,11 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
static DebuggerEngine *currentEngine()
|
||||||
|
{
|
||||||
|
return DebuggerPlugin::instance()->currentEngine();
|
||||||
|
}
|
||||||
|
|
||||||
ModulesWindow::ModulesWindow(QWidget *parent)
|
ModulesWindow::ModulesWindow(QWidget *parent)
|
||||||
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
|
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
|
||||||
{
|
{
|
||||||
@@ -63,16 +70,14 @@ ModulesWindow::ModulesWindow(QWidget *parent)
|
|||||||
setIconSize(QSize(10, 10));
|
setIconSize(QSize(10, 10));
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
connect(this, SIGNAL(activated(QModelIndex)),
|
||||||
this, SLOT(moduleActivated(QModelIndex)));
|
SLOT(moduleActivated(QModelIndex)));
|
||||||
connect(act, SIGNAL(toggled(bool)),
|
connect(act, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(setAlternatingRowColorsHelper(bool)));
|
SLOT(setAlternatingRowColorsHelper(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesWindow::moduleActivated(const QModelIndex &index)
|
void ModulesWindow::moduleActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
qDebug() << "ACTIVATED: " << index.row() << index.column()
|
currentEngine()->openFile(index.data().toString());
|
||||||
<< index.data().toString();
|
|
||||||
setModelData(RequestOpenFileRole, index.data().toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesWindow::resizeEvent(QResizeEvent *event)
|
void ModulesWindow::resizeEvent(QResizeEvent *event)
|
||||||
@@ -100,10 +105,9 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
name = index.data().toString();
|
name = index.data().toString();
|
||||||
|
|
||||||
const bool enabled =
|
DebuggerEngine *engine = currentEngine();
|
||||||
model() && model()->data(index, EngineActionsEnabledRole).toBool();
|
const bool enabled = engine->debuggerActionsEnabled();
|
||||||
const unsigned capabilities =
|
const unsigned capabilities = engine->debuggerCapabilities();
|
||||||
model()->data(index, EngineCapabilitiesRole).toInt();
|
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
|
||||||
@@ -168,7 +172,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
if (act == actUpdateModuleList) {
|
if (act == actUpdateModuleList) {
|
||||||
setModelData(RequestReloadModulesRole);
|
engine->reloadModules();
|
||||||
} else if (act == actAdjustColumnWidths) {
|
} else if (act == actAdjustColumnWidths) {
|
||||||
resizeColumnsToContents();
|
resizeColumnsToContents();
|
||||||
} else if (act == actAlwaysAdjustColumnWidth) {
|
} else if (act == actAlwaysAdjustColumnWidth) {
|
||||||
@@ -176,15 +180,15 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
//} else if (act == actShowSourceFiles) {
|
//} else if (act == actShowSourceFiles) {
|
||||||
// emit displaySourceRequested(name);
|
// emit displaySourceRequested(name);
|
||||||
} else if (act == actLoadSymbolsForAllModules) {
|
} else if (act == actLoadSymbolsForAllModules) {
|
||||||
setModelData(RequestAllSymbolsRole);
|
engine->loadAllSymbols();
|
||||||
} else if (act == actExamineAllModules) {
|
} else if (act == actExamineAllModules) {
|
||||||
setModelData(RequestExamineModulesRole);
|
engine->examineModules();
|
||||||
} else if (act == actLoadSymbolsForModule) {
|
} else if (act == actLoadSymbolsForModule) {
|
||||||
setModelData(RequestModuleSymbolsRole, name);
|
engine->loadSymbols(name);
|
||||||
} else if (act == actEditFile) {
|
} else if (act == actEditFile) {
|
||||||
setModelData(RequestOpenFileRole, name);
|
engine->openFile(name);
|
||||||
} else if (act == actShowSymbols) {
|
} else if (act == actShowSymbols) {
|
||||||
setModelData(RequestModuleSymbolsRole, name);
|
// FIXME setModelData(RequestModuleSymbolsRole, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,12 +219,5 @@ void ModulesWindow::setModel(QAbstractItemModel *model)
|
|||||||
setAlwaysResizeColumnsToContents(true);
|
setAlwaysResizeColumnsToContents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesWindow::setModelData
|
|
||||||
(int role, const QVariant &value, const QModelIndex &index)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(model(), return);
|
|
||||||
model()->setData(index, value, role);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -52,8 +52,6 @@ private:
|
|||||||
void resizeEvent(QResizeEvent *ev);
|
void resizeEvent(QResizeEvent *ev);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model);
|
||||||
void setModelData(int role, const QVariant &value = QVariant(),
|
|
||||||
const QModelIndex &index = QModelIndex());
|
|
||||||
|
|
||||||
bool m_alwaysResizeColumnsToContents;
|
bool m_alwaysResizeColumnsToContents;
|
||||||
};
|
};
|
||||||
|
@@ -177,7 +177,8 @@ QVariant SnapshotHandler::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
case Qt::DecorationRole: // Return icon that indicates whether this is the active stack frame
|
case Qt::DecorationRole:
|
||||||
|
// Return icon that indicates whether this is the active stack frame.
|
||||||
if (index.column() == 0)
|
if (index.column() == 0)
|
||||||
return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon;
|
return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon;
|
||||||
break;
|
break;
|
||||||
@@ -208,38 +209,43 @@ Qt::ItemFlags SnapshotHandler::flags(const QModelIndex &index) const
|
|||||||
return true ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0);
|
return true ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnapshotHandler::setData
|
void SnapshotHandler::activateSnapshot(int index)
|
||||||
(const QModelIndex &index, const QVariant &value, int role)
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(value);
|
m_currentIndex = index;
|
||||||
if (index.isValid() && role == RequestCreateSnapshotRole) {
|
//qDebug() << "ACTIVATING INDEX: " << m_currentIndex << " OF " << size();
|
||||||
DebuggerEngine *engine = engineAt(index.row());
|
DebuggerPlugin::displayDebugger(m_snapshots.at(index));
|
||||||
QTC_ASSERT(engine, return false);
|
reset();
|
||||||
engine->createSnapshot();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (index.isValid() && role == RequestActivateSnapshotRole) {
|
|
||||||
m_currentIndex = index.row();
|
|
||||||
//qDebug() << "ACTIVATING INDEX: " << m_currentIndex << " OF " << size();
|
|
||||||
DebuggerPlugin::displayDebugger(m_snapshots.at(m_currentIndex));
|
|
||||||
reset();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (index.isValid() && role == RequestRemoveSnapshotRole) {
|
|
||||||
DebuggerEngine *engine = engineAt(index.row());
|
|
||||||
//qDebug() << "REMOVING " << engine;
|
|
||||||
QTC_ASSERT(engine, return false);
|
|
||||||
engine->quitDebugger();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SnapshotHandler::createSnapshot(int index)
|
||||||
|
{
|
||||||
|
DebuggerEngine *engine = engineAt(index);
|
||||||
|
QTC_ASSERT(engine, return);
|
||||||
|
engine->createSnapshot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapshotHandler::removeSnapshot(int index)
|
||||||
|
{
|
||||||
|
DebuggerEngine *engine = engineAt(index);
|
||||||
|
//qDebug() << "REMOVING " << engine;
|
||||||
|
QTC_ASSERT(engine, return);
|
||||||
#if 0
|
#if 0
|
||||||
// See http://sourceware.org/bugzilla/show_bug.cgi?id=11241.
|
// See http://sourceware.org/bugzilla/show_bug.cgi?id=11241.
|
||||||
setState(EngineSetupRequested);
|
setState(EngineSetupRequested);
|
||||||
postCommand("set stack-cache off");
|
postCommand("set stack-cache off");
|
||||||
#endif
|
#endif
|
||||||
|
QString fileName = engine->startParameters().coreFile;
|
||||||
|
//if (!fileName.isEmpty())
|
||||||
|
// QFile::remove(fileName);
|
||||||
|
m_snapshots.removeAt(index);
|
||||||
|
if (index == m_currentIndex)
|
||||||
|
m_currentIndex = -1;
|
||||||
|
else if (index < m_currentIndex)
|
||||||
|
--m_currentIndex;
|
||||||
|
engine->quitDebugger();
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SnapshotHandler::removeAll()
|
void SnapshotHandler::removeAll()
|
||||||
{
|
{
|
||||||
@@ -263,21 +269,6 @@ void SnapshotHandler::removeSnapshot(DebuggerRunControl *rc)
|
|||||||
removeSnapshot(index);
|
removeSnapshot(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapshotHandler::removeSnapshot(int index)
|
|
||||||
{
|
|
||||||
const DebuggerEngine *engine = engineAt(index);
|
|
||||||
QTC_ASSERT(engine, return);
|
|
||||||
QString fileName = engine->startParameters().coreFile;
|
|
||||||
//if (!fileName.isEmpty())
|
|
||||||
// QFile::remove(fileName);
|
|
||||||
m_snapshots.removeAt(index);
|
|
||||||
if (index == m_currentIndex)
|
|
||||||
m_currentIndex = -1;
|
|
||||||
else if (index < m_currentIndex)
|
|
||||||
--m_currentIndex;
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SnapshotHandler::setCurrentIndex(int index)
|
void SnapshotHandler::setCurrentIndex(int index)
|
||||||
{
|
{
|
||||||
m_currentIndex = index;
|
m_currentIndex = index;
|
||||||
|
@@ -63,20 +63,22 @@ public:
|
|||||||
void removeSnapshot(DebuggerRunControl *rc);
|
void removeSnapshot(DebuggerRunControl *rc);
|
||||||
void setCurrentIndex(int index);
|
void setCurrentIndex(int index);
|
||||||
int size() const { return m_snapshots.size(); }
|
int size() const { return m_snapshots.size(); }
|
||||||
DebuggerRunControl *at(int i) const;
|
DebuggerRunControl *at(int index) const;
|
||||||
QList<DebuggerRunControl*> runControls() const;
|
QList<DebuggerRunControl *> runControls() const;
|
||||||
|
|
||||||
|
void createSnapshot(int index);
|
||||||
|
void activateSnapshot(int index);
|
||||||
|
void removeSnapshot(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// QAbstractTableModel
|
// QAbstractTableModel
|
||||||
int rowCount(const QModelIndex &parent) const;
|
int rowCount(const QModelIndex &parent) const;
|
||||||
int columnCount(const QModelIndex &parent) const;
|
int columnCount(const QModelIndex &parent) const;
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
Q_SLOT void resetModel() { reset(); }
|
Q_SLOT void resetModel() { reset(); }
|
||||||
DebuggerEngine *engineAt(int i) const;
|
DebuggerEngine *engineAt(int i) const;
|
||||||
void removeSnapshot(int index);
|
|
||||||
|
|
||||||
int m_currentIndex;
|
int m_currentIndex;
|
||||||
QList< QPointer<DebuggerRunControl> > m_snapshots;
|
QList< QPointer<DebuggerRunControl> > m_snapshots;
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "snapshotwindow.h"
|
#include "snapshotwindow.h"
|
||||||
|
#include "snapshothandler.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
@@ -60,9 +61,11 @@ namespace Internal {
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
SnapshotWindow::SnapshotWindow(QWidget *parent)
|
SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
|
||||||
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
|
: m_alwaysResizeColumnsToContents(false)
|
||||||
{
|
{
|
||||||
|
m_snapshotHandler = handler;
|
||||||
|
|
||||||
QAction *act = theDebuggerAction(UseAlternatingRowColors);
|
QAction *act = theDebuggerAction(UseAlternatingRowColors);
|
||||||
setWindowTitle(tr("Snapshots"));
|
setWindowTitle(tr("Snapshots"));
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
@@ -74,25 +77,14 @@ SnapshotWindow::SnapshotWindow(QWidget *parent)
|
|||||||
header()->setDefaultAlignment(Qt::AlignLeft);
|
header()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
connect(this, SIGNAL(activated(QModelIndex)),
|
||||||
this, SLOT(rowActivated(QModelIndex)));
|
SLOT(rowActivated(QModelIndex)));
|
||||||
connect(act, SIGNAL(toggled(bool)),
|
connect(act, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(setAlternatingRowColorsHelper(bool)));
|
SLOT(setAlternatingRowColorsHelper(bool)));
|
||||||
}
|
|
||||||
|
|
||||||
SnapshotWindow::~SnapshotWindow()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapshotWindow::rowActivated(const QModelIndex &index)
|
void SnapshotWindow::rowActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
model()->setData(index, index.row(), RequestActivateSnapshotRole);
|
m_snapshotHandler->activateSnapshot(index.row());
|
||||||
}
|
|
||||||
|
|
||||||
void SnapshotWindow::removeSnapshots(const QModelIndexList &indexes)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(!indexes.isEmpty(), return);
|
|
||||||
foreach (const QModelIndex &idx, indexes)
|
|
||||||
model()->setData(idx, QVariant(), RequestRemoveSnapshotRole);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapshotWindow::keyPressEvent(QKeyEvent *ev)
|
void SnapshotWindow::keyPressEvent(QKeyEvent *ev)
|
||||||
@@ -103,7 +95,8 @@ void SnapshotWindow::keyPressEvent(QKeyEvent *ev)
|
|||||||
QModelIndexList si = sm->selectedIndexes();
|
QModelIndexList si = sm->selectedIndexes();
|
||||||
if (si.isEmpty())
|
if (si.isEmpty())
|
||||||
si.append(currentIndex().sibling(currentIndex().row(), 0));
|
si.append(currentIndex().sibling(currentIndex().row(), 0));
|
||||||
removeSnapshots(normalizeIndexes(si));
|
foreach (const QModelIndex &idx, normalizeIndexes(si))
|
||||||
|
m_snapshotHandler->removeSnapshot(idx.row());
|
||||||
}
|
}
|
||||||
QTreeView::keyPressEvent(ev);
|
QTreeView::keyPressEvent(ev);
|
||||||
}
|
}
|
||||||
@@ -138,9 +131,9 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
if (act == actCreate)
|
if (act == actCreate)
|
||||||
model()->setData(idx, idx.row(), RequestCreateSnapshotRole);
|
m_snapshotHandler->createSnapshot(idx.row());
|
||||||
else if (act == actRemove)
|
else if (act == actRemove)
|
||||||
model()->setData(idx, idx.row(), RequestRemoveSnapshotRole);
|
m_snapshotHandler->removeSnapshot(idx.row());
|
||||||
else if (act == actAdjust)
|
else if (act == actAdjust)
|
||||||
resizeColumnsToContents();
|
resizeColumnsToContents();
|
||||||
else if (act == actAlwaysAdjust)
|
else if (act == actAlwaysAdjust)
|
||||||
|
@@ -32,20 +32,17 @@
|
|||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include <QtGui/QTreeView>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QModelIndex;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class SnapshotHandler;
|
||||||
|
|
||||||
class SnapshotWindow : public QTreeView
|
class SnapshotWindow : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SnapshotWindow(QWidget *parent = 0);
|
explicit SnapshotWindow(SnapshotHandler *handler);
|
||||||
~SnapshotWindow();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void resizeColumnsToContents();
|
void resizeColumnsToContents();
|
||||||
@@ -58,9 +55,9 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void keyPressEvent(QKeyEvent *ev);
|
void keyPressEvent(QKeyEvent *ev);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void removeSnapshots(const QModelIndexList &list);
|
|
||||||
|
|
||||||
bool m_alwaysResizeColumnsToContents;
|
bool m_alwaysResizeColumnsToContents;
|
||||||
|
SnapshotHandler *m_snapshotHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -29,9 +29,6 @@
|
|||||||
|
|
||||||
#include "sourcefileshandler.h"
|
#include "sourcefileshandler.h"
|
||||||
|
|
||||||
#include "debuggerconstants.h"
|
|
||||||
#include "debuggerengine.h"
|
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
@@ -40,8 +37,7 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
SourceFilesHandler::SourceFilesHandler(DebuggerEngine *engine)
|
SourceFilesHandler::SourceFilesHandler()
|
||||||
: m_engine(engine)
|
|
||||||
{
|
{
|
||||||
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
|
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
|
||||||
proxy->setSourceModel(this);
|
proxy->setSourceModel(this);
|
||||||
@@ -80,11 +76,6 @@ Qt::ItemFlags SourceFilesHandler::flags(const QModelIndex &index) const
|
|||||||
|
|
||||||
QVariant SourceFilesHandler::data(const QModelIndex &index, int role) const
|
QVariant SourceFilesHandler::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
switch (role) {
|
|
||||||
case EngineActionsEnabledRole:
|
|
||||||
return m_engine->debuggerActionsEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
if (row < 0 || row >= m_shortNames.size())
|
if (row < 0 || row >= m_shortNames.size())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@@ -107,22 +98,6 @@ QVariant SourceFilesHandler::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SourceFilesHandler::setData
|
|
||||||
(const QModelIndex &index, const QVariant &value, int role)
|
|
||||||
{
|
|
||||||
Q_UNUSED(index);
|
|
||||||
switch (role) {
|
|
||||||
case RequestReloadSourceFilesRole:
|
|
||||||
m_engine->reloadSourceFiles();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case RequestOpenFileRole:
|
|
||||||
m_engine->openFile(value.toString());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SourceFilesHandler::setSourceFiles(const QMap<QString, QString> &sourceFiles)
|
void SourceFilesHandler::setSourceFiles(const QMap<QString, QString> &sourceFiles)
|
||||||
{
|
{
|
||||||
m_shortNames.clear();
|
m_shortNames.clear();
|
||||||
|
@@ -34,8 +34,6 @@
|
|||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
class DebuggerEngine;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class SourceFilesHandler : public QAbstractItemModel
|
class SourceFilesHandler : public QAbstractItemModel
|
||||||
@@ -43,7 +41,7 @@ class SourceFilesHandler : public QAbstractItemModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SourceFilesHandler(DebuggerEngine *engine);
|
SourceFilesHandler();
|
||||||
|
|
||||||
int columnCount(const QModelIndex &parent) const
|
int columnCount(const QModelIndex &parent) const
|
||||||
{ return parent.isValid() ? 0 : 2; }
|
{ return parent.isValid() ? 0 : 2; }
|
||||||
@@ -54,7 +52,6 @@ public:
|
|||||||
{ return createIndex(row, column); }
|
{ return createIndex(row, column); }
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
|
|
||||||
void clearModel();
|
void clearModel();
|
||||||
@@ -66,7 +63,6 @@ public:
|
|||||||
QAbstractItemModel *model() { return m_proxyModel; }
|
QAbstractItemModel *model() { return m_proxyModel; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DebuggerEngine *m_engine;
|
|
||||||
QStringList m_shortNames;
|
QStringList m_shortNames;
|
||||||
QStringList m_fullNames;
|
QStringList m_fullNames;
|
||||||
QAbstractItemModel *m_proxyModel;
|
QAbstractItemModel *m_proxyModel;
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
|
#include "debuggerengine.h"
|
||||||
|
#include "debuggerplugin.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
@@ -42,6 +44,7 @@
|
|||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QResizeEvent>
|
#include <QtGui/QResizeEvent>
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SourceFilesWindow
|
// SourceFilesWindow
|
||||||
@@ -51,6 +54,11 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
static DebuggerEngine *currentEngine()
|
||||||
|
{
|
||||||
|
return DebuggerPlugin::instance()->currentEngine();
|
||||||
|
}
|
||||||
|
|
||||||
SourceFilesWindow::SourceFilesWindow(QWidget *parent)
|
SourceFilesWindow::SourceFilesWindow(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: QTreeView(parent)
|
||||||
{
|
{
|
||||||
@@ -66,14 +74,14 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent)
|
|||||||
//header()->setDefaultAlignment(Qt::AlignLeft);
|
//header()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
connect(this, SIGNAL(activated(QModelIndex)),
|
||||||
this, SLOT(sourceFileActivated(QModelIndex)));
|
SLOT(sourceFileActivated(QModelIndex)));
|
||||||
connect(act, SIGNAL(toggled(bool)),
|
connect(act, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(setAlternatingRowColorsHelper(bool)));
|
SLOT(setAlternatingRowColorsHelper(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
|
void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
setModelData(RequestOpenFileRole, index.data());
|
currentEngine()->openFile(index.data().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
@@ -81,7 +89,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
QModelIndex index = indexAt(ev->pos());
|
QModelIndex index = indexAt(ev->pos());
|
||||||
index = index.sibling(index.row(), 0);
|
index = index.sibling(index.row(), 0);
|
||||||
QString name = index.data().toString();
|
QString name = index.data().toString();
|
||||||
bool engineActionsEnabled = index.data(EngineActionsEnabledRole).toBool();
|
bool engineActionsEnabled = currentEngine()->debuggerActionsEnabled();
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *act1 = new QAction(tr("Reload Data"), &menu);
|
QAction *act1 = new QAction(tr("Reload Data"), &menu);
|
||||||
@@ -105,9 +113,9 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
if (act == act1)
|
if (act == act1)
|
||||||
setModelData(RequestReloadSourceFilesRole);
|
currentEngine()->reloadSourceFiles();
|
||||||
else if (act == act2)
|
else if (act == act2)
|
||||||
setModelData(RequestOpenFileRole, name);
|
currentEngine()->openFile(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceFilesWindow::setModelData
|
void SourceFilesWindow::setModelData
|
||||||
|
@@ -48,12 +48,10 @@ namespace Internal {
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
StackHandler::StackHandler(DebuggerEngine *engine)
|
StackHandler::StackHandler()
|
||||||
: m_positionIcon(QIcon(QLatin1String(":/debugger/images/location_16.png"))),
|
: m_positionIcon(QIcon(QLatin1String(":/debugger/images/location_16.png"))),
|
||||||
m_emptyIcon(QIcon(QLatin1String(":/debugger/images/debugger_empty_14.png")))
|
m_emptyIcon(QIcon(QLatin1String(":/debugger/images/debugger_empty_14.png")))
|
||||||
{
|
{
|
||||||
m_engine = engine;
|
|
||||||
m_disassemblerViewAgent = new DisassemblerViewAgent(engine);
|
|
||||||
m_currentIndex = 0;
|
m_currentIndex = 0;
|
||||||
m_canExpand = false;
|
m_canExpand = false;
|
||||||
connect(theDebuggerAction(OperateByInstruction), SIGNAL(triggered()),
|
connect(theDebuggerAction(OperateByInstruction), SIGNAL(triggered()),
|
||||||
@@ -62,7 +60,6 @@ StackHandler::StackHandler(DebuggerEngine *engine)
|
|||||||
|
|
||||||
StackHandler::~StackHandler()
|
StackHandler::~StackHandler()
|
||||||
{
|
{
|
||||||
delete m_disassemblerViewAgent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int StackHandler::rowCount(const QModelIndex &parent) const
|
int StackHandler::rowCount(const QModelIndex &parent) const
|
||||||
@@ -78,17 +75,6 @@ int StackHandler::columnCount(const QModelIndex &parent) const
|
|||||||
|
|
||||||
QVariant StackHandler::data(const QModelIndex &index, int role) const
|
QVariant StackHandler::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
switch (role) {
|
|
||||||
case EngineStateRole:
|
|
||||||
return m_engine->state();
|
|
||||||
|
|
||||||
case EngineCapabilitiesRole:
|
|
||||||
return m_engine->debuggerCapabilities();
|
|
||||||
|
|
||||||
case EngineActionsEnabledRole:
|
|
||||||
return m_engine->debuggerActionsEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!index.isValid() || index.row() >= m_stackFrames.size() + m_canExpand)
|
if (!index.isValid() || index.row() >= m_stackFrames.size() + m_canExpand)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
@@ -127,9 +113,6 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const
|
|||||||
return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon;
|
return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == StackFrameAddressRole)
|
|
||||||
return frame.address;
|
|
||||||
|
|
||||||
if (role == Qt::ToolTipRole)
|
if (role == Qt::ToolTipRole)
|
||||||
return frame.toToolTip();
|
return frame.toToolTip();
|
||||||
|
|
||||||
@@ -137,29 +120,6 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool StackHandler::setData(const QModelIndex &index, const QVariant &value, int role)
|
|
||||||
{
|
|
||||||
switch (role) {
|
|
||||||
case RequestReloadFullStackRole:
|
|
||||||
case RequestActivateFrameRole:
|
|
||||||
m_engine->handleCommand(role, value);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case RequestShowMemoryRole:
|
|
||||||
(void) new MemoryViewAgent(m_engine, value.toString());
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case RequestShowDisassemblerRole: {
|
|
||||||
const StackFrame &frame = m_stackFrames.at(value.toInt());
|
|
||||||
m_disassemblerViewAgent->setFrame(frame);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return QAbstractTableModel::setData(index, value, role);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant StackHandler::headerData(int section, Qt::Orientation orient, int role) const
|
QVariant StackHandler::headerData(int section, Qt::Orientation orient, int role) const
|
||||||
{
|
{
|
||||||
if (orient == Qt::Horizontal && role == Qt::DisplayRole) {
|
if (orient == Qt::Horizontal && role == Qt::DisplayRole) {
|
||||||
@@ -238,6 +198,5 @@ bool StackHandler::isDebuggingDebuggingHelpers() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -35,15 +35,11 @@
|
|||||||
#include <QtCore/QAbstractItemModel>
|
#include <QtCore/QAbstractItemModel>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
class DebuggerEngine;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class DisassemblerViewAgent;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// StackModel
|
// StackCookie
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -68,7 +64,7 @@ class StackHandler : public QAbstractTableModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StackHandler(DebuggerEngine *engine);
|
StackHandler();
|
||||||
~StackHandler();
|
~StackHandler();
|
||||||
|
|
||||||
void setFrames(const StackFrames &frames, bool canExpand = false);
|
void setFrames(const StackFrames &frames, bool canExpand = false);
|
||||||
@@ -76,6 +72,7 @@ public:
|
|||||||
void setCurrentIndex(int index);
|
void setCurrentIndex(int index);
|
||||||
int currentIndex() const { return m_currentIndex; }
|
int currentIndex() const { return m_currentIndex; }
|
||||||
StackFrame currentFrame() const;
|
StackFrame currentFrame() const;
|
||||||
|
const StackFrame &frameAt(int index) const { return m_stackFrames.at(index); }
|
||||||
int stackSize() const { return m_stackFrames.size(); }
|
int stackSize() const { return m_stackFrames.size(); }
|
||||||
quint64 topAddress() const { return m_stackFrames.at(0).address; }
|
quint64 topAddress() const { return m_stackFrames.at(0).address; }
|
||||||
|
|
||||||
@@ -89,13 +86,10 @@ private:
|
|||||||
int rowCount(const QModelIndex &parent) const;
|
int rowCount(const QModelIndex &parent) const;
|
||||||
int columnCount(const QModelIndex &parent) const;
|
int columnCount(const QModelIndex &parent) const;
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
bool setData(const QModelIndex &index, const QVariant &, int role);
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
Q_SLOT void resetModel() { reset(); }
|
Q_SLOT void resetModel() { reset(); }
|
||||||
|
|
||||||
DebuggerEngine *m_engine;
|
|
||||||
DisassemblerViewAgent *m_disassemblerViewAgent;
|
|
||||||
StackFrames m_stackFrames;
|
StackFrames m_stackFrames;
|
||||||
int m_currentIndex;
|
int m_currentIndex;
|
||||||
const QVariant m_positionIcon;
|
const QVariant m_positionIcon;
|
||||||
|
@@ -28,10 +28,13 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "stackwindow.h"
|
#include "stackwindow.h"
|
||||||
#include "stackframe.h"
|
#include "stackhandler.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
|
#include "debuggeragents.h"
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
|
#include "debuggerengine.h"
|
||||||
|
#include "debuggerplugin.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
@@ -47,6 +50,11 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
static DebuggerEngine *currentEngine()
|
||||||
|
{
|
||||||
|
return DebuggerPlugin::instance()->currentEngine();
|
||||||
|
}
|
||||||
|
|
||||||
StackWindow::StackWindow(QWidget *parent)
|
StackWindow::StackWindow(QWidget *parent)
|
||||||
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
|
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
|
||||||
{
|
{
|
||||||
@@ -65,19 +73,15 @@ StackWindow::StackWindow(QWidget *parent)
|
|||||||
header()->resizeSection(3, 60);
|
header()->resizeSection(3, 60);
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
connect(this, SIGNAL(activated(QModelIndex)),
|
||||||
this, SLOT(rowActivated(QModelIndex)));
|
SLOT(rowActivated(QModelIndex)));
|
||||||
connect(act, SIGNAL(toggled(bool)),
|
connect(act, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(setAlternatingRowColorsHelper(bool)));
|
SLOT(setAlternatingRowColorsHelper(bool)));
|
||||||
connect(theDebuggerAction(UseAddressInStackView), SIGNAL(toggled(bool)),
|
connect(theDebuggerAction(UseAddressInStackView), SIGNAL(toggled(bool)),
|
||||||
this, SLOT(showAddressColumn(bool)));
|
SLOT(showAddressColumn(bool)));
|
||||||
connect(theDebuggerAction(ExpandStack), SIGNAL(triggered()),
|
connect(theDebuggerAction(ExpandStack), SIGNAL(triggered()),
|
||||||
this, SLOT(reloadFullStack()));
|
SLOT(reloadFullStack()));
|
||||||
connect(theDebuggerAction(MaximalStackDepth), SIGNAL(triggered()),
|
connect(theDebuggerAction(MaximalStackDepth), SIGNAL(triggered()),
|
||||||
this, SLOT(reloadFullStack()));
|
SLOT(reloadFullStack()));
|
||||||
}
|
|
||||||
|
|
||||||
StackWindow::~StackWindow()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::showAddressColumn(bool on)
|
void StackWindow::showAddressColumn(bool on)
|
||||||
@@ -87,14 +91,20 @@ void StackWindow::showAddressColumn(bool on)
|
|||||||
|
|
||||||
void StackWindow::rowActivated(const QModelIndex &index)
|
void StackWindow::rowActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
setModelData(RequestActivateFrameRole, index.row());
|
currentEngine()->activateFrame(index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
|
DebuggerEngine *engine = currentEngine();
|
||||||
|
StackHandler *handler = engine->stackHandler();
|
||||||
const QModelIndex index = indexAt(ev->pos());
|
const QModelIndex index = indexAt(ev->pos());
|
||||||
const quint64 address = modelData(StackFrameAddressRole, index).toULongLong();
|
const int row = index.row();
|
||||||
const unsigned engineCapabilities = modelData(EngineCapabilitiesRole).toUInt();
|
const unsigned engineCapabilities = engine->debuggerCapabilities();
|
||||||
|
StackFrame frame;
|
||||||
|
if (row < handler->stackSize())
|
||||||
|
frame = handler->frameAt(row);
|
||||||
|
const quint64 address = frame.address;
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
menu.addAction(theDebuggerAction(ExpandStack));
|
menu.addAction(theDebuggerAction(ExpandStack));
|
||||||
@@ -149,9 +159,11 @@ 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)
|
||||||
setModelData(RequestShowMemoryRole, address);
|
(void) new MemoryViewAgent(currentEngine(), address);
|
||||||
else if (act == actShowDisassembler)
|
else if (act == actShowDisassembler) {
|
||||||
setModelData(RequestShowDisassemblerRole, index.row());
|
DisassemblerViewAgent *agent = new DisassemblerViewAgent(engine);
|
||||||
|
agent->setFrame(frame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::copyContentsToClipboard()
|
void StackWindow::copyContentsToClipboard()
|
||||||
@@ -176,7 +188,7 @@ void StackWindow::copyContentsToClipboard()
|
|||||||
|
|
||||||
void StackWindow::reloadFullStack()
|
void StackWindow::reloadFullStack()
|
||||||
{
|
{
|
||||||
setModelData(RequestReloadFullStackRole);
|
currentEngine()->reloadFullStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::resizeColumnsToContents()
|
void StackWindow::resizeColumnsToContents()
|
||||||
@@ -194,19 +206,5 @@ void StackWindow::setAlwaysResizeColumnsToContents(bool on)
|
|||||||
header()->setResizeMode(i, mode);
|
header()->setResizeMode(i, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::setModelData
|
|
||||||
(int role, const QVariant &value, const QModelIndex &index)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(model(), return);
|
|
||||||
model()->setData(index, value, role);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant StackWindow::modelData(int role, const QModelIndex &index)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(model(), return QVariant());
|
|
||||||
return model()->data(index, role);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -41,7 +41,6 @@ class StackWindow : public QTreeView
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StackWindow(QWidget *parent = 0);
|
explicit StackWindow(QWidget *parent = 0);
|
||||||
~StackWindow();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void resizeColumnsToContents();
|
void resizeColumnsToContents();
|
||||||
@@ -57,10 +56,6 @@ private:
|
|||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void copyContentsToClipboard();
|
void copyContentsToClipboard();
|
||||||
|
|
||||||
void setModelData(int role, const QVariant &value = QVariant(),
|
|
||||||
const QModelIndex &index = QModelIndex());
|
|
||||||
QVariant modelData(int role, const QModelIndex &index = QModelIndex());
|
|
||||||
|
|
||||||
bool m_alwaysResizeColumnsToContents;
|
bool m_alwaysResizeColumnsToContents;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
#include "watchhandler.h"
|
#include "watchhandler.h"
|
||||||
|
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "breakpoint.h"
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggeragents.h"
|
#include "debuggeragents.h"
|
||||||
#include "debuggerengine.h"
|
#include "debuggerengine.h"
|
||||||
@@ -822,44 +821,6 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
|
|||||||
|
|
||||||
bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
switch (role) {
|
|
||||||
case RequestShowInEditorRole: {
|
|
||||||
m_handler->showInEditor();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RequestToggleWatchRole: {
|
|
||||||
BreakHandler *handler = engine()->breakHandler();
|
|
||||||
const quint64 address = value.toULongLong();
|
|
||||||
const int index = handler->findWatchPointIndexByAddress(address);
|
|
||||||
if (index == -1) {
|
|
||||||
BreakpointData *data = new BreakpointData;
|
|
||||||
data->type = Watchpoint;
|
|
||||||
data->address = address;
|
|
||||||
handler->appendBreakpoint(data);
|
|
||||||
} else {
|
|
||||||
handler->removeBreakpoint(index);
|
|
||||||
}
|
|
||||||
engine()->attemptBreakpointSynchronization();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RequestShowMemoryRole: {
|
|
||||||
(void) new MemoryViewAgent(engine(), value.toULongLong());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RequestClearCppCodeModelSnapshotRole: {
|
|
||||||
plugin()->clearCppCodeModelSnapshot();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RequestWatchPointRole: {
|
|
||||||
engine()->watchPoint(value.toPoint());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WatchItem &data = *watchItem(index);
|
WatchItem &data = *watchItem(index);
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
@@ -899,14 +860,6 @@ bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int ro
|
|||||||
engine()->updateWatchData(data);
|
engine()->updateWatchData(data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case RequestRemoveWatchExpressionRole:
|
|
||||||
m_handler->removeWatchExpression(value.toString());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RequestWatchExpressionRole:
|
|
||||||
m_handler->watchExpression(value.toString());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
@@ -1734,12 +1687,12 @@ void WatchHandler::addTypeFormats(const QByteArray &type, const QStringList &for
|
|||||||
m_reportedTypeFormats.insert(type, formats);
|
m_reportedTypeFormats.insert(type, formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::showInEditor()
|
QString WatchHandler::editorContents()
|
||||||
{
|
{
|
||||||
QString contents;
|
QString contents;
|
||||||
showInEditorHelper(&contents, m_locals->m_root, 0);
|
showInEditorHelper(&contents, m_locals->m_root, 0);
|
||||||
showInEditorHelper(&contents, m_watchers->m_root, 0);
|
showInEditorHelper(&contents, m_watchers->m_root, 0);
|
||||||
plugin()->openTextEditor(tr("Locals & Watchers"), contents);
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::showInEditorHelper(QString *contents, WatchItem *item, int depth)
|
void WatchHandler::showInEditorHelper(QString *contents, WatchItem *item, int depth)
|
||||||
|
@@ -178,6 +178,7 @@ public:
|
|||||||
|
|
||||||
QByteArray watcherName(const QByteArray &exp);
|
QByteArray watcherName(const QByteArray &exp);
|
||||||
void synchronizeWatchers();
|
void synchronizeWatchers();
|
||||||
|
QString editorContents();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class WatchModel;
|
friend class WatchModel;
|
||||||
@@ -189,7 +190,6 @@ private:
|
|||||||
|
|
||||||
void setFormat(const QByteArray &type, int format);
|
void setFormat(const QByteArray &type, int format);
|
||||||
void updateWatchersWindow();
|
void updateWatchersWindow();
|
||||||
void showInEditor();
|
|
||||||
void showInEditorHelper(QString *contents, WatchItem *item, int level);
|
void showInEditorHelper(QString *contents, WatchItem *item, int level);
|
||||||
|
|
||||||
bool m_inChange;
|
bool m_inChange;
|
||||||
|
@@ -29,20 +29,23 @@
|
|||||||
|
|
||||||
#include "watchwindow.h"
|
#include "watchwindow.h"
|
||||||
|
|
||||||
|
#include "breakhandler.h"
|
||||||
|
#include "debuggeragents.h"
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggerengine.h"
|
|
||||||
#include "debuggerdialogs.h"
|
#include "debuggerdialogs.h"
|
||||||
#include "watchhandler.h"
|
#include "debuggerengine.h"
|
||||||
|
#include "debuggerplugin.h"
|
||||||
#include "watchdelegatewidgets.h"
|
#include "watchdelegatewidgets.h"
|
||||||
|
#include "watchhandler.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QVariant>
|
|
||||||
#include <QtCore/QMetaProperty>
|
|
||||||
#include <QtCore/QMetaObject>
|
#include <QtCore/QMetaObject>
|
||||||
|
#include <QtCore/QMetaProperty>
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
|
||||||
#include <QtGui/QContextMenuEvent>
|
#include <QtGui/QContextMenuEvent>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
@@ -50,8 +53,6 @@
|
|||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QResizeEvent>
|
#include <QtGui/QResizeEvent>
|
||||||
|
|
||||||
using namespace Debugger;
|
|
||||||
using namespace Debugger::Internal;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -59,10 +60,25 @@ using namespace Debugger::Internal;
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
static DebuggerPlugin *plugin()
|
||||||
|
{
|
||||||
|
return DebuggerPlugin::instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DebuggerEngine *currentEngine()
|
||||||
|
{
|
||||||
|
return DebuggerPlugin::instance()->currentEngine();
|
||||||
|
}
|
||||||
|
|
||||||
class WatchDelegate : public QItemDelegate
|
class WatchDelegate : public QItemDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit WatchDelegate(QObject *parent) : QItemDelegate(parent) {}
|
explicit WatchDelegate(WatchWindow *parent)
|
||||||
|
: QItemDelegate(parent), m_watchWindow(parent)
|
||||||
|
{}
|
||||||
|
|
||||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
@@ -98,12 +114,12 @@ public:
|
|||||||
}
|
}
|
||||||
const QMetaProperty userProperty = editor->metaObject()->userProperty();
|
const QMetaProperty userProperty = editor->metaObject()->userProperty();
|
||||||
QTC_ASSERT(userProperty.isValid(), return);
|
QTC_ASSERT(userProperty.isValid(), return);
|
||||||
const QVariant value = editor->property(userProperty.name());
|
const QString value = editor->property(userProperty.name()).toString();
|
||||||
const QString exp = index.data(LocalsExpressionRole).toString();
|
const QString exp = index.data(LocalsExpressionRole).toString();
|
||||||
if (exp != value.toString()) {
|
if (exp == value)
|
||||||
model->setData(index, exp, RequestRemoveWatchExpressionRole);
|
return;
|
||||||
model->setData(index, value, RequestWatchExpressionRole);
|
m_watchWindow->removeWatchExpression(exp);
|
||||||
}
|
m_watchWindow->watchExpression(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
|
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
|
||||||
@@ -111,6 +127,9 @@ public:
|
|||||||
{
|
{
|
||||||
editor->setGeometry(option.rect);
|
editor->setGeometry(option.rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
WatchWindow *m_watchWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
@@ -216,6 +235,9 @@ void WatchWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
|||||||
|
|
||||||
void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
|
DebuggerEngine *engine = currentEngine();
|
||||||
|
WatchHandler *handler = engine->watchHandler();
|
||||||
|
|
||||||
const QModelIndex idx = indexAt(ev->pos());
|
const QModelIndex idx = indexAt(ev->pos());
|
||||||
const QModelIndex mi0 = idx.sibling(idx.row(), 0);
|
const QModelIndex mi0 = idx.sibling(idx.row(), 0);
|
||||||
const QModelIndex mi1 = idx.sibling(idx.row(), 1);
|
const QModelIndex mi1 = idx.sibling(idx.row(), 1);
|
||||||
@@ -420,17 +442,17 @@ 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) {
|
||||||
setModelData(RequestShowMemoryRole, address);
|
(void) new MemoryViewAgent(currentEngine(), address);
|
||||||
} else if (act == actOpenMemoryEditAtPointerValue) {
|
} else if (act == actOpenMemoryEditAtPointerValue) {
|
||||||
setModelData(RequestShowMemoryRole, pointerValue);
|
(void) new MemoryViewAgent(currentEngine(), pointerValue);
|
||||||
} else if (act == actOpenMemoryEditor) {
|
} else if (act == actOpenMemoryEditor) {
|
||||||
AddressDialog dialog;
|
AddressDialog dialog;
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
setModelData(RequestShowMemoryRole, dialog.address());
|
(void) new MemoryViewAgent(currentEngine(), dialog.address());
|
||||||
} else if (act == actSetWatchPointAtVariableAddress) {
|
} else if (act == actSetWatchPointAtVariableAddress) {
|
||||||
setModelData(RequestToggleWatchRole, address);
|
setWatchpoint(address);
|
||||||
} else if (act == actSetWatchPointAtPointerValue) {
|
} else if (act == actSetWatchPointAtPointerValue) {
|
||||||
setModelData(RequestToggleWatchRole, pointerValue);
|
setWatchpoint(pointerValue);
|
||||||
} else if (act == actSelectWidgetToWatch) {
|
} else if (act == actSelectWidgetToWatch) {
|
||||||
grabMouse(Qt::CrossCursor);
|
grabMouse(Qt::CrossCursor);
|
||||||
m_grabbing = true;
|
m_grabbing = true;
|
||||||
@@ -439,13 +461,14 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
} else if (act == actRemoveWatchExpression) {
|
} else if (act == actRemoveWatchExpression) {
|
||||||
removeWatchExpression(exp);
|
removeWatchExpression(exp);
|
||||||
} else if (act == actClearCodeModelSnapshot) {
|
} else if (act == actClearCodeModelSnapshot) {
|
||||||
setModelData(RequestClearCppCodeModelSnapshotRole);
|
plugin()->clearCppCodeModelSnapshot();
|
||||||
} else if (act == clearTypeFormatAction) {
|
} else if (act == clearTypeFormatAction) {
|
||||||
setModelData(LocalsTypeFormatRole, -1, mi1);
|
setModelData(LocalsTypeFormatRole, -1, mi1);
|
||||||
} else if (act == clearIndividualFormatAction) {
|
} else if (act == clearIndividualFormatAction) {
|
||||||
setModelData(LocalsIndividualFormatRole, -1, mi1);
|
setModelData(LocalsIndividualFormatRole, -1, mi1);
|
||||||
} else if (act == actShowInEditor) {
|
} else if (act == actShowInEditor) {
|
||||||
setModelData(RequestShowInEditorRole);
|
QString contents = handler->editorContents();
|
||||||
|
plugin()->openTextEditor(tr("Locals & Watchers"), contents);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i != typeFormatActions.size(); ++i) {
|
for (int i = 0; i != typeFormatActions.size(); ++i) {
|
||||||
if (act == typeFormatActions.at(i))
|
if (act == typeFormatActions.at(i))
|
||||||
@@ -481,7 +504,7 @@ bool WatchWindow::event(QEvent *ev)
|
|||||||
QMouseEvent *mev = static_cast<QMouseEvent *>(ev);
|
QMouseEvent *mev = static_cast<QMouseEvent *>(ev);
|
||||||
m_grabbing = false;
|
m_grabbing = false;
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
setModelData(RequestWatchPointRole, mapToGlobal(mev->pos()));
|
currentEngine()->watchPoint(mapToGlobal(mev->pos()));
|
||||||
}
|
}
|
||||||
return QTreeView::event(ev);
|
return QTreeView::event(ev);
|
||||||
}
|
}
|
||||||
@@ -501,10 +524,8 @@ void WatchWindow::setModel(QAbstractItemModel *model)
|
|||||||
if (m_type != LocalsType)
|
if (m_type != LocalsType)
|
||||||
header()->hide();
|
header()->hide();
|
||||||
|
|
||||||
connect(model, SIGNAL(layoutChanged()),
|
connect(model, SIGNAL(layoutChanged()), SLOT(resetHelper()));
|
||||||
this, SLOT(resetHelper()));
|
connect(model, SIGNAL(enableUpdates(bool)), SLOT(setUpdatesEnabled(bool)));
|
||||||
connect(model, SIGNAL(enableUpdates(bool)),
|
|
||||||
this, SLOT(setUpdatesEnabled(bool)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::setUpdatesEnabled(bool enable)
|
void WatchWindow::setUpdatesEnabled(bool enable)
|
||||||
@@ -535,12 +556,12 @@ void WatchWindow::resetHelper(const QModelIndex &idx)
|
|||||||
|
|
||||||
void WatchWindow::watchExpression(const QString &exp)
|
void WatchWindow::watchExpression(const QString &exp)
|
||||||
{
|
{
|
||||||
setModelData(RequestWatchExpressionRole, exp);
|
currentEngine()->watchHandler()->watchExpression(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::removeWatchExpression(const QString &exp)
|
void WatchWindow::removeWatchExpression(const QString &exp)
|
||||||
{
|
{
|
||||||
setModelData(RequestRemoveWatchExpressionRole, exp);
|
currentEngine()->watchHandler()->removeWatchExpression(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::setModelData
|
void WatchWindow::setModelData
|
||||||
@@ -556,3 +577,22 @@ QVariant WatchWindow::modelData(int role, const QModelIndex &index)
|
|||||||
return model()->data(index, role);
|
return model()->data(index, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchWindow::setWatchpoint(quint64 address)
|
||||||
|
{
|
||||||
|
DebuggerEngine *engine = currentEngine();
|
||||||
|
BreakHandler *handler = engine->breakHandler();
|
||||||
|
const int index = handler->findWatchPointIndexByAddress(address);
|
||||||
|
if (index == -1) {
|
||||||
|
BreakpointData *data = new BreakpointData;
|
||||||
|
data->type = Watchpoint;
|
||||||
|
data->address = address;
|
||||||
|
handler->appendBreakpoint(data);
|
||||||
|
} else {
|
||||||
|
handler->removeBreakpoint(index);
|
||||||
|
}
|
||||||
|
engine->attemptBreakpointSynchronization();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
|
@@ -56,6 +56,8 @@ public slots:
|
|||||||
void setAlwaysResizeColumnsToContents(bool on = true);
|
void setAlwaysResizeColumnsToContents(bool on = true);
|
||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model);
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
||||||
|
void watchExpression(const QString &exp);
|
||||||
|
void removeWatchExpression(const QString &exp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_SLOT void resetHelper();
|
Q_SLOT void resetHelper();
|
||||||
@@ -73,8 +75,7 @@ private:
|
|||||||
|
|
||||||
void editItem(const QModelIndex &idx);
|
void editItem(const QModelIndex &idx);
|
||||||
void resetHelper(const QModelIndex &idx);
|
void resetHelper(const QModelIndex &idx);
|
||||||
void watchExpression(const QString &exp);
|
void setWatchpoint(quint64 address);
|
||||||
void removeWatchExpression(const QString &exp);
|
|
||||||
|
|
||||||
void setModelData(int role, const QVariant &value = QVariant(),
|
void setModelData(int role, const QVariant &value = QVariant(),
|
||||||
const QModelIndex &index = QModelIndex());
|
const QModelIndex &index = QModelIndex());
|
||||||
|
Reference in New Issue
Block a user