forked from qt-creator/qt-creator
Debugger: Base magic Qml connection discover on base run control signal
Less debugger specific code and less convoluted paths in debugger message handling. Change-Id: Ib298889c386d65f17acbdfc585188097bb20ed74 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -477,6 +477,8 @@ private:
|
|||||||
|
|
||||||
class DebuggerRunTool : public ProjectExplorer::ToolRunner
|
class DebuggerRunTool : public ProjectExplorer::ToolRunner
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerRunTool(ProjectExplorer::RunControl *runControl,
|
DebuggerRunTool(ProjectExplorer::RunControl *runControl,
|
||||||
const DebuggerRunParameters &rp,
|
const DebuggerRunParameters &rp,
|
||||||
|
|||||||
@@ -582,7 +582,8 @@ void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout)
|
|||||||
|
|
||||||
DebuggerEngine *engine(const DebuggerRunControl *runControl)
|
DebuggerEngine *engine(const DebuggerRunControl *runControl)
|
||||||
{
|
{
|
||||||
return static_cast<DebuggerRunTool *>(runControl->toolRunner())->engine();
|
QTC_ASSERT(runControl, return nullptr);
|
||||||
|
return qobject_cast<DebuggerRunTool *>(runControl->toolRunner())->engine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -743,15 +743,6 @@ void QmlCppEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &resu
|
|||||||
qmlEngine()->notifyEngineRemoteSetupFinished(result);
|
qmlEngine()->notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCppEngine::showMessage(const QString &msg, int channel, int timeout) const
|
|
||||||
{
|
|
||||||
if (channel == AppOutput || channel == AppError || channel == AppStuff) {
|
|
||||||
// message is from CppEngine, allow qml engine to process
|
|
||||||
m_qmlEngine->filterApplicationMessage(msg, channel);
|
|
||||||
}
|
|
||||||
DebuggerEngine::showMessage(msg, channel, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlCppEngine::resetLocation()
|
void QmlCppEngine::resetLocation()
|
||||||
{
|
{
|
||||||
if (m_qmlEngine)
|
if (m_qmlEngine)
|
||||||
|
|||||||
@@ -82,11 +82,7 @@ public:
|
|||||||
DebuggerEngine *qmlEngine() const;
|
DebuggerEngine *qmlEngine() const;
|
||||||
|
|
||||||
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) override;
|
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) override;
|
||||||
|
|
||||||
void showMessage(const QString &msg, int channel = LogDebug,
|
|
||||||
int timeout = -1) const override;
|
|
||||||
void resetLocation() override;
|
void resetLocation() override;
|
||||||
|
|
||||||
void notifyInferiorIll() override;
|
void notifyInferiorIll() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ struct LookupData
|
|||||||
|
|
||||||
typedef QHash<int, LookupData> LookupItems; // id -> (iname, exp)
|
typedef QHash<int, LookupData> LookupItems; // id -> (iname, exp)
|
||||||
|
|
||||||
class QmlEnginePrivate : QmlDebugClient
|
class QmlEnginePrivate : public QmlDebugClient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlEnginePrivate(QmlEngine *engine_, QmlDebugConnection *connection_)
|
QmlEnginePrivate(QmlEngine *engine_, QmlDebugConnection *connection_)
|
||||||
@@ -188,6 +188,17 @@ public:
|
|||||||
void checkForFinishedUpdate();
|
void checkForFinishedUpdate();
|
||||||
ConsoleItem *constructLogItemTree(const QmlV8ObjectData &objectData);
|
ConsoleItem *constructLogItemTree(const QmlV8ObjectData &objectData);
|
||||||
|
|
||||||
|
void filterApplicationMessage(ProjectExplorer::RunControl *runControl,
|
||||||
|
const QString &msg, Utils::OutputFormat format)
|
||||||
|
{
|
||||||
|
if (runControl != engine->runControl())
|
||||||
|
return;
|
||||||
|
if (format == StdErrFormatSameLine
|
||||||
|
|| format == StdOutFormatSameLine
|
||||||
|
|| format == DebugFormat)
|
||||||
|
outputParser.processOutput(msg);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QHash<int, QmlV8ObjectData> refVals; // The mapping of target object handles to retrieved values.
|
QHash<int, QmlV8ObjectData> refVals; // The mapping of target object handles to retrieved values.
|
||||||
int sequence = -1;
|
int sequence = -1;
|
||||||
@@ -225,6 +236,8 @@ public:
|
|||||||
QmlDebug::QDebugMessageClient *msgClient = 0;
|
QmlDebug::QDebugMessageClient *msgClient = 0;
|
||||||
|
|
||||||
QHash<int, QmlCallback> callbackForToken;
|
QHash<int, QmlCallback> callbackForToken;
|
||||||
|
QMetaObject::Connection startupMessageFilterConnection;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConsoleItem *constructLogItemTree(const QmlV8ObjectData &objectData, QList<int> &seenHandles);
|
ConsoleItem *constructLogItemTree(const QmlV8ObjectData &objectData, QList<int> &seenHandles);
|
||||||
void constructChildLogItems(ConsoleItem *item, const QmlV8ObjectData &objectData,
|
void constructChildLogItems(ConsoleItem *item, const QmlV8ObjectData &objectData,
|
||||||
@@ -322,6 +335,10 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
|
|||||||
|
|
||||||
connect(d->msgClient, &QDebugMessageClient::message,
|
connect(d->msgClient, &QDebugMessageClient::message,
|
||||||
this, &appendDebugOutput);
|
this, &appendDebugOutput);
|
||||||
|
|
||||||
|
d->startupMessageFilterConnection = connect(
|
||||||
|
runControl(), &RunControl::appendMessageRequested,
|
||||||
|
d, &QmlEnginePrivate::filterApplicationMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlEngine::~QmlEngine()
|
QmlEngine::~QmlEngine()
|
||||||
@@ -493,18 +510,6 @@ void QmlEngine::errorMessageBoxFinished(int result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::filterApplicationMessage(const QString &output, int /*channel*/) const
|
|
||||||
{
|
|
||||||
d->outputParser.processOutput(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
|
|
||||||
{
|
|
||||||
if (channel == AppOutput || channel == AppError)
|
|
||||||
filterApplicationMessage(msg, channel);
|
|
||||||
DebuggerEngine::showMessage(msg, channel, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlEngine::gotoLocation(const Location &location)
|
void QmlEngine::gotoLocation(const Location &location)
|
||||||
{
|
{
|
||||||
const QString fileName = location.fileName();
|
const QString fileName = location.fileName();
|
||||||
@@ -582,6 +587,7 @@ void QmlEngine::stopApplicationLauncher()
|
|||||||
|
|
||||||
void QmlEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result)
|
void QmlEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result)
|
||||||
{
|
{
|
||||||
|
QObject::disconnect(d->startupMessageFilterConnection);
|
||||||
DebuggerEngine::notifyEngineRemoteSetupFinished(result);
|
DebuggerEngine::notifyEngineRemoteSetupFinished(result);
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ public:
|
|||||||
DebuggerEngine *masterEngine = nullptr);
|
DebuggerEngine *masterEngine = nullptr);
|
||||||
~QmlEngine() override;
|
~QmlEngine() override;
|
||||||
|
|
||||||
void filterApplicationMessage(const QString &msg, int channel) const;
|
|
||||||
|
|
||||||
void logServiceStateChange(const QString &service, float version,
|
void logServiceStateChange(const QString &service, float version,
|
||||||
QmlDebug::QmlDebugClient::State newState);
|
QmlDebug::QmlDebugClient::State newState);
|
||||||
void logServiceActivity(const QString &service, const QString &logMessage);
|
void logServiceActivity(const QString &service, const QString &logMessage);
|
||||||
@@ -71,8 +69,6 @@ private:
|
|||||||
void notifyEngineRemoteServerRunning(const QString &, int pid) override;
|
void notifyEngineRemoteServerRunning(const QString &, int pid) override;
|
||||||
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) override;
|
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) override;
|
||||||
|
|
||||||
void showMessage(const QString &msg, int channel = LogDebug,
|
|
||||||
int timeout = -1) const override;
|
|
||||||
void gotoLocation(const Internal::Location &location) override;
|
void gotoLocation(const Internal::Location &location) override;
|
||||||
void insertBreakpoint(Breakpoint bp) override;
|
void insertBreakpoint(Breakpoint bp) override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user