Commit 54f9654b authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger: Fix Symbian.

...which subclasses DebuggerRunner and does not call
DebuggerPlugin::startDebugger(), which connects the
engine, leading to strange malfunctions. Move functionality
to DebuggerRunner::start() to make it self-contained.
Add object names to engines for easier debugging.

Reviewed-by: hjk
parent f1dea465
......@@ -217,6 +217,7 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &startParameters) :
DebuggerEngine(startParameters),
m_d(new CdbEnginePrivate(this))
{
setObjectName(QLatin1String("CdbEngine"));
m_d->m_consoleStubProc.setMode(Utils::ConsoleProcess::Suspend);
connect(&m_d->m_consoleStubProc, SIGNAL(processMessage(QString,bool)),
this, SLOT(slotConsoleStubMessage(QString, bool)));
......
......@@ -657,7 +657,10 @@ QAbstractItemModel *DebuggerEngine::sourceFilesModel() const
QAbstractItemModel *DebuggerEngine::commandModel() const
{
return d->m_commandHandler.model();
QAbstractItemModel *model = d->m_commandHandler.model();
if (model->objectName().isEmpty()) // Make debugging easier.
model->setObjectName(objectName() + QLatin1String("CommandModel"));
return model;
}
void DebuggerEngine::fetchMemory(MemoryViewAgent *, QObject *,
......@@ -1097,7 +1100,6 @@ void DebuggerEngine::notifyEngineSetupOk()
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
setState(EngineSetupOk);
QTC_ASSERT(d->m_runControl, return);
d->m_runControl->startSuccessful();
showMessage(_("QUEUE: SETUP INFERIOR"));
QTimer::singleShot(0, d, SLOT(doSetupInferior()));
}
......
......@@ -1982,24 +1982,24 @@ void DebuggerPluginPrivate::displayDebugger(ProjectExplorer::RunControl *rc)
void DebuggerPluginPrivate::startDebugger(ProjectExplorer::RunControl *rc)
{
//qDebug() << "START DEBUGGER 1";
QTC_ASSERT(rc, return);
DebuggerRunControl *runControl = qobject_cast<DebuggerRunControl *>(rc);
QTC_ASSERT(runControl, return);
activateDebugMode();
connectEngine(runControl->engine());
ProjectExplorerPlugin::instance()->startRunControl(runControl, PE::DEBUGMODE);
//qDebug() << "START DEBUGGER 2";
ProjectExplorerPlugin::instance()->startRunControl(rc, PE::DEBUGMODE);
}
void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify)
{
const QAbstractItemModel *oldCommandModel = m_commandWindow->model();
if (oldCommandModel == engine->commandModel()) {
// qDebug("RECONNECTING ENGINE %s", qPrintable(engine->objectName()));
return;
}
if (notify)
notifyCurrentEngine(RequestActivationRole, false);
//if (engine == m_sessionEngine)
// qDebug() << "CONNECTING DUMMY ENGINE" << engine;
//else
// qDebug() << "CONNECTING ENGINE " << engine;
// qDebug("CONNECTING ENGINE %s (OLD ENGINE: %s)", qPrintable(engine->objectName()),
// (oldCommandModel ? qPrintable(oldCommandModel->objectName()) : ""));
m_breakWindow->setModel(engine->breakModel());
m_commandWindow->setModel(engine->commandModel());
m_localsWindow->setModel(engine->localsModel());
......
......@@ -189,7 +189,6 @@ DebuggerRunControl *DebuggerRunControlFactory::create(
delete runControl;
return 0;
}
connect(runControl, SIGNAL(started()), runControl, SLOT(handleStarted()));
connect(runControl, SIGNAL(finished()), runControl, SLOT(handleFinished()));
return runControl;
}
......@@ -460,7 +459,6 @@ void DebuggerRunControl::start()
QString errorMessage;
QString settingsCategory;
QString settingsPage;
QString settingsIdHint;
if (!checkDebugConfiguration(sp.toolChainType,
&errorMessage, &settingsCategory, &settingsPage)) {
......@@ -471,17 +469,16 @@ void DebuggerRunControl::start()
return;
}
plugin()->activateDebugMode();
plugin()->showMessage(tr("Starting debugger for tool chain '%1'...")
.arg(toolChainName(sp.toolChainType)), StatusBar);
plugin()->activateDebugMode();
const QString message = tr("Starting debugger '%1' for tool chain '%2'...").
arg(m_engine->objectName(), toolChainName(sp.toolChainType));
plugin()->showMessage(message, StatusBar);
plugin()->showMessage(DebuggerSettings::instance()->dump(), LogDebug);
engine()->startDebugger(this);
}
void DebuggerRunControl::startSuccessful()
{
m_running = true;
plugin()->runControlStarted(this);
emit started();
}
......@@ -492,11 +489,6 @@ void DebuggerRunControl::startFailed()
engine()->handleStartFailed();
}
void DebuggerRunControl::handleStarted()
{
plugin()->runControlStarted(this);
}
void DebuggerRunControl::handleFinished()
{
engine()->handleFinished();
......
......@@ -104,7 +104,6 @@ public:
void setEnabledEngines(DebuggerEngineType enabledEngines);
void startFailed();
void startSuccessful();
void debuggingFinished();
RunConfiguration *runConfiguration() const { return m_myRunConfiguration.data(); }
......@@ -119,7 +118,6 @@ public:
QString *settingsPage = 0);
private slots:
void handleStarted();
void handleFinished();
protected:
......
......@@ -178,6 +178,7 @@ static QByteArray parsePlainConsoleStream(const GdbResponse &response)
GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
: DebuggerEngine(startParameters)
{
setObjectName(QLatin1String("GdbEngine"));
qRegisterMetaType<WatchData>("WatchData");
m_commandTimer = new QTimer(this);
......
......@@ -87,7 +87,9 @@ namespace Internal {
PdbEngine::PdbEngine(const DebuggerStartParameters &startParameters)
: DebuggerEngine(startParameters)
{}
{
setObjectName(QLatin1String("PdbEngine"));
}
PdbEngine::~PdbEngine()
{}
......
......@@ -106,7 +106,7 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters)
, m_adapter(new QmlAdapter(this))
, m_addedAdapterToObjectPool(false)
{
setObjectName(QLatin1String("QmlEngine"));
}
QmlEngine::~QmlEngine()
......
......@@ -204,6 +204,7 @@ void ScriptAgent::scriptUnload(qint64 scriptId)
ScriptEngine::ScriptEngine(const DebuggerStartParameters &startParameters)
: DebuggerEngine(startParameters)
{
setObjectName(QLatin1String("ScriptEngine"));
}
ScriptEngine::~ScriptEngine()
......
......@@ -31,6 +31,10 @@
#include "breakhandler.h"
#include "watchhandler.h"
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
namespace Debugger {
namespace Internal {
......@@ -40,6 +44,12 @@ namespace Internal {
SessionEngine::SessionEngine()
: DebuggerEngine(DebuggerStartParameters())
{
setObjectName(QLatin1String("SessionEngine"));
}
void SessionEngine::executeDebuggerCommand(const QString &command)
{
QTC_ASSERT(false, qDebug() << command)
}
void SessionEngine::loadSessionData()
......
......@@ -45,13 +45,14 @@ class SessionEngine : public DebuggerEngine
public:
SessionEngine();
void setupEngine() {}
void setupInferior() {}
void runEngine() {}
void shutdownEngine() {}
void shutdownInferior() {}
virtual void setupEngine() {}
virtual void setupInferior() {}
virtual void runEngine() {}
virtual void shutdownEngine() {}
virtual void shutdownInferior() {}
virtual void executeDebuggerCommand(const QString &command);
bool isSessionEngine() const { return true; }
virtual bool isSessionEngine() const { return true; }
void loadSessionData();
void saveSessionData();
......
......@@ -107,6 +107,7 @@ QString TcfEngine::TcfCommand::toString() const
TcfEngine::TcfEngine(const DebuggerStartParameters &startParameters)
: DebuggerEngine(startParameters)
{
setObjectName(QLatin1String("TcfEngine"));
m_congestion = 0;
m_inAir = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment