forked from qt-creator/qt-creator
debugger: add model accessors to run control
Plan is to move the models themselves from DebuggerManager to DebuggerRunControl.
This commit is contained in:
@@ -277,6 +277,15 @@ struct DebuggerManagerPrivate
|
||||
|
||||
QLabel *m_statusLabel;
|
||||
|
||||
// FIXME: Move to DebuggerRunControl
|
||||
BreakHandler *m_breakHandler;
|
||||
ModulesHandler *m_modulesHandler;
|
||||
RegisterHandler *m_registerHandler;
|
||||
SnapshotHandler *m_snapshotHandler;
|
||||
StackHandler *m_stackHandler;
|
||||
ThreadsHandler *m_threadsHandler;
|
||||
WatchHandler *m_watchHandler;
|
||||
|
||||
QDockWidget *m_breakDock;
|
||||
QDockWidget *m_modulesDock;
|
||||
QDockWidget *m_outputDock;
|
||||
@@ -288,14 +297,6 @@ struct DebuggerManagerPrivate
|
||||
QDockWidget *m_watchDock;
|
||||
QList<QDockWidget *> m_dockWidgets;
|
||||
|
||||
BreakHandler *m_breakHandler;
|
||||
ModulesHandler *m_modulesHandler;
|
||||
RegisterHandler *m_registerHandler;
|
||||
SnapshotHandler *m_snapshotHandler;
|
||||
StackHandler *m_stackHandler;
|
||||
ThreadsHandler *m_threadsHandler;
|
||||
WatchHandler *m_watchHandler;
|
||||
|
||||
DebuggerManagerActions m_actions;
|
||||
|
||||
QWidget *m_breakWindow;
|
||||
@@ -711,41 +712,6 @@ IDebuggerEngine *DebuggerManager::currentEngine() const
|
||||
return d->m_engine;
|
||||
}
|
||||
|
||||
ModulesHandler *DebuggerManager::modulesHandler() const
|
||||
{
|
||||
return d->m_modulesHandler;
|
||||
}
|
||||
|
||||
BreakHandler *DebuggerManager::breakHandler() const
|
||||
{
|
||||
return d->m_breakHandler;
|
||||
}
|
||||
|
||||
RegisterHandler *DebuggerManager::registerHandler() const
|
||||
{
|
||||
return d->m_registerHandler;
|
||||
}
|
||||
|
||||
StackHandler *DebuggerManager::stackHandler() const
|
||||
{
|
||||
return d->m_stackHandler;
|
||||
}
|
||||
|
||||
ThreadsHandler *DebuggerManager::threadsHandler() const
|
||||
{
|
||||
return d->m_threadsHandler;
|
||||
}
|
||||
|
||||
WatchHandler *DebuggerManager::watchHandler() const
|
||||
{
|
||||
return d->m_watchHandler;
|
||||
}
|
||||
|
||||
SnapshotHandler *DebuggerManager::snapshotHandler() const
|
||||
{
|
||||
return d->m_snapshotHandler;
|
||||
}
|
||||
|
||||
const CPlusPlus::Snapshot &DebuggerManager::cppCodeModelSnapshot() const
|
||||
{
|
||||
if (d->m_codeModelSnapshot.isEmpty() && theDebuggerAction(UseCodeModel)->isChecked())
|
||||
@@ -2010,6 +1976,40 @@ DebuggerOutputWindow *DebuggerManager::debuggerOutputWindow() const
|
||||
return d->m_outputWindow;
|
||||
}
|
||||
|
||||
ModulesHandler *DebuggerManager::modulesHandler() const
|
||||
{
|
||||
return d->m_modulesHandler;
|
||||
}
|
||||
|
||||
BreakHandler *DebuggerManager::breakHandler() const
|
||||
{
|
||||
return d->m_breakHandler;
|
||||
}
|
||||
|
||||
RegisterHandler *DebuggerManager::registerHandler() const
|
||||
{
|
||||
return d->m_registerHandler;
|
||||
}
|
||||
|
||||
StackHandler *DebuggerManager::stackHandler() const
|
||||
{
|
||||
return d->m_stackHandler;
|
||||
}
|
||||
|
||||
ThreadsHandler *DebuggerManager::threadsHandler() const
|
||||
{
|
||||
return d->m_threadsHandler;
|
||||
}
|
||||
|
||||
WatchHandler *DebuggerManager::watchHandler() const
|
||||
{
|
||||
return d->m_watchHandler;
|
||||
}
|
||||
|
||||
SnapshotHandler *DebuggerManager::snapshotHandler() const
|
||||
{
|
||||
return d->m_snapshotHandler;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@@ -69,16 +69,10 @@ namespace Internal {
|
||||
class DebuggerOutputWindow;
|
||||
class DebuggerPlugin;
|
||||
|
||||
class BreakHandler;
|
||||
class BreakpointData;
|
||||
class ModulesHandler;
|
||||
class RegisterHandler;
|
||||
class SourceFilesWindow;
|
||||
struct StackFrame;
|
||||
class StackHandler;
|
||||
class Symbol;
|
||||
class SnapshotHandler;
|
||||
class ThreadsHandler;
|
||||
class WatchData;
|
||||
class WatchHandler;
|
||||
class IDebuggerEngine;
|
||||
@@ -257,8 +251,9 @@ public slots: // FIXME
|
||||
void operateByInstructionTriggered();
|
||||
void startFailed();
|
||||
|
||||
public:
|
||||
friend class DebuggerRunControl;
|
||||
Internal::ModulesHandler *modulesHandler() const;
|
||||
public:
|
||||
Internal::BreakHandler *breakHandler() const;
|
||||
Internal::RegisterHandler *registerHandler() const;
|
||||
Internal::StackHandler *stackHandler() const;
|
||||
|
@@ -52,14 +52,14 @@ using namespace ProjectExplorer;
|
||||
using namespace Debugger::Internal;
|
||||
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DebuggerRunControlFactory
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
// A factory to create DebuggerRunControls
|
||||
DebuggerRunControlFactory::DebuggerRunControlFactory(DebuggerManager *manager)
|
||||
: m_manager(manager)
|
||||
@@ -112,8 +112,8 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
|
||||
return sp;
|
||||
}
|
||||
|
||||
RunControl *DebuggerRunControlFactory::create(RunConfiguration *runConfiguration,
|
||||
const QString &mode)
|
||||
RunControl *DebuggerRunControlFactory::create
|
||||
(RunConfiguration *runConfiguration, const QString &mode)
|
||||
{
|
||||
QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0);
|
||||
DebuggerStartParameters sp = localStartParameters(runConfiguration);
|
||||
@@ -133,6 +133,41 @@ QWidget *DebuggerRunControlFactory::createConfigurationWidget(RunConfiguration *
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DebuggerRunControl::Private
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class DebuggerRunControl::Private
|
||||
{
|
||||
public:
|
||||
Private(DebuggerRunControl *parent);
|
||||
|
||||
public:
|
||||
DebuggerRunControl *q;
|
||||
|
||||
DebuggerStartParameters m_startParameters;
|
||||
DebuggerManager *m_manager;
|
||||
bool m_running;
|
||||
|
||||
/*
|
||||
// FIXME: Move from DebuggerManager
|
||||
BreakHandler *m_breakHandler;
|
||||
ModulesHandler *m_modulesHandler;
|
||||
RegisterHandler *m_registerHandler;
|
||||
SnapshotHandler *m_snapshotHandler;
|
||||
StackHandler *m_stackHandler;
|
||||
ThreadsHandler *m_threadsHandler;
|
||||
WatchHandler *m_watchHandler;
|
||||
*/
|
||||
};
|
||||
|
||||
DebuggerRunControl::Private::Private(DebuggerRunControl *parent)
|
||||
: q(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -143,35 +178,41 @@ QWidget *DebuggerRunControlFactory::createConfigurationWidget(RunConfiguration *
|
||||
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
||||
const DebuggerStartParameters &startParameters)
|
||||
: RunControl(0, ProjectExplorer::Constants::DEBUGMODE),
|
||||
m_startParameters(startParameters),
|
||||
m_manager(manager),
|
||||
m_running(false)
|
||||
d(new Private(this))
|
||||
{
|
||||
connect(m_manager, SIGNAL(debuggingFinished()),
|
||||
d->m_startParameters = startParameters;
|
||||
d->m_manager = manager;
|
||||
d->m_running = false;
|
||||
connect(d->m_manager, SIGNAL(debuggingFinished()),
|
||||
this, SLOT(debuggingFinished()),
|
||||
Qt::QueuedConnection);
|
||||
connect(m_manager, SIGNAL(messageAvailable(QString, bool)),
|
||||
connect(d->m_manager, SIGNAL(messageAvailable(QString, bool)),
|
||||
this, SLOT(slotMessageAvailable(QString, bool)));
|
||||
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
||||
connect(d->m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
||||
this, SLOT(bringApplicationToForeground(qint64)),
|
||||
Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(stopRequested()),
|
||||
m_manager, SLOT(exitDebugger()));
|
||||
d->m_manager, SLOT(exitDebugger()));
|
||||
|
||||
if (m_startParameters.environment.empty())
|
||||
m_startParameters.environment = ProjectExplorer::Environment().toStringList();
|
||||
m_startParameters.useTerminal = false;
|
||||
if (d->m_startParameters.environment.empty())
|
||||
d->m_startParameters.environment = ProjectExplorer::Environment().toStringList();
|
||||
d->m_startParameters.useTerminal = false;
|
||||
|
||||
}
|
||||
|
||||
DebuggerRunControl::~DebuggerRunControl()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
QString DebuggerRunControl::displayName() const
|
||||
{
|
||||
return m_startParameters.displayName;
|
||||
return d->m_startParameters.displayName;
|
||||
}
|
||||
|
||||
void DebuggerRunControl::setCustomEnvironment(ProjectExplorer::Environment env)
|
||||
{
|
||||
m_startParameters.environment = env.toStringList();
|
||||
d->m_startParameters.environment = env.toStringList();
|
||||
}
|
||||
|
||||
void DebuggerRunControl::init()
|
||||
@@ -180,13 +221,13 @@ void DebuggerRunControl::init()
|
||||
|
||||
void DebuggerRunControl::start()
|
||||
{
|
||||
m_running = true;
|
||||
d->m_running = true;
|
||||
QString errorMessage;
|
||||
QString settingsCategory;
|
||||
QString settingsPage;
|
||||
if (m_manager->checkDebugConfiguration(m_startParameters.toolChainType,
|
||||
if (d->m_manager->checkDebugConfiguration(d->m_startParameters.toolChainType,
|
||||
&errorMessage, &settingsCategory, &settingsPage)) {
|
||||
m_manager->startNewDebugger(this);
|
||||
d->m_manager->startNewDebugger(this);
|
||||
emit started();
|
||||
} else {
|
||||
appendMessage(this, errorMessage, true);
|
||||
@@ -199,13 +240,13 @@ void DebuggerRunControl::start()
|
||||
void DebuggerRunControl::showMessage(const QString &msg, int channel,
|
||||
int timeout)
|
||||
{
|
||||
if (!m_manager)
|
||||
if (!d->m_manager)
|
||||
return;
|
||||
DebuggerOutputWindow *ow = m_manager->debuggerOutputWindow();
|
||||
DebuggerOutputWindow *ow = d->m_manager->debuggerOutputWindow();
|
||||
QTC_ASSERT(ow, return);
|
||||
switch (channel) {
|
||||
case StatusBar:
|
||||
m_manager->showStatusMessage(msg, timeout);
|
||||
d->m_manager->showStatusMessage(msg, timeout);
|
||||
ow->showOutput(LogStatus, msg);
|
||||
break;
|
||||
case AppOutput:
|
||||
@@ -233,22 +274,61 @@ void DebuggerRunControl::slotMessageAvailable(const QString &data, bool isError)
|
||||
emit appendMessage(this, data, isError);
|
||||
}
|
||||
|
||||
|
||||
void DebuggerRunControl::stop()
|
||||
{
|
||||
m_running = false;
|
||||
d->m_running = false;
|
||||
emit stopRequested();
|
||||
}
|
||||
|
||||
void DebuggerRunControl::debuggingFinished()
|
||||
{
|
||||
m_running = false;
|
||||
d->m_running = false;
|
||||
emit finished();
|
||||
}
|
||||
|
||||
bool DebuggerRunControl::isRunning() const
|
||||
{
|
||||
return m_running;
|
||||
return d->m_running;
|
||||
}
|
||||
|
||||
const DebuggerStartParameters &DebuggerRunControl::sp() const
|
||||
{
|
||||
return d->m_startParameters;
|
||||
}
|
||||
|
||||
ModulesHandler *DebuggerRunControl::modulesHandler() const
|
||||
{
|
||||
return d->m_manager->modulesHandler();
|
||||
}
|
||||
|
||||
BreakHandler *DebuggerRunControl::breakHandler() const
|
||||
{
|
||||
return d->m_manager->breakHandler();
|
||||
}
|
||||
|
||||
RegisterHandler *DebuggerRunControl::registerHandler() const
|
||||
{
|
||||
return d->m_manager->registerHandler();
|
||||
}
|
||||
|
||||
StackHandler *DebuggerRunControl::stackHandler() const
|
||||
{
|
||||
return d->m_manager->stackHandler();
|
||||
}
|
||||
|
||||
ThreadsHandler *DebuggerRunControl::threadsHandler() const
|
||||
{
|
||||
return d->m_manager->threadsHandler();
|
||||
}
|
||||
|
||||
WatchHandler *DebuggerRunControl::watchHandler() const
|
||||
{
|
||||
return d->m_manager->watchHandler();
|
||||
}
|
||||
|
||||
SnapshotHandler *DebuggerRunControl::snapshotHandler() const
|
||||
{
|
||||
return d->m_manager->snapshotHandler();
|
||||
}
|
||||
|
||||
} // namespace Debugger
|
||||
|
@@ -42,10 +42,21 @@ namespace ProjectExplorer {
|
||||
class Environment;
|
||||
}
|
||||
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
class DebuggerManager;
|
||||
|
||||
namespace Internal {
|
||||
class BreakHandler;
|
||||
class ModulesHandler;
|
||||
class RegisterHandler;
|
||||
class StackHandler;
|
||||
class SnapshotHandler;
|
||||
class ThreadsHandler;
|
||||
class WatchHandler;
|
||||
}
|
||||
|
||||
class DEBUGGER_EXPORT DebuggerStartParameters
|
||||
{
|
||||
public:
|
||||
@@ -104,7 +115,8 @@ private:
|
||||
DebuggerManager *m_manager;
|
||||
};
|
||||
|
||||
// This is a job description
|
||||
// This is a job description containing all data "local" to the jobs, including
|
||||
// the models of the individual debugger views.
|
||||
class DEBUGGER_EXPORT DebuggerRunControl
|
||||
: public ProjectExplorer::RunControl
|
||||
{
|
||||
@@ -113,6 +125,7 @@ class DEBUGGER_EXPORT DebuggerRunControl
|
||||
public:
|
||||
DebuggerRunControl(DebuggerManager *manager,
|
||||
const DebuggerStartParameters &startParameters);
|
||||
~DebuggerRunControl();
|
||||
|
||||
void setCustomEnvironment(ProjectExplorer::Environment env);
|
||||
|
||||
@@ -124,7 +137,15 @@ public:
|
||||
|
||||
Q_SLOT void debuggingFinished();
|
||||
|
||||
const DebuggerStartParameters &sp() const { return m_startParameters; }
|
||||
const DebuggerStartParameters &sp() const;
|
||||
|
||||
Internal::ModulesHandler *modulesHandler() const;
|
||||
Internal::BreakHandler *breakHandler() const;
|
||||
Internal::RegisterHandler *registerHandler() const;
|
||||
Internal::StackHandler *stackHandler() const;
|
||||
Internal::ThreadsHandler *threadsHandler() const;
|
||||
Internal::WatchHandler *watchHandler() const;
|
||||
Internal::SnapshotHandler *snapshotHandler() const;
|
||||
|
||||
signals:
|
||||
void stopRequested();
|
||||
@@ -137,9 +158,8 @@ private slots:
|
||||
|
||||
private:
|
||||
void init();
|
||||
DebuggerStartParameters m_startParameters;
|
||||
DebuggerManager *m_manager;
|
||||
bool m_running;
|
||||
class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
} // namespace Debugger
|
||||
|
Reference in New Issue
Block a user