Debugger: Make DebuggerEngine internal

Expose less of debugger internals to the device plugins.

Change-Id: Ie78756b033fae3fe02bff92eadf26b7319990605
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hjk
2014-12-12 15:33:16 +01:00
parent 8f7bd19600
commit aff13fdf27
40 changed files with 216 additions and 225 deletions
+12 -18
View File
@@ -35,7 +35,6 @@
#include "androidmanager.h"
#include "androidqtsupport.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerkitinformation.h>
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerruncontrol.h>
@@ -128,7 +127,6 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
DebuggerRunControl *runControl)
: QObject(runControl),
m_engine(0),
m_runControl(runControl),
m_runner(new AndroidRunner(this, runConfig, runControl->runMode()))
{
@@ -142,21 +140,17 @@ AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
Q_ASSERT(aspect->useCppDebugger() || aspect->useQmlDebugger());
Q_UNUSED(aspect)
m_engine = runControl->engine();
if (m_engine) {
connect(m_engine, &DebuggerEngine::requestRemoteSetup,
connect(m_runControl, &DebuggerRunControl::requestRemoteSetup,
m_runner, &AndroidRunner::start);
// FIXME: Move signal to base class and generalize handling.
connect(m_engine, SIGNAL(aboutToNotifyInferiorSetupOk()),
m_runner, SLOT(handleRemoteDebuggerRunning()));
}
connect(m_runControl, &DebuggerRunControl::aboutToNotifyInferiorSetupOk,
m_runner, &AndroidRunner::handleRemoteDebuggerRunning);
connect(m_runner, &AndroidRunner::remoteServerRunning,
[this](const QByteArray &serverChannel, int pid) {
QTC_ASSERT(m_engine, return);
m_engine->notifyEngineRemoteServerRunning(serverChannel, pid);
QTC_ASSERT(m_runControl, return);
m_runControl->notifyEngineRemoteServerRunning(serverChannel, pid);
});
connect(m_runner, &AndroidRunner::remoteProcessStarted,
@@ -166,19 +160,19 @@ AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
[this](const QString &errorMsg) {
QTC_ASSERT(m_runControl, return);
m_runControl->appendMessage(errorMsg, Utils::DebugFormat);
QMetaObject::invokeMethod(m_engine, "notifyInferiorExited", Qt::QueuedConnection);
QMetaObject::invokeMethod(m_runControl, "notifyInferiorExited", Qt::QueuedConnection);
});
connect(m_runner, &AndroidRunner::remoteErrorOutput,
[this](const QByteArray &output) {
QTC_ASSERT(m_engine, return);
m_engine->showMessage(QString::fromUtf8(output), AppError);
QTC_ASSERT(m_runControl, return);
m_runControl->showMessage(QString::fromUtf8(output), AppError);
});
connect(m_runner, &AndroidRunner::remoteOutput,
[this](const QByteArray &output) {
QTC_ASSERT(m_engine, return);
m_engine->showMessage(QString::fromUtf8(output), AppOutput);
QTC_ASSERT(m_runControl, return);
m_runControl->showMessage(QString::fromUtf8(output), AppOutput);
});
}
@@ -186,12 +180,12 @@ void AndroidDebugSupport::handleRemoteProcessStarted(int gdbServerPort, int qmlP
{
disconnect(m_runner, &AndroidRunner::remoteProcessStarted,
this, &AndroidDebugSupport::handleRemoteProcessStarted);
QTC_ASSERT(m_engine, return);
QTC_ASSERT(m_runControl, return);
RemoteSetupResult result;
result.success = true;
result.gdbServerPort = gdbServerPort;
result.qmlServerPort = qmlPort;
m_engine->notifyEngineRemoteSetupFinished(result);
m_runControl->notifyEngineRemoteSetupFinished(result);
}
} // namespace Internal
+1 -5
View File
@@ -33,10 +33,7 @@
#include "androidrunconfiguration.h"
namespace Debugger {
class DebuggerEngine;
class DebuggerRunControl;
}
namespace Debugger { class DebuggerRunControl; }
namespace ProjectExplorer { class RunControl; }
@@ -60,7 +57,6 @@ public:
private:
void handleRemoteProcessStarted(int gdbServerPort, int qmlPort);
Debugger::DebuggerEngine *m_engine;
Debugger::DebuggerRunControl *m_runControl;
AndroidRunner * const m_runner;
};
+1 -3
View File
@@ -42,12 +42,10 @@
//////////////////////////////////////////////////////////////////
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class BreakpointMarker;
class DebuggerEngine;
class BreakHandler : public QAbstractItemModel
{
+1 -1
View File
@@ -52,7 +52,7 @@ struct MemoryViewCookie;
class ByteArrayInputStream;
class GdbMi;
class CdbEngine : public Debugger::DebuggerEngine
class CdbEngine : public DebuggerEngine
{
Q_OBJECT
+1 -3
View File
@@ -50,12 +50,10 @@ namespace CPlusPlus { class Snapshot; }
namespace Utils { class SavedAction; }
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class BreakHandler;
class DebuggerEngine;
class Symbol;
class Section;
class GlobalDebuggerOptions;
+16 -12
View File
@@ -99,18 +99,6 @@ const char PrefixDebugExecutable[] = "DebuggedExecutable";
namespace Debugger {
Internal::Location::Location(const StackFrame &frame, bool marker)
{
init();
m_fileName = frame.file;
m_lineNumber = frame.line;
m_needsMarker = marker;
m_functionName = frame.function;
m_hasDebugInfo = frame.isUsable();
m_address = frame.address;
m_from = frame.from;
}
QDebug operator<<(QDebug d, DebuggerState state)
{
//return d << DebuggerEngine::stateName(state) << '(' << int(state) << ')';
@@ -133,6 +121,20 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp)
return str;
}
namespace Internal {
Location::Location(const StackFrame &frame, bool marker)
{
init();
m_fileName = frame.file;
m_lineNumber = frame.line;
m_needsMarker = marker;
m_functionName = frame.function;
m_hasDebugInfo = frame.isUsable();
m_address = frame.address;
m_from = frame.from;
}
//////////////////////////////////////////////////////////////////////
//
@@ -781,6 +783,7 @@ void DebuggerEngine::notifyInferiorSetupOk()
#ifdef WITH_BENCHMARK
CALLGRIND_START_INSTRUMENTATION;
#endif
aboutToNotifyInferiorSetupOk();
showMessage(_("NOTE: INFERIOR SETUP OK"));
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << this << state());
setState(InferiorSetupOk);
@@ -1903,6 +1906,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
}
}
} // namespace Internal
} // namespace Debugger
#include "debuggerengine.moc"
+10 -10
View File
@@ -50,7 +50,6 @@ namespace Core { class IOptionsPage; }
namespace Debugger {
class DebuggerEnginePrivate;
class DebuggerRunControl;
class DebuggerStartParameters;
@@ -59,6 +58,7 @@ DEBUGGER_EXPORT QDebug operator<<(QDebug str, DebuggerState state);
namespace Internal {
class DebuggerEnginePrivate;
class DebuggerPluginPrivate;
class DisassemblerAgent;
class MemoryAgent;
@@ -129,11 +129,7 @@ public:
quint64 address;
};
} // namespace Internal
// FIXME: DEBUGGER_EXPORT?
class DEBUGGER_EXPORT DebuggerEngine : public QObject
class DebuggerEngine : public QObject
{
Q_OBJECT
@@ -282,6 +278,7 @@ signals:
* a server start script should be used, but none is given.
*/
void requestRemoteSetup();
void aboutToNotifyInferiorSetupOk();
protected:
// The base notify*() function implementation should be sufficient
@@ -315,7 +312,9 @@ protected:
virtual void notifyInferiorStopOk();
virtual void notifyInferiorSpontaneousStop();
virtual void notifyInferiorStopFailed();
Q_SLOT virtual void notifyInferiorExited();
public:
virtual void notifyInferiorExited();
protected:
virtual void notifyInferiorShutdownOk();
@@ -392,9 +391,9 @@ protected:
private:
// Wrapper engine needs access to state of its subengines.
friend class Internal::QmlCppEngine;
friend class Internal::DebuggerPluginPrivate;
friend class Internal::QmlAdapter;
friend class QmlCppEngine;
friend class DebuggerPluginPrivate;
friend class QmlAdapter;
virtual void setState(DebuggerState state, bool forced = false);
@@ -402,6 +401,7 @@ private:
DebuggerEnginePrivate *d;
};
} // namespace Internal
} // namespace Debugger
Q_DECLARE_METATYPE(Debugger::Internal::ContextData)
+2 -7
View File
@@ -36,16 +36,11 @@
#include <utils/fancymainwindow.h>
namespace Core {
class Context;
class IMode;
}
namespace Core { class IMode; }
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class DebuggerMainWindowPrivate;
// DebuggerMainWindow dock widget names
+44 -3
View File
@@ -108,6 +108,13 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration, Debug
{
setIcon(QLatin1String(ProjectExplorer::Constants::ICON_DEBUG_SMALL));
connect(this, &RunControl::finished, this, &DebuggerRunControl::handleFinished);
connect(engine, &DebuggerEngine::requestRemoteSetup,
this, &DebuggerRunControl::requestRemoteSetup);
connect(engine, &DebuggerEngine::stateChanged,
this, &DebuggerRunControl::stateChanged);
connect(engine, &DebuggerEngine::aboutToNotifyInferiorSetupOk,
this, &DebuggerRunControl::aboutToNotifyInferiorSetupOk);
}
DebuggerRunControl::~DebuggerRunControl()
@@ -186,6 +193,16 @@ void DebuggerRunControl::startFailed()
m_engine->handleStartFailed();
}
void DebuggerRunControl::notifyEngineRemoteServerRunning(const QByteArray &msg, int pid)
{
m_engine->notifyEngineRemoteServerRunning(msg, pid);
}
void DebuggerRunControl::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result)
{
m_engine->notifyEngineRemoteSetupFinished(result);
}
void DebuggerRunControl::handleFinished()
{
appendMessage(tr("Debugging has finished") + QLatin1Char('\n'), NormalMessageFormat);
@@ -222,15 +239,39 @@ void DebuggerRunControl::debuggingFinished()
emit finished();
}
void DebuggerRunControl::showMessage(const QString &msg, int channel)
{
m_engine->showMessage(msg, channel);
}
bool DebuggerRunControl::isRunning() const
{
return m_running;
}
DebuggerEngine *DebuggerRunControl::engine()
DebuggerStartParameters &DebuggerRunControl::startParameters()
{
QTC_CHECK(m_engine);
return m_engine;
return m_engine->startParameters();
}
void DebuggerRunControl::notifyInferiorIll()
{
m_engine->notifyInferiorIll();
}
void DebuggerRunControl::notifyInferiorExited()
{
m_engine->notifyInferiorExited();
}
void DebuggerRunControl::quitDebugger()
{
m_engine->quitDebugger();
}
void DebuggerRunControl::abortDebugger()
{
m_engine->abortDebugger();
}
////////////////////////////////////////////////////////////////////////
+21 -6
View File
@@ -40,7 +40,10 @@ namespace ProjectExplorer { class Kit; }
namespace Debugger {
class DebuggerEngine;
class RemoteSetupResult;
namespace Internal { class DebuggerEngine; }
class DebuggerStartParameters;
class DEBUGGER_EXPORT DebuggerRunControl
@@ -59,20 +62,32 @@ public:
QString displayName() const;
void startFailed();
void notifyEngineRemoteServerRunning(const QByteArray &msg, int pid);
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result);
void notifyInferiorIll();
Q_SLOT void notifyInferiorExited();
void quitDebugger();
void abortDebugger();
void debuggingFinished();
DebuggerEngine *engine();
void showMessage(const QString &msg, int channel = LogDebug);
DebuggerStartParameters &startParameters();
signals:
void engineRequestSetup();
void requestRemoteSetup();
void aboutToNotifyInferiorSetupOk();
void stateChanged(Debugger::DebuggerState state);
private slots:
void handleFinished();
private:
friend class DebuggerRunControlFactory;
DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfiguration, DebuggerEngine *engine);
DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfiguration,
Internal::DebuggerEngine *engine);
DebuggerEngine *m_engine;
Internal::DebuggerEngine *m_engine;
bool m_running;
};
@@ -91,7 +106,7 @@ public:
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const;
static DebuggerEngine *createEngine(DebuggerEngineType et,
static Internal::DebuggerEngine *createEngine(DebuggerEngineType et,
const DebuggerStartParameters &sp,
QString *errorMessage);
@@ -42,11 +42,9 @@ class QAbstractItemModel;
QT_END_NAMESPACE
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class DebuggerEngine;
class StackFrame;
class DebuggerToolTipContext
+2 -3
View File
@@ -34,13 +34,12 @@
#include <QObject>
namespace Debugger {
namespace Internal {
class DebuggerEngine;
namespace Internal {
class DisassemblerAgentPrivate;
class DisassemblerLines;
class Location;
class DisassemblerAgentPrivate;
class DisassemblerAgent : public QObject
{
+1 -1
View File
@@ -60,7 +60,7 @@ class WatchData;
class DisassemblerAgentCookie;
class DisassemblerLines;
class GdbEngine : public Debugger::DebuggerEngine
class GdbEngine : public DebuggerEngine
{
Q_OBJECT
@@ -333,12 +333,6 @@ void GdbRemoteServerEngine::handleTargetExtendedAttach(const GdbResponse &respon
}
}
void GdbRemoteServerEngine::notifyInferiorSetupOk()
{
emit aboutToNotifyInferiorSetupOk();
GdbEngine::notifyInferiorSetupOk();
}
void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
{
QTC_ASSERT(m_isQnxGdb, qDebug() << m_isQnxGdb);
@@ -66,7 +66,6 @@ signals:
* a server start script should be used, but none is given.
*/
void requestSetup();
void aboutToNotifyInferiorSetupOk();
private:
Q_SLOT void readUploadStandardOutput();
@@ -77,7 +76,6 @@ private:
void notifyEngineRemoteServerRunning(const QByteArray &serverChannel, int inferiorPid);
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result);
void notifyInferiorSetupOk();
void handleSetTargetAsync(const GdbResponse &response);
void handleFileExecAndSymbols(const GdbResponse &response);
+2 -2
View File
@@ -44,11 +44,11 @@ namespace Core { class IEditor; }
namespace ProjectExplorer { class Abi; }
namespace Debugger {
namespace Internal {
class DebuggerEngine;
namespace Internal {
class MemoryView;
class MemoryMarkup
{
public:
+1 -3
View File
@@ -39,11 +39,9 @@ class QSortFilterProxyModel;
QT_END_NAMESPACE
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class DebuggerEngine;
class ModulesModel;
//////////////////////////////////////////////////////////////////
+2 -3
View File
@@ -43,11 +43,10 @@ class QDebugMessageClient;
}
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class BaseQmlDebuggerClient;
class DebuggerEngine;
class QmlAdapterPrivate;
class QmlAdapter : public QObject
@@ -408,7 +408,6 @@ void QmlCppEngine::notifyInferiorShutdownOk()
void QmlCppEngine::notifyInferiorSetupOk()
{
EDEBUG("\nMASTER INFERIOR SETUP OK");
emit aboutToNotifyInferiorSetupOk();
DebuggerEngine::notifyInferiorSetupOk();
}
-3
View File
@@ -130,9 +130,6 @@ protected:
void notifyInferiorSetupOk();
void notifyEngineRemoteServerRunning(const QByteArray &, int pid);
signals:
void aboutToNotifyInferiorSetupOk();
private:
void engineStateChanged(DebuggerState newState);
void setState(DebuggerState newState, bool forced = false);
-6
View File
@@ -351,12 +351,6 @@ QmlEngine::~QmlEngine()
Core::EditorManager::closeDocuments(documentsToClose.toList());
}
void QmlEngine::notifyInferiorSetupOk()
{
emit aboutToNotifyInferiorSetupOk();
DebuggerEngine::notifyInferiorSetupOk();
}
void QmlEngine::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
-2
View File
@@ -60,7 +60,6 @@ public:
DebuggerEngine *masterEngine = 0);
~QmlEngine();
void notifyInferiorSetupOk();
void notifyEngineRemoteServerRunning(const QByteArray &, int pid);
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result);
@@ -90,7 +89,6 @@ public:
signals:
void tooltipRequested(const QPoint &mousePos,
TextEditor::TextEditorWidget *editorWidget, int cursorPos);
void aboutToNotifyInferiorSetupOk();
private slots:
void disconnected();
@@ -47,11 +47,9 @@ class FileReference;
}
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class DebuggerEngine;
class WatchTreeView;
class QmlAdapter;
class QmlInspectorAgent;
+1 -3
View File
@@ -37,11 +37,9 @@
#include <qmldebug/baseenginedebugclient.h>
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class DebuggerEngine;
class WatchData;
//map <filename, editorRevision> -> <lineNumber, columnNumber> -> debugId
+1 -3
View File
@@ -35,18 +35,16 @@
#include <QPointer>
namespace Debugger {
namespace Internal {
class DebuggerEngine;
namespace Internal {
////////////////////////////////////////////////////////////////////////
//
// SnapshotModel
//
////////////////////////////////////////////////////////////////////////
class SnapshotHandler : public QAbstractTableModel
{
Q_OBJECT
+3 -4
View File
@@ -34,16 +34,15 @@
#include <QString>
namespace Debugger {
class DebuggerEngine;
namespace Internal {
class DebuggerEngine;
class SourceAgentPrivate;
class SourceAgent
{
public:
explicit SourceAgent(Debugger::DebuggerEngine *engine);
explicit SourceAgent(DebuggerEngine *engine);
~SourceAgent();
void setSourceProducerName(const QString &name);
void resetLocation();
+1 -2
View File
@@ -108,11 +108,10 @@ public:
Q_DECLARE_METATYPE(Debugger::Internal::TypeFormatList)
namespace Debugger {
namespace Internal {
class DebuggerEngine;
namespace Internal {
class UpdateParameters
{
public:
-1
View File
@@ -34,7 +34,6 @@
#include "iosmanager.h"
#include "iosdevice.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerkitinformation.h>
#include <debugger/debuggerruncontrol.h>
+8 -17
View File
@@ -34,7 +34,6 @@
#include "iosmanager.h"
#include "iosdevice.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerkitinformation.h>
#include <debugger/debuggerruncontrol.h>
@@ -182,7 +181,7 @@ IosDebugSupport::IosDebugSupport(IosRunConfiguration *runConfig,
: QObject(runControl), m_runControl(runControl),
m_runner(new IosRunner(this, runConfig, cppDebug, qmlDebug))
{
connect(m_runControl->engine(), SIGNAL(requestRemoteSetup()),
connect(m_runControl, SIGNAL(requestRemoteSetup()),
m_runner, SLOT(start()));
connect(m_runControl, SIGNAL(finished()),
m_runner, SLOT(stop()));
@@ -212,7 +211,7 @@ void IosDebugSupport::handleServerPorts(int gdbServerPort, int qmlPort)
result.success = gdbServerPort > 0 || (m_runner && !m_runner->cppDebug() && qmlPort > 0);
if (!result.success)
result.reason = tr("Could not get debug server file descriptor.");
m_runControl->engine()->notifyEngineRemoteSetupFinished(result);
m_runControl->notifyEngineRemoteSetupFinished(result);
}
void IosDebugSupport::handleGotInferiorPid(Q_PID pid, int qmlPort)
@@ -223,7 +222,7 @@ void IosDebugSupport::handleGotInferiorPid(Q_PID pid, int qmlPort)
result.success = pid > 0;
if (!result.success)
result.reason = tr("Got an invalid process id.");
m_runControl->engine()->notifyEngineRemoteSetupFinished(result);
m_runControl->notifyEngineRemoteSetupFinished(result);
}
void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
@@ -233,28 +232,20 @@ void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
m_runControl->appendMessage(tr("Run ended with error."), Utils::DebugFormat);
else
m_runControl->appendMessage(tr("Run ended."), Utils::DebugFormat);
m_runControl->engine()->abortDebugger();
m_runControl->abortDebugger();
}
}
void IosDebugSupport::handleRemoteOutput(const QString &output)
{
if (m_runControl) {
if (m_runControl->engine())
m_runControl->engine()->showMessage(output, AppOutput);
else
m_runControl->appendMessage(output, Utils::StdOutFormatSameLine);
}
if (m_runControl)
m_runControl->showMessage(output, AppOutput);
}
void IosDebugSupport::handleRemoteErrorOutput(const QString &output)
{
if (m_runControl) {
if (m_runControl->engine())
m_runControl->engine()->showMessage(output, AppError);
else
m_runControl->appendMessage(output, Utils::StdErrFormatSameLine);
}
if (m_runControl)
m_runControl->showMessage(output, AppError);
}
} // namespace Internal
+11 -11
View File
@@ -34,7 +34,6 @@
#include "blackberryapplicationrunner.h"
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
using namespace Qnx;
@@ -42,18 +41,19 @@ using namespace Qnx::Internal;
BlackBerryDebugSupport::BlackBerryDebugSupport(BlackBerryRunConfiguration *runConfig,
Debugger::DebuggerRunControl *runControl)
: QObject(runControl->engine())
, m_engine(runControl->engine())
: QObject(runControl)
, m_runControl(runControl)
{
BlackBerryApplicationRunner::LaunchFlags launchFlags;
if (m_engine->startParameters().languages & Debugger::CppLanguage)
if (m_runControl->startParameters().languages & Debugger::CppLanguage)
launchFlags |= BlackBerryApplicationRunner::CppDebugLaunch;
if (m_engine->startParameters().languages & Debugger::QmlLanguage)
if (m_runControl->startParameters().languages & Debugger::QmlLanguage)
launchFlags |= BlackBerryApplicationRunner::QmlDebugLaunch;
m_runner = new BlackBerryApplicationRunner(launchFlags, runConfig, this);
connect(m_engine, SIGNAL(requestRemoteSetup()), this, SLOT(launchRemoteApplication()));
connect(m_engine, SIGNAL(stateChanged(Debugger::DebuggerState)),
connect(m_runControl, &Debugger::DebuggerRunControl::requestRemoteSetup,
this, &BlackBerryDebugSupport::launchRemoteApplication);
connect(m_runControl, SIGNAL(stateChanged(Debugger::DebuggerState)),
this, SLOT(handleDebuggerStateChanged(Debugger::DebuggerState)));
connect(m_runner, SIGNAL(started()), this, SLOT(handleStarted()));
@@ -72,13 +72,13 @@ void BlackBerryDebugSupport::launchRemoteApplication()
void BlackBerryDebugSupport::handleStarted()
{
m_engine->startParameters().attachPID = m_runner->pid(); // FIXME: Is that needed?
m_runControl->startParameters().attachPID = m_runner->pid(); // FIXME: Is that needed?
Debugger::RemoteSetupResult result;
result.success = true;
result.inferiorPid = m_runner->pid();
result.gdbServerPort = 8000;
result.qmlServerPort = Debugger::InvalidPort;
m_engine->notifyEngineRemoteSetupFinished(result);
m_runControl->notifyEngineRemoteSetupFinished(result);
}
void BlackBerryDebugSupport::handleStartFailed(const QString &message)
@@ -86,7 +86,7 @@ void BlackBerryDebugSupport::handleStartFailed(const QString &message)
Debugger::RemoteSetupResult result;
result.success = false;
result.reason = message;
m_engine->notifyEngineRemoteSetupFinished(result);
m_runControl->notifyEngineRemoteSetupFinished(result);
}
void BlackBerryDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState state)
@@ -100,5 +100,5 @@ void BlackBerryDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState
void BlackBerryDebugSupport::handleApplicationOutput(const QString &msg, Utils::OutputFormat format)
{
Q_UNUSED(format)
m_engine->showMessage(msg, Debugger::AppOutput);
m_runControl->showMessage(msg, Debugger::AppOutput);
}
+2 -6
View File
@@ -40,10 +40,7 @@
#include <QObject>
#include <QProcess>
namespace Debugger {
class DebuggerEngine;
class DebuggerRunControl;
}
namespace Debugger { class DebuggerRunControl; }
namespace Qnx {
namespace Internal {
@@ -73,8 +70,7 @@ private slots:
void handleApplicationOutput(const QString &msg, Utils::OutputFormat format);
private:
Debugger::DebuggerEngine *m_engine;
Debugger::DebuggerRunControl *m_runControl;
BlackBerryApplicationRunner *m_runner;
};
+9 -10
View File
@@ -35,7 +35,6 @@
#include "qnxqtversion.h"
#include "qnxutils.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerkitinformation.h>
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerstartparameters.h>
@@ -58,7 +57,7 @@ using namespace Qnx::Internal;
QnxAttachDebugSupport::QnxAttachDebugSupport(QObject *parent)
: QObject(parent)
, m_kit(0)
, m_engine(0)
, m_runControl(0)
, m_pdebugPort(-1)
{
m_runner = new ProjectExplorer::DeviceApplicationRunner(this);
@@ -139,8 +138,8 @@ void QnxAttachDebugSupport::attachToProcess()
stopPDebug();
return;
}
m_engine = runControl->engine();
connect(m_engine, SIGNAL(stateChanged(Debugger::DebuggerState)), this, SLOT(handleDebuggerStateChanged(Debugger::DebuggerState)));
connect(runControl, &Debugger::DebuggerRunControl::stateChanged,
this, &QnxAttachDebugSupport::handleDebuggerStateChanged);
ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::DebugRunMode);
}
@@ -152,20 +151,20 @@ void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState s
void QnxAttachDebugSupport::handleError(const QString &message)
{
if (m_engine)
m_engine->showMessage(message, Debugger::AppError);
if (m_runControl)
m_runControl->showMessage(message, Debugger::AppError);
}
void QnxAttachDebugSupport::handleProgressReport(const QString &message)
{
if (m_engine)
m_engine->showMessage(message + QLatin1Char('\n'), Debugger::AppStuff);
if (m_runControl)
m_runControl->showMessage(message + QLatin1Char('\n'), Debugger::AppStuff);
}
void QnxAttachDebugSupport::handleRemoteOutput(const QByteArray &output)
{
if (m_engine)
m_engine->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
if (m_runControl)
m_runControl->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
}
void QnxAttachDebugSupport::stopPDebug()
+2 -4
View File
@@ -37,9 +37,7 @@
#include <QObject>
namespace Debugger {
class DebuggerEngine;
}
namespace Debugger { class DebuggerRunControl; }
namespace ProjectExplorer {
class DeviceApplicationRunner;
@@ -77,7 +75,7 @@ private:
ProjectExplorer::DeviceApplicationRunner *m_runner;
ProjectExplorer::DeviceUsedPortsGatherer *m_portsGatherer;
Debugger::DebuggerEngine *m_engine;
Debugger::DebuggerRunControl *m_runControl;
int m_pdebugPort;
QString m_projectSourceDirectory;
+27 -27
View File
@@ -36,7 +36,6 @@
#include "qnxrunconfiguration.h"
#include "slog2inforunner.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerstartparameters.h>
@@ -55,9 +54,9 @@ using namespace RemoteLinux;
using namespace Qnx;
using namespace Qnx::Internal;
QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerEngine *engine)
: QnxAbstractRunSupport(runConfig, engine)
, m_engine(engine)
QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerRunControl *runControl)
: QnxAbstractRunSupport(runConfig, runControl)
, m_runControl(runControl)
, m_pdebugPort(-1)
, m_qmlPort(-1)
, m_useCppDebugger(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger())
@@ -71,7 +70,8 @@ QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::Debug
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
connect(m_engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested()));
connect(m_runControl, &Debugger::DebuggerRunControl::requestRemoteSetup,
this, &QnxDebugSupport::handleAdapterSetupRequested);
const QString applicationId = QFileInfo(runConfig->remoteExecutableFilePath()).fileName();
ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(runConfig->target()->kit());
@@ -88,8 +88,8 @@ void QnxDebugSupport::handleAdapterSetupRequested()
{
QTC_ASSERT(state() == Inactive, return);
if (m_engine)
m_engine->showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Debugger::AppStuff);
if (m_runControl)
m_runControl->showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Debugger::AppStuff);
QnxAbstractRunSupport::handleAdapterSetupRequested();
}
@@ -106,13 +106,13 @@ void QnxDebugSupport::startExecution()
setState(StartingRemoteProcess);
if (m_useQmlDebugger)
m_engine->startParameters().processArgs += QString::fromLatin1(" -qmljsdebugger=port:%1,block").arg(m_qmlPort);
m_runControl->startParameters().processArgs += QString::fromLatin1(" -qmljsdebugger=port:%1,block").arg(m_qmlPort);
QStringList arguments;
if (m_useCppDebugger)
arguments << QString::number(m_pdebugPort);
else if (m_useQmlDebugger && !m_useCppDebugger)
arguments = Utils::QtcProcess::splitArgs(m_engine->startParameters().processArgs);
arguments = Utils::QtcProcess::splitArgs(m_runControl->startParameters().processArgs);
appRunner()->setEnvironment(environment());
appRunner()->setWorkingDirectory(workingDirectory());
appRunner()->start(device(), executable(), arguments);
@@ -121,29 +121,29 @@ void QnxDebugSupport::startExecution()
void QnxDebugSupport::handleRemoteProcessStarted()
{
QnxAbstractRunSupport::handleRemoteProcessStarted();
if (m_engine) {
if (m_runControl) {
Debugger::RemoteSetupResult result;
result.success = true;
result.gdbServerPort = m_pdebugPort;
result.qmlServerPort = m_qmlPort;
m_engine->notifyEngineRemoteSetupFinished(result);
m_runControl->notifyEngineRemoteSetupFinished(result);
}
}
void QnxDebugSupport::handleRemoteProcessFinished(bool success)
{
if (m_engine || state() == Inactive)
if (m_runControl || state() == Inactive)
return;
if (state() == Running) {
if (!success)
m_engine->notifyInferiorIll();
m_runControl->notifyInferiorIll();
} else {
Debugger::RemoteSetupResult result;
result.success = false;
result.reason = tr("The %1 process closed unexpectedly.").arg(executable());
m_engine->notifyEngineRemoteSetupFinished(result);
m_runControl->notifyEngineRemoteSetupFinished(result);
}
}
@@ -169,45 +169,45 @@ void QnxDebugSupport::killInferiorProcess()
void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
{
if (m_engine)
m_engine->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
if (m_runControl)
m_runControl->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
}
void QnxDebugSupport::handleRemoteOutput(const QByteArray &output)
{
QTC_ASSERT(state() == Inactive || state() == Running, return);
if (m_engine)
m_engine->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
if (m_runControl)
m_runControl->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
}
void QnxDebugSupport::handleError(const QString &error)
{
if (state() == Running) {
if (m_engine) {
m_engine->showMessage(error, Debugger::AppError);
m_engine->notifyInferiorIll();
if (m_runControl) {
m_runControl->showMessage(error, Debugger::AppError);
m_runControl->notifyInferiorIll();
}
} else if (state() != Inactive) {
setFinished();
if (m_engine) {
if (m_runControl) {
Debugger::RemoteSetupResult result;
result.success = false;
result.reason = tr("Initial setup failed: %1").arg(error);
m_engine->notifyEngineRemoteSetupFinished(result);
m_runControl->notifyEngineRemoteSetupFinished(result);
}
}
}
void QnxDebugSupport::printMissingWarning()
{
if (m_engine)
m_engine->showMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available."), Debugger::AppError);
if (m_runControl)
m_runControl->showMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available."), Debugger::AppError);
}
void QnxDebugSupport::handleApplicationOutput(const QString &msg, Utils::OutputFormat outputFormat)
{
Q_UNUSED(outputFormat);
if (m_engine)
m_engine->showMessage(msg, Debugger::AppOutput);
if (m_runControl)
m_runControl->showMessage(msg, Debugger::AppOutput);
}
+5 -4
View File
@@ -37,7 +37,7 @@
#include <utils/outputformat.h>
namespace Debugger { class DebuggerEngine; }
namespace Debugger { class DebuggerRunControl; }
namespace Qnx {
namespace Internal {
@@ -48,9 +48,10 @@ class Slog2InfoRunner;
class QnxDebugSupport : public QnxAbstractRunSupport
{
Q_OBJECT
public:
explicit QnxDebugSupport(QnxRunConfiguration *runConfig,
Debugger::DebuggerEngine *engine);
QnxDebugSupport(QnxRunConfiguration *runConfig,
Debugger::DebuggerRunControl *runControl);
public slots:
void handleDebuggingFinished();
@@ -76,7 +77,7 @@ private:
Slog2InfoRunner *m_slog2Info;
Debugger::DebuggerEngine *m_engine;
Debugger::DebuggerRunControl *m_runControl;
int m_pdebugPort;
int m_qmlPort;
+1 -2
View File
@@ -40,7 +40,6 @@
#include "qnxutils.h"
#include "qnxdeviceconfiguration.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerstartparameters.h>
@@ -184,7 +183,7 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mo
if (!runControl)
return 0;
QnxDebugSupport *debugSupport = new QnxDebugSupport(rc, runControl->engine());
QnxDebugSupport *debugSupport = new QnxDebugSupport(rc, runControl);
connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished()));
return runControl;
@@ -32,10 +32,11 @@
#include "remotelinuxrunconfiguration.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerstartparameters.h>
#include <debugger/debuggerkitinformation.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
@@ -58,15 +59,15 @@ class LinuxDeviceDebugSupportPrivate
{
public:
LinuxDeviceDebugSupportPrivate(const AbstractRemoteLinuxRunConfiguration *runConfig,
DebuggerEngine *engine)
: engine(engine),
DebuggerRunControl *runControl)
: runControl(runControl),
qmlDebugging(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger()),
cppDebugging(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger()),
gdbServerPort(-1), qmlPort(-1)
{
}
const QPointer<DebuggerEngine> engine;
const QPointer<DebuggerRunControl> runControl;
bool qmlDebugging;
bool cppDebugging;
QByteArray gdbserverOutput;
@@ -127,11 +128,12 @@ DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const AbstractR
}
LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
DebuggerEngine *engine)
: AbstractRemoteLinuxRunSupport(runConfig, engine),
d(new LinuxDeviceDebugSupportPrivate(static_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig), engine))
DebuggerRunControl *runControl)
: AbstractRemoteLinuxRunSupport(runConfig, runControl),
d(new LinuxDeviceDebugSupportPrivate(static_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig), runControl))
{
connect(d->engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleRemoteSetupRequested()));
connect(runControl, &DebuggerRunControl::requestRemoteSetup,
this, &LinuxDeviceDebugSupport::handleRemoteSetupRequested);
}
LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport()
@@ -141,8 +143,8 @@ LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport()
void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel)
{
if (state() != Inactive && d->engine)
d->engine->showMessage(msg, channel);
if (state() != Inactive && d->runControl)
d->runControl->showMessage(msg, channel);
}
void LinuxDeviceDebugSupport::handleRemoteSetupRequested()
@@ -200,8 +202,8 @@ void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
{
if (state() == Running) {
showMessage(error, AppError);
if (d->engine)
d->engine->notifyInferiorIll();
if (d->runControl)
d->runControl->notifyInferiorIll();
} else if (state() != Inactive) {
handleAdapterSetupFailed(error);
}
@@ -209,21 +211,21 @@ void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success)
{
if (!d->engine || state() == Inactive)
if (!d->runControl || state() == Inactive)
return;
if (state() == Running) {
// The QML engine does not realize on its own that the application has finished.
if (d->qmlDebugging && !d->cppDebugging)
d->engine->quitDebugger();
d->runControl->quitDebugger();
else if (!success)
d->engine->notifyInferiorIll();
d->runControl->notifyInferiorIll();
} else if (state() == StartingRunner) {
RemoteSetupResult result;
result.success = false;
result.reason = tr("Debugging failed.");
d->engine->notifyEngineRemoteSetupFinished(result);
d->runControl->notifyEngineRemoteSetupFinished(result);
}
reset();
}
@@ -245,7 +247,7 @@ void LinuxDeviceDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
{
QTC_ASSERT(state() != GatheringPorts, return);
if (!d->engine)
if (!d->runControl)
return;
showMessage(QString::fromUtf8(output), AppError);
@@ -270,7 +272,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupFailed(const QString &error)
RemoteSetupResult result;
result.success = false;
result.reason = tr("Initial setup failed: %1").arg(error);
d->engine->notifyEngineRemoteSetupFinished(result);
d->runControl->notifyEngineRemoteSetupFinished(result);
}
void LinuxDeviceDebugSupport::handleAdapterSetupDone()
@@ -281,7 +283,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupDone()
result.success = true;
result.gdbServerPort = d->gdbServerPort;
result.qmlServerPort = d->qmlPort;
d->engine->notifyEngineRemoteSetupFinished(result);
d->runControl->notifyEngineRemoteSetupFinished(result);
}
void LinuxDeviceDebugSupport::handleRemoteProcessStarted()
@@ -34,7 +34,7 @@
#include "abstractremotelinuxrunsupport.h"
namespace Debugger {
class DebuggerEngine;
class DebuggerRunControl;
class DebuggerStartParameters;
}
@@ -50,7 +50,7 @@ public:
static Debugger::DebuggerStartParameters startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig);
LinuxDeviceDebugSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
Debugger::DebuggerEngine *engine);
Debugger::DebuggerRunControl *runControl);
~LinuxDeviceDebugSupport();
protected:
@@ -111,7 +111,7 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
if (!runControl)
return 0;
LinuxDeviceDebugSupport * const debugSupport =
new LinuxDeviceDebugSupport(rc, runControl->engine());
new LinuxDeviceDebugSupport(rc, runControl);
connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished()));
return runControl;
}
-1
View File
@@ -32,7 +32,6 @@
#include "winrtrunconfiguration.h"
#include "winrtrunnerhelper.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerkitinformation.h>
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerstartparameters.h>