Commit 28fd07e9 authored by Filipe Azevedo's avatar Filipe Azevedo

Add api to get some debugger state about engines

That’s needed for GammaRay integration.

Change-Id: I67a5dba81fa8d88024395126c45d0a3e9cfdd457
Reviewed-by: default avatarhjk <hjk@qt.io>
parent 6bcc657a
......@@ -149,6 +149,8 @@
#include <QTreeWidget>
#include <QVBoxLayout>
#include <QVariant>
#include <QJsonDocument>
#include <QJsonObject>
#include <QtPlugin>
#ifdef WITH_TESTS
......@@ -2152,6 +2154,29 @@ void DebuggerPlugin::attachExternalApplication(RunControl *rc)
createAndScheduleRun(rp, kit);
}
void DebuggerPlugin::getEnginesState(QByteArray *json) const
{
QTC_ASSERT(json, return);
QVariantMap result {
{ "version", 1 }
};
QVariantMap states;
for (int i = 0; i < dd->m_snapshotHandler->size(); ++i) {
const DebuggerEngine *engine = dd->m_snapshotHandler->at(i);
states[QString::number(i)] = QVariantMap({
{ "current", dd->m_snapshotHandler->currentIndex() == i },
{ "pid", engine->inferiorPid() },
{ "state", engine->state() }
});
}
if (!states.isEmpty())
result["states"] = states;
*json = QJsonDocument(QJsonObject::fromVariantMap(result)).toJson();
}
void DebuggerPluginPrivate::attachToQmlPort()
{
DebuggerRunParameters rp;
......
......@@ -56,6 +56,9 @@ private:
// Called from AppOutputPane::attachToRunControl().
Q_SLOT void attachExternalApplication(ProjectExplorer::RunControl *rc);
// Called from GammaRayIntegration
Q_SLOT void getEnginesState(QByteArray *json) const;
QList<QObject *> createTestObjects() const override;
};
......
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