forked from qt-creator/qt-creator
debugger: move ModulesHandler from DebuggerManager to DebuggerRunControl
This commit is contained in:
@@ -152,6 +152,19 @@ enum LogChannel
|
|||||||
StatusBar // LogStatus and also put to the status bar
|
StatusBar // LogStatus and also put to the status bar
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ModelRoles
|
||||||
|
{
|
||||||
|
DisplaySourceRole = 32, // Qt::UserRole,
|
||||||
|
|
||||||
|
EngineCapabilityRole,
|
||||||
|
EngineActionsEnabledRole,
|
||||||
|
|
||||||
|
// Modules
|
||||||
|
RequestReloadModulesRole,
|
||||||
|
RequestModuleSymbolsRole,
|
||||||
|
RequestAllSymbolsRole
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
#endif // DEBUGGERCONSTANTS_H
|
#endif // DEBUGGERCONSTANTS_H
|
||||||
|
@@ -85,6 +85,7 @@
|
|||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QAbstractItemView>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QDockWidget>
|
#include <QtGui/QDockWidget>
|
||||||
@@ -269,7 +270,7 @@ struct DebuggerManagerPrivate
|
|||||||
const QIcon m_locationMarkIcon;
|
const QIcon m_locationMarkIcon;
|
||||||
|
|
||||||
// FIXME: Remove engine-specific state
|
// FIXME: Remove engine-specific state
|
||||||
const DebuggerRunControl *m_runControl;
|
DebuggerRunControl *m_runControl;
|
||||||
qint64 m_inferiorPid;
|
qint64 m_inferiorPid;
|
||||||
|
|
||||||
/// Views
|
/// Views
|
||||||
@@ -279,7 +280,6 @@ struct DebuggerManagerPrivate
|
|||||||
|
|
||||||
// FIXME: Move to DebuggerRunControl
|
// FIXME: Move to DebuggerRunControl
|
||||||
BreakHandler *m_breakHandler;
|
BreakHandler *m_breakHandler;
|
||||||
ModulesHandler *m_modulesHandler;
|
|
||||||
RegisterHandler *m_registerHandler;
|
RegisterHandler *m_registerHandler;
|
||||||
SnapshotHandler *m_snapshotHandler;
|
SnapshotHandler *m_snapshotHandler;
|
||||||
StackHandler *m_stackHandler;
|
StackHandler *m_stackHandler;
|
||||||
@@ -304,7 +304,7 @@ struct DebuggerManagerPrivate
|
|||||||
QWidget *m_localsWindow;
|
QWidget *m_localsWindow;
|
||||||
QWidget *m_watchersWindow;
|
QWidget *m_watchersWindow;
|
||||||
QWidget *m_registerWindow;
|
QWidget *m_registerWindow;
|
||||||
QWidget *m_modulesWindow;
|
QAbstractItemView *m_modulesWindow;
|
||||||
QWidget *m_snapshotWindow;
|
QWidget *m_snapshotWindow;
|
||||||
SourceFilesWindow *m_sourceFilesWindow;
|
SourceFilesWindow *m_sourceFilesWindow;
|
||||||
QWidget *m_stackWindow;
|
QWidget *m_stackWindow;
|
||||||
@@ -358,7 +358,6 @@ DebuggerManager::~DebuggerManager()
|
|||||||
|
|
||||||
doDelete(d->m_breakHandler);
|
doDelete(d->m_breakHandler);
|
||||||
doDelete(d->m_threadsHandler);
|
doDelete(d->m_threadsHandler);
|
||||||
doDelete(d->m_modulesHandler);
|
|
||||||
doDelete(d->m_registerHandler);
|
doDelete(d->m_registerHandler);
|
||||||
doDelete(d->m_snapshotHandler);
|
doDelete(d->m_snapshotHandler);
|
||||||
doDelete(d->m_stackHandler);
|
doDelete(d->m_stackHandler);
|
||||||
@@ -378,7 +377,6 @@ void DebuggerManager::init()
|
|||||||
d->m_state = DebuggerState(-1);
|
d->m_state = DebuggerState(-1);
|
||||||
d->m_busy = false;
|
d->m_busy = false;
|
||||||
|
|
||||||
d->m_modulesHandler = 0;
|
|
||||||
d->m_registerHandler = 0;
|
d->m_registerHandler = 0;
|
||||||
|
|
||||||
d->m_statusLabel = new QLabel;
|
d->m_statusLabel = new QLabel;
|
||||||
@@ -386,7 +384,7 @@ void DebuggerManager::init()
|
|||||||
|
|
||||||
d->m_breakWindow = new BreakWindow(this);
|
d->m_breakWindow = new BreakWindow(this);
|
||||||
d->m_breakWindow->setObjectName(QLatin1String("CppDebugBreakpoints"));
|
d->m_breakWindow->setObjectName(QLatin1String("CppDebugBreakpoints"));
|
||||||
d->m_modulesWindow = new ModulesWindow(this);
|
d->m_modulesWindow = new ModulesWindow();
|
||||||
d->m_modulesWindow->setObjectName(QLatin1String("CppDebugModules"));
|
d->m_modulesWindow->setObjectName(QLatin1String("CppDebugModules"));
|
||||||
d->m_outputWindow = new DebuggerOutputWindow;
|
d->m_outputWindow = new DebuggerOutputWindow;
|
||||||
d->m_outputWindow->setObjectName(QLatin1String("CppDebugOutput"));
|
d->m_outputWindow->setObjectName(QLatin1String("CppDebugOutput"));
|
||||||
@@ -457,17 +455,7 @@ void DebuggerManager::init()
|
|||||||
this, SLOT(breakByFunctionMain()), Qt::QueuedConnection);
|
this, SLOT(breakByFunctionMain()), Qt::QueuedConnection);
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
QAbstractItemView *modulesView =
|
connect(d->m_modulesWindow, SIGNAL(fileOpenRequested(QString)),
|
||||||
qobject_cast<QAbstractItemView *>(d->m_modulesWindow);
|
|
||||||
d->m_modulesHandler = new ModulesHandler;
|
|
||||||
modulesView->setModel(d->m_modulesHandler->model());
|
|
||||||
connect(modulesView, SIGNAL(reloadModulesRequested()),
|
|
||||||
this, SLOT(reloadModules()));
|
|
||||||
connect(modulesView, SIGNAL(loadSymbolsRequested(QString)),
|
|
||||||
this, SLOT(loadSymbols(QString)));
|
|
||||||
connect(modulesView, SIGNAL(loadAllSymbolsRequested()),
|
|
||||||
this, SLOT(loadAllSymbols()));
|
|
||||||
connect(modulesView, SIGNAL(fileOpenRequested(QString)),
|
|
||||||
this, SLOT(fileOpen(QString)));
|
this, SLOT(fileOpen(QString)));
|
||||||
|
|
||||||
// Source Files
|
// Source Files
|
||||||
@@ -724,6 +712,11 @@ void DebuggerManager::clearCppCodeModelSnapshot()
|
|||||||
d->m_codeModelSnapshot = CPlusPlus::Snapshot();
|
d->m_codeModelSnapshot = CPlusPlus::Snapshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAbstractItemView *DebuggerManager::modulesWindow() const
|
||||||
|
{
|
||||||
|
return d->m_modulesWindow;
|
||||||
|
}
|
||||||
|
|
||||||
SourceFilesWindow *DebuggerManager::sourceFileWindow() const
|
SourceFilesWindow *DebuggerManager::sourceFileWindow() const
|
||||||
{
|
{
|
||||||
return d->m_sourceFilesWindow;
|
return d->m_sourceFilesWindow;
|
||||||
@@ -1069,8 +1062,7 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl)
|
|||||||
setBusyCursor(false);
|
setBusyCursor(false);
|
||||||
setState(EngineStarting);
|
setState(EngineStarting);
|
||||||
connect(d->m_engine, SIGNAL(startFailed()), this, SLOT(startFailed()));
|
connect(d->m_engine, SIGNAL(startFailed()), this, SLOT(startFailed()));
|
||||||
d->m_engine->setRunControl(runControl);
|
runControl->startDebugger(d->m_engine);
|
||||||
d->m_engine->startDebugger();
|
|
||||||
|
|
||||||
const unsigned engineCapabilities = d->m_engine->debuggerCapabilities();
|
const unsigned engineCapabilities = d->m_engine->debuggerCapabilities();
|
||||||
theDebuggerAction(OperateByInstruction)
|
theDebuggerAction(OperateByInstruction)
|
||||||
@@ -1095,7 +1087,6 @@ void DebuggerManager::cleanupViews()
|
|||||||
breakHandler()->setAllPending();
|
breakHandler()->setAllPending();
|
||||||
stackHandler()->removeAll();
|
stackHandler()->removeAll();
|
||||||
threadsHandler()->removeAll();
|
threadsHandler()->removeAll();
|
||||||
modulesHandler()->removeAll();
|
|
||||||
watchHandler()->cleanup();
|
watchHandler()->cleanup();
|
||||||
registerHandler()->removeAll();
|
registerHandler()->removeAll();
|
||||||
d->m_sourceFilesWindow->removeAll();
|
d->m_sourceFilesWindow->removeAll();
|
||||||
@@ -1104,6 +1095,10 @@ void DebuggerManager::cleanupViews()
|
|||||||
d->m_actions.reverseDirectionAction->setEnabled(false);
|
d->m_actions.reverseDirectionAction->setEnabled(false);
|
||||||
hideDebuggerToolTip();
|
hideDebuggerToolTip();
|
||||||
|
|
||||||
|
// FIXME: Delete run control?
|
||||||
|
if (d->m_runControl)
|
||||||
|
d->m_runControl->cleanup();
|
||||||
|
|
||||||
// FIXME: Move to plugin?
|
// FIXME: Move to plugin?
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
if (EditorManager *editorManager = EditorManager::instance()) {
|
if (EditorManager *editorManager = EditorManager::instance()) {
|
||||||
@@ -1543,8 +1538,8 @@ void DebuggerManager::showMessage(const QString &msg, int channel)
|
|||||||
{
|
{
|
||||||
if (runControl())
|
if (runControl())
|
||||||
runControl()->showMessage(msg, channel);
|
runControl()->showMessage(msg, channel);
|
||||||
else
|
//else
|
||||||
qDebug() << "OUTPUT: " << channel << msg;
|
// qDebug() << "OUTPUT: " << channel << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1976,11 +1971,6 @@ DebuggerOutputWindow *DebuggerManager::debuggerOutputWindow() const
|
|||||||
return d->m_outputWindow;
|
return d->m_outputWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModulesHandler *DebuggerManager::modulesHandler() const
|
|
||||||
{
|
|
||||||
return d->m_modulesHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
BreakHandler *DebuggerManager::breakHandler() const
|
BreakHandler *DebuggerManager::breakHandler() const
|
||||||
{
|
{
|
||||||
return d->m_breakHandler;
|
return d->m_breakHandler;
|
||||||
@@ -2034,6 +2024,10 @@ void IDebuggerEngine::setState(DebuggerState state, bool forced)
|
|||||||
m_manager->setState(state, forced);
|
m_manager->setState(state, forced);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IDebuggerEngine::debuggerActionsEnabled() const
|
||||||
|
{
|
||||||
|
return m_manager->debuggerActionsEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
|
class QAbstractItemView;
|
||||||
class QAction;
|
class QAction;
|
||||||
class QDebug;
|
class QDebug;
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
@@ -252,7 +253,6 @@ public slots: // FIXME
|
|||||||
void startFailed();
|
void startFailed();
|
||||||
|
|
||||||
friend class DebuggerRunControl;
|
friend class DebuggerRunControl;
|
||||||
Internal::ModulesHandler *modulesHandler() const;
|
|
||||||
public:
|
public:
|
||||||
Internal::BreakHandler *breakHandler() const;
|
Internal::BreakHandler *breakHandler() const;
|
||||||
Internal::RegisterHandler *registerHandler() const;
|
Internal::RegisterHandler *registerHandler() const;
|
||||||
@@ -264,6 +264,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Internal::SourceFilesWindow *sourceFileWindow() const;
|
Internal::SourceFilesWindow *sourceFileWindow() const;
|
||||||
|
QAbstractItemView *modulesWindow() const;
|
||||||
QWidget *threadsWindow() const;
|
QWidget *threadsWindow() const;
|
||||||
|
|
||||||
Internal::DebuggerManagerActions debuggerManagerActions() const;
|
Internal::DebuggerManagerActions debuggerManagerActions() const;
|
||||||
|
@@ -31,6 +31,9 @@
|
|||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
#include "debuggeroutputwindow.h"
|
#include "debuggeroutputwindow.h"
|
||||||
|
|
||||||
|
#include "idebuggerengine.h"
|
||||||
|
#include "moduleshandler.h"
|
||||||
|
|
||||||
#include <projectexplorer/debugginghelper.h>
|
#include <projectexplorer/debugginghelper.h>
|
||||||
#include <projectexplorer/environment.h>
|
#include <projectexplorer/environment.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
@@ -46,6 +49,7 @@
|
|||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
|
#include <QtGui/QAbstractItemView>
|
||||||
#include <QtGui/QTextDocument>
|
#include <QtGui/QTextDocument>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -142,19 +146,22 @@ QWidget *DebuggerRunControlFactory::createConfigurationWidget(RunConfiguration *
|
|||||||
class DebuggerRunControl::Private
|
class DebuggerRunControl::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(DebuggerRunControl *parent);
|
Private(DebuggerRunControl *parent, DebuggerManager *manager,
|
||||||
|
const DebuggerStartParameters &startParameters);
|
||||||
|
~Private();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerRunControl *q;
|
DebuggerRunControl *q;
|
||||||
|
|
||||||
DebuggerStartParameters m_startParameters;
|
DebuggerStartParameters m_startParameters;
|
||||||
DebuggerManager *m_manager;
|
DebuggerManager *m_manager;
|
||||||
|
Internal::IDebuggerEngine *m_engine;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
|
|
||||||
|
ModulesHandler *m_modulesHandler;
|
||||||
/*
|
/*
|
||||||
// FIXME: Move from DebuggerManager
|
// FIXME: Move from DebuggerManager
|
||||||
BreakHandler *m_breakHandler;
|
BreakHandler *m_breakHandler;
|
||||||
ModulesHandler *m_modulesHandler;
|
|
||||||
RegisterHandler *m_registerHandler;
|
RegisterHandler *m_registerHandler;
|
||||||
SnapshotHandler *m_snapshotHandler;
|
SnapshotHandler *m_snapshotHandler;
|
||||||
StackHandler *m_stackHandler;
|
StackHandler *m_stackHandler;
|
||||||
@@ -163,9 +170,23 @@ public:
|
|||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
DebuggerRunControl::Private::Private(DebuggerRunControl *parent)
|
DebuggerRunControl::Private::Private(DebuggerRunControl *parent,
|
||||||
: q(parent)
|
DebuggerManager *manager,
|
||||||
|
const DebuggerStartParameters &startParameters)
|
||||||
|
: q(parent),
|
||||||
|
m_startParameters(startParameters),
|
||||||
|
m_manager(manager),
|
||||||
|
m_engine(0)
|
||||||
{
|
{
|
||||||
|
m_running = false;
|
||||||
|
m_modulesHandler = new ModulesHandler(q);
|
||||||
|
}
|
||||||
|
|
||||||
|
DebuggerRunControl::Private::~Private()
|
||||||
|
{
|
||||||
|
#define doDelete(ptr) delete ptr; ptr = 0
|
||||||
|
doDelete(m_modulesHandler);
|
||||||
|
#undef doDelete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -178,11 +199,8 @@ DebuggerRunControl::Private::Private(DebuggerRunControl *parent)
|
|||||||
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
||||||
const DebuggerStartParameters &startParameters)
|
const DebuggerStartParameters &startParameters)
|
||||||
: RunControl(0, ProjectExplorer::Constants::DEBUGMODE),
|
: RunControl(0, ProjectExplorer::Constants::DEBUGMODE),
|
||||||
d(new Private(this))
|
d(new Private(this, manager, startParameters))
|
||||||
{
|
{
|
||||||
d->m_startParameters = startParameters;
|
|
||||||
d->m_manager = manager;
|
|
||||||
d->m_running = false;
|
|
||||||
connect(d->m_manager, SIGNAL(debuggingFinished()),
|
connect(d->m_manager, SIGNAL(debuggingFinished()),
|
||||||
this, SLOT(debuggingFinished()),
|
this, SLOT(debuggingFinished()),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
@@ -298,7 +316,7 @@ const DebuggerStartParameters &DebuggerRunControl::sp() const
|
|||||||
|
|
||||||
ModulesHandler *DebuggerRunControl::modulesHandler() const
|
ModulesHandler *DebuggerRunControl::modulesHandler() const
|
||||||
{
|
{
|
||||||
return d->m_manager->modulesHandler();
|
return d->m_modulesHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
BreakHandler *DebuggerRunControl::breakHandler() const
|
BreakHandler *DebuggerRunControl::breakHandler() const
|
||||||
@@ -331,4 +349,23 @@ SnapshotHandler *DebuggerRunControl::snapshotHandler() const
|
|||||||
return d->m_manager->snapshotHandler();
|
return d->m_manager->snapshotHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerRunControl::cleanup()
|
||||||
|
{
|
||||||
|
modulesHandler()->removeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
Internal::IDebuggerEngine *DebuggerRunControl::engine()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(d->m_engine, /**/);
|
||||||
|
return d->m_engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerRunControl::startDebugger(IDebuggerEngine *engine)
|
||||||
|
{
|
||||||
|
d->m_engine = engine;
|
||||||
|
d->m_engine->setRunControl(this);
|
||||||
|
d->m_manager->modulesWindow()->setModel(d->m_modulesHandler->model());
|
||||||
|
d->m_engine->startDebugger();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -48,6 +48,7 @@ namespace Debugger {
|
|||||||
class DebuggerManager;
|
class DebuggerManager;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
class IDebuggerEngine;
|
||||||
class BreakHandler;
|
class BreakHandler;
|
||||||
class ModulesHandler;
|
class ModulesHandler;
|
||||||
class RegisterHandler;
|
class RegisterHandler;
|
||||||
@@ -147,6 +148,10 @@ public:
|
|||||||
Internal::WatchHandler *watchHandler() const;
|
Internal::WatchHandler *watchHandler() const;
|
||||||
Internal::SnapshotHandler *snapshotHandler() const;
|
Internal::SnapshotHandler *snapshotHandler() const;
|
||||||
|
|
||||||
|
void cleanup();
|
||||||
|
void startDebugger(Internal::IDebuggerEngine *engine);
|
||||||
|
Internal::IDebuggerEngine *engine();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stopRequested();
|
void stopRequested();
|
||||||
|
|
||||||
|
@@ -2709,7 +2709,7 @@ void GdbEngine::handleModulesList(const GdbResponse &response)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manager()->modulesHandler()->setModules(modules);
|
runControl()->modulesHandler()->setModules(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -138,6 +138,7 @@ public slots:
|
|||||||
void showStatusMessage(const QString &msg, int timeout = -1) const
|
void showStatusMessage(const QString &msg, int timeout = -1) const
|
||||||
{ showMessage(msg, StatusBar, timeout); }
|
{ showMessage(msg, StatusBar, timeout); }
|
||||||
DebuggerManager *manager() const { return m_manager; }
|
DebuggerManager *manager() const { return m_manager; }
|
||||||
|
bool debuggerActionsEnabled() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DebuggerState state() const;
|
DebuggerState state() const;
|
||||||
|
@@ -28,6 +28,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "moduleshandler.h"
|
#include "moduleshandler.h"
|
||||||
|
#include "idebuggerengine.h"
|
||||||
|
#include "debuggerrunner.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -41,9 +43,6 @@
|
|||||||
#include <QtGui/QStandardItemModel>
|
#include <QtGui/QStandardItemModel>
|
||||||
#include <QtGui/QSortFilterProxyModel>
|
#include <QtGui/QSortFilterProxyModel>
|
||||||
|
|
||||||
using namespace Debugger;
|
|
||||||
using namespace Debugger::Internal;
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -51,12 +50,13 @@ using namespace Debugger::Internal;
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class Debugger::Internal::ModulesModel : public QAbstractItemModel
|
namespace Debugger {
|
||||||
{
|
namespace Internal {
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
|
class ModulesModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
explicit ModulesModel(ModulesHandler *parent);
|
explicit ModulesModel(ModulesHandler *parent, DebuggerRunControl *runControl);
|
||||||
|
|
||||||
// QAbstractItemModel
|
// QAbstractItemModel
|
||||||
int columnCount(const QModelIndex &parent) const
|
int columnCount(const QModelIndex &parent) const
|
||||||
@@ -76,20 +76,22 @@ public:
|
|||||||
void setModules(const QList<Module> &m);
|
void setModules(const QList<Module> &m);
|
||||||
|
|
||||||
const QList<Module> &modules() const { return m_modules; }
|
const QList<Module> &modules() const { return m_modules; }
|
||||||
|
IDebuggerEngine *engine() { return m_runControl->engine(); }
|
||||||
|
const IDebuggerEngine *engine() const { return m_runControl->engine(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int indexOfModule(const QString &name) const;
|
int indexOfModule(const QString &name) const;
|
||||||
|
|
||||||
|
DebuggerRunControl *m_runControl;
|
||||||
const QVariant m_yes;
|
const QVariant m_yes;
|
||||||
const QVariant m_no;
|
const QVariant m_no;
|
||||||
QList<Module> m_modules;
|
QList<Module> m_modules;
|
||||||
};
|
};
|
||||||
|
|
||||||
ModulesModel::ModulesModel(ModulesHandler *parent) :
|
ModulesModel::ModulesModel(ModulesHandler *parent, DebuggerRunControl *runControl)
|
||||||
QAbstractItemModel(parent),
|
: QAbstractItemModel(parent),
|
||||||
m_yes(tr("yes")), m_no(tr("no"))
|
m_runControl(runControl), m_yes(tr("yes")), m_no(tr("no"))
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
QVariant ModulesModel::headerData(int section,
|
QVariant ModulesModel::headerData(int section,
|
||||||
Qt::Orientation orientation, int role) const
|
Qt::Orientation orientation, int role) const
|
||||||
@@ -109,6 +111,12 @@ 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 == EngineCapabilityRole)
|
||||||
|
return engine()->debuggerCapabilities();
|
||||||
|
|
||||||
|
if (role == EngineActionsEnabledRole)
|
||||||
|
return 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();
|
||||||
@@ -145,6 +153,18 @@ QVariant ModulesModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
bool ModulesModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool ModulesModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
|
if (role == RequestReloadModulesRole) {
|
||||||
|
engine()->reloadModules();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (role == RequestModuleSymbolsRole) {
|
||||||
|
engine()->loadSymbols(value.toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (role == RequestAllSymbolsRole) {
|
||||||
|
engine()->loadAllSymbols();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return QAbstractItemModel::setData(index, value, role);
|
return QAbstractItemModel::setData(index, value, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,9 +214,9 @@ void ModulesModel::removeModule(const QString &moduleName)
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ModulesHandler::ModulesHandler()
|
ModulesHandler::ModulesHandler(DebuggerRunControl *runControl)
|
||||||
{
|
{
|
||||||
m_model = new ModulesModel(this);
|
m_model = new ModulesModel(this, runControl);
|
||||||
m_proxyModel = new QSortFilterProxyModel(this);
|
m_proxyModel = new QSortFilterProxyModel(this);
|
||||||
m_proxyModel->setSourceModel(m_model);
|
m_proxyModel->setSourceModel(m_model);
|
||||||
}
|
}
|
||||||
@@ -231,4 +251,7 @@ QList<Module> ModulesHandler::modules() const
|
|||||||
return m_model->modules();
|
return m_model->modules();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
#include "moduleshandler.moc"
|
#include "moduleshandler.moc"
|
||||||
|
@@ -40,17 +40,13 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
|
class DebuggerRunControl;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ModulesModel;
|
class ModulesModel;
|
||||||
|
|
||||||
enum ModulesModelRoles
|
|
||||||
{
|
|
||||||
DisplaySourceRole = Qt::UserRole,
|
|
||||||
LoadSymbolsRole,
|
|
||||||
LoadAllSymbolsRole
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Symbol
|
// Symbol
|
||||||
@@ -93,10 +89,8 @@ public:
|
|||||||
|
|
||||||
class ModulesHandler : public QObject
|
class ModulesHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ModulesHandler();
|
explicit ModulesHandler(DebuggerRunControl *runControl);
|
||||||
|
|
||||||
QAbstractItemModel *model() const;
|
QAbstractItemModel *model() const;
|
||||||
|
|
||||||
|
@@ -29,23 +29,19 @@
|
|||||||
|
|
||||||
#include "moduleswindow.h"
|
#include "moduleswindow.h"
|
||||||
|
|
||||||
#include "moduleshandler.h" // for model roles
|
#include "debuggerconstants.h"
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggermanager.h"
|
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QProcess>
|
|
||||||
#include <QtCore/QRegExp>
|
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QResizeEvent>
|
#include <QtGui/QResizeEvent>
|
||||||
#include <QtGui/QToolButton>
|
|
||||||
#include <QtGui/QTreeWidget>
|
|
||||||
#include <QtGui/QApplication>
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -56,11 +52,8 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ModulesWindow::ModulesWindow(DebuggerManager *debuggerManager,
|
ModulesWindow::ModulesWindow(QWidget *parent)
|
||||||
QWidget *parent) :
|
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
|
||||||
QTreeView(parent),
|
|
||||||
m_alwaysResizeColumnsToContents(false),
|
|
||||||
m_debuggerManager(debuggerManager)
|
|
||||||
{
|
{
|
||||||
QAction *act = theDebuggerAction(UseAlternatingRowColors);
|
QAction *act = theDebuggerAction(UseAlternatingRowColors);
|
||||||
setWindowTitle(tr("Modules"));
|
setWindowTitle(tr("Modules"));
|
||||||
@@ -106,12 +99,14 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
index = index.sibling(index.row(), 0);
|
index = index.sibling(index.row(), 0);
|
||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
name = model()->data(index).toString();
|
name = index.data().toString();
|
||||||
|
|
||||||
|
const bool enabled =
|
||||||
|
model() && model()->data(index, EngineActionsEnabledRole).toBool();
|
||||||
|
const unsigned capabilities =
|
||||||
|
model()->data(index, EngineCapabilityRole).toInt();
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
const bool enabled = Debugger::DebuggerManager::instance()->debuggerActionsEnabled();
|
|
||||||
const unsigned capabilities = Debugger::DebuggerManager::instance()->debuggerCapabilities();
|
|
||||||
QAction *act0 = new QAction(tr("Update Module List"), &menu);
|
QAction *act0 = new QAction(tr("Update Module List"), &menu);
|
||||||
act0->setEnabled(enabled && (capabilities & ReloadModuleCapability));
|
act0->setEnabled(enabled && (capabilities & ReloadModuleCapability));
|
||||||
QAction *act3 = new QAction(tr("Show Source Files for Module \"%1\"").arg(name), &menu);
|
QAction *act3 = new QAction(tr("Show Source Files for Module \"%1\"").arg(name), &menu);
|
||||||
@@ -136,10 +131,11 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
menu.addAction(act0);
|
menu.addAction(act0);
|
||||||
|
//menu.addAction(act3); // FIXME
|
||||||
menu.addAction(act4);
|
menu.addAction(act4);
|
||||||
menu.addAction(act5);
|
menu.addAction(act5);
|
||||||
menu.addAction(act6);
|
menu.addAction(act6);
|
||||||
menu.addAction(act7);
|
//menu.addAction(act7); // FIXME
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
QAction *actAdjustColumnWidths =
|
QAction *actAdjustColumnWidths =
|
||||||
menu.addAction(tr("Adjust Column Widths to Contents"));
|
menu.addAction(tr("Adjust Column Widths to Contents"));
|
||||||
@@ -152,22 +148,27 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
|
|
||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
if (act == act0)
|
if (act == act0) {
|
||||||
emit reloadModulesRequested();
|
QTC_ASSERT(model(), return);
|
||||||
else if (act == actAdjustColumnWidths)
|
model()->setData(QModelIndex(), QVariant(), RequestReloadModulesRole);
|
||||||
|
} else if (act == actAdjustColumnWidths) {
|
||||||
resizeColumnsToContents();
|
resizeColumnsToContents();
|
||||||
else if (act == actAlwaysAdjustColumnWidth)
|
} else if (act == actAlwaysAdjustColumnWidth) {
|
||||||
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
|
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
|
||||||
else if (act == act3)
|
//} else if (act == act3) {
|
||||||
emit displaySourceRequested(name);
|
// emit displaySourceRequested(name);
|
||||||
else if (act == act4)
|
} else if (act == act4) {
|
||||||
emit loadAllSymbolsRequested();
|
QTC_ASSERT(model(), return);
|
||||||
else if (act == act5)
|
model()->setData(QModelIndex(), QVariant(), RequestAllSymbolsRole);
|
||||||
emit loadSymbolsRequested(name);
|
} else if (act == act5) {
|
||||||
else if (act == act6)
|
QTC_ASSERT(model(), return);
|
||||||
|
model()->setData(QModelIndex(), name, RequestModuleSymbolsRole);
|
||||||
|
} else if (act == act6) {
|
||||||
emit fileOpenRequested(name);
|
emit fileOpenRequested(name);
|
||||||
else if (act == act7)
|
} else if (act == act7) {
|
||||||
showSymbols(name);
|
QTC_ASSERT(model(), return);
|
||||||
|
model()->setData(QModelIndex(), name, RequestModuleSymbolsRole);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesWindow::resizeColumnsToContents()
|
void ModulesWindow::resizeColumnsToContents()
|
||||||
@@ -197,11 +198,5 @@ void ModulesWindow::setModel(QAbstractItemModel *model)
|
|||||||
setAlwaysResizeColumnsToContents(true);
|
setAlwaysResizeColumnsToContents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesWindow::showSymbols(const QString &name)
|
|
||||||
{
|
|
||||||
if (!name.isEmpty())
|
|
||||||
m_debuggerManager->requestModuleSymbols(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -33,8 +33,6 @@
|
|||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
class DebuggerManager;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ModulesWindow : public QTreeView
|
class ModulesWindow : public QTreeView
|
||||||
@@ -42,21 +40,15 @@ class ModulesWindow : public QTreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ModulesWindow(DebuggerManager *debuggerManager, QWidget *parent = 0);
|
explicit ModulesWindow(QWidget *parent = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void reloadModulesRequested();
|
|
||||||
void displaySourceRequested(const QString &modulesName);
|
|
||||||
void loadSymbolsRequested(const QString &modulesName);
|
|
||||||
void loadAllSymbolsRequested();
|
|
||||||
void fileOpenRequested(QString);
|
void fileOpenRequested(QString);
|
||||||
void newDockRequested(QWidget *w);
|
|
||||||
|
|
||||||
public slots:
|
private slots:
|
||||||
void resizeColumnsToContents();
|
void resizeColumnsToContents();
|
||||||
void setAlwaysResizeColumnsToContents(bool on);
|
void setAlwaysResizeColumnsToContents(bool on);
|
||||||
void moduleActivated(const QModelIndex &);
|
void moduleActivated(const QModelIndex &index);
|
||||||
void showSymbols(const QString &name);
|
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -65,7 +57,6 @@ private:
|
|||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model);
|
||||||
|
|
||||||
bool m_alwaysResizeColumnsToContents;
|
bool m_alwaysResizeColumnsToContents;
|
||||||
DebuggerManager *m_debuggerManager;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -419,7 +419,7 @@ void PdbEngine::handleListModules(const PdbResponse &response)
|
|||||||
module.modulePath = path;
|
module.modulePath = path;
|
||||||
modules.append(module);
|
modules.append(module);
|
||||||
}
|
}
|
||||||
manager()->modulesHandler()->setModules(modules);
|
runControl()->modulesHandler()->setModules(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::requestModuleSymbols(const QString &moduleName)
|
void PdbEngine::requestModuleSymbols(const QString &moduleName)
|
||||||
|
Reference in New Issue
Block a user