diff options
author | Eike Ziller <eike.ziller@digia.com> | 2012-11-26 10:52:28 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2012-11-26 10:52:28 +0100 |
commit | 387f5a70065b6a21143f30a693b3946f43145aa1 (patch) | |
tree | 19499220eb78ffc2b83174768e4db33f36d33242 /src/plugins/debugger | |
parent | c9afad98efee2e9d7eb09407395c8ad00f175f17 (diff) | |
parent | 9820278a708024cc1ae01372dfafabe4ff295b88 (diff) | |
download | qt-creator-387f5a70065b6a21143f30a693b3946f43145aa1.tar.gz |
Merge remote-tracking branch 'origin/2.6'
Conflicts:
src/plugins/cpptools/cppcompletion_test.cpp
src/plugins/projectexplorer/kitmanagerconfigwidget.cpp
src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
src/plugins/qtsupport/baseqtversion.cpp
tests/auto/cplusplus/findusages/tst_findusages.cpp
Change-Id: Idd2abc09753a71a6c252bfa9914274459b2c7e63
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r-- | src/plugins/debugger/procinterrupt.cpp | 2 | ||||
-rw-r--r-- | src/plugins/debugger/qml/qmlinspectoradapter.cpp | 3 | ||||
-rw-r--r-- | src/plugins/debugger/qml/qmlinspectoragent.cpp | 67 | ||||
-rw-r--r-- | src/plugins/debugger/qml/qmlinspectoragent.h | 2 | ||||
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 5 | ||||
-rw-r--r-- | src/plugins/debugger/watchhandler.h | 1 |
6 files changed, 64 insertions, 16 deletions
diff --git a/src/plugins/debugger/procinterrupt.cpp b/src/plugins/debugger/procinterrupt.cpp index fa9a313ccd..c52f2f400f 100644 --- a/src/plugins/debugger/procinterrupt.cpp +++ b/src/plugins/debugger/procinterrupt.cpp @@ -136,7 +136,7 @@ bool Debugger::Internal::interruptProcess(int pID, int engineType, QString *erro *errorMessage = QLatin1String("DebugBreakProcess failed: ") + Utils::winErrorMessage(GetLastError()); } else { const QString executable = QCoreApplication::applicationDirPath() + QLatin1String("/win64interrupt.exe"); - switch (QProcess::execute(executable + QLatin1Char(' ') + QString::number(pID))) { + switch (QProcess::execute(executable, QStringList(QString::number(pID)))) { case -2: *errorMessage = QString::fromLatin1("Cannot start %1. Check src\\tools\\win64interrupt\\win64interrupt.c for more information."). arg(QDir::toNativeSeparators(executable)); diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp index c2e51c76a0..aac3a9da83 100644 --- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp +++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp @@ -251,7 +251,8 @@ void QmlInspectorAdapter::engineClientStatusChanged(QmlDebug::ClientStatus statu BaseEngineDebugClient *client = qobject_cast<BaseEngineDebugClient*>(sender()); - if (status == QmlDebug::Enabled) { + if (status == QmlDebug::Enabled && !m_engineClientConnected) { + // We accept the first client that is enabled and reject the others. QTC_ASSERT(client, return); setActiveEngineClient(client); } else if (m_engineClientConnected && client == m_engineClient) { diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index a1098b9fd6..1573a9cdb0 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -62,6 +62,7 @@ QmlInspectorAgent::QmlInspectorAgent(DebuggerEngine *engine, QObject *parent) , m_objectToSelect(-1) , m_newObjectsCreated(false) { + m_debugIdToIname.insert(-1, QByteArray("inspect")); connect(debuggerCore()->action(ShowQmlObjectTree), SIGNAL(valueChanged(QVariant)), SLOT(updateStatus())); m_delayQueryTimer.setSingleShot(true); @@ -452,17 +453,17 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value, } if (m_objectTreeQueryIds.contains(queryId)) { + m_objectTreeQueryIds.removeOne(queryId); if (value.type() == QVariant::List) { QVariantList objList = value.toList(); foreach (QVariant var, objList) { // TODO: check which among the list is the actual // object that needs to be selected. - insertObjectInTree(qvariant_cast<ObjectReference>(var)); + verifyAndInsertObjectInTree(qvariant_cast<ObjectReference>(var)); } } else { - insertObjectInTree(qvariant_cast<ObjectReference>(value)); + verifyAndInsertObjectInTree(qvariant_cast<ObjectReference>(value)); } - m_objectTreeQueryIds.removeOne(queryId); } else if (queryId == m_engineQueryId) { m_engineQueryId = 0; QList<EngineReference> engines = qvariant_cast<QList<EngineReference> >(value); @@ -608,13 +609,13 @@ void QmlInspectorAgent::updateObjectTree(const ContextReference &context) return; foreach (const ObjectReference & obj, context.objects()) - insertObjectInTree(obj); + verifyAndInsertObjectInTree(obj); foreach (const ContextReference &child, context.contexts()) updateObjectTree(child); } -void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object) +void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &object) { if (debug) qDebug() << __FUNCTION__ << '(' << object << ')'; @@ -622,17 +623,56 @@ void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object) if (!object.isValid()) return; - QElapsedTimer timeElapsed; - // sync tree with watchhandler - QList<WatchData> watchData; - int objectDebugId = object.debugId(); + // Find out the correct position in the tree + // Objects are inserted to the tree if they satisfy one of the two conditions. + // Condition 1: Object is a root object i.e. parentId == -1. + // Condition 2: Object has an expanded parent i.e. siblings are known. + // If the two conditions are not met then we push the object to a stack and recursively + // fetch parents till we find a previously expanded parent. + + WatchHandler *handler = m_debuggerEngine->watchHandler(); + const int parentId = object.parentId(); + const int objectDebugId = object.debugId(); + if (m_debugIdToIname.contains(parentId)) { + QByteArray parentIname = m_debugIdToIname.value(parentId); + if (parentId != -1 && !handler->isExpandedIName(parentIname)) { + m_objectStack.push(object); + handler->model()->fetchMore(handler->watchDataIndex(parentIname)); + return; // recursive + } + insertObjectInTree(object); - // When root items are inserted in the object tree, m_objectTreeQueryIds = 0 - if (!m_debugIdToIname.contains(objectDebugId) && m_objectTreeQueryIds.count()) - return; + } else { + m_objectStack.push(object); + fetchObject(parentId); + return; // recursive + } + if (!m_objectStack.isEmpty()) { + const ObjectReference &top = m_objectStack.top(); + // We want to expand only a particular branch and not the whole tree. Hence, we do not + // expand siblings. + if (object.children().contains(top)) { + QByteArray objectIname = m_debugIdToIname.value(objectDebugId); + if (!handler->isExpandedIName(objectIname)) { + handler->model()->fetchMore(handler->watchDataIndex(objectIname)); + } else { + verifyAndInsertObjectInTree(m_objectStack.pop()); + return; // recursive + } + } + } +} + +void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object) +{ + if (debug) + qDebug() << __FUNCTION__ << '(' << object << ')'; - int parentId = parentIdForIname(m_debugIdToIname.value(objectDebugId)); + const int objectDebugId = object.debugId(); + const int parentId = parentIdForIname(m_debugIdToIname.value(objectDebugId)); + QElapsedTimer timeElapsed; + QList<WatchData> watchData; if (debug) timeElapsed.start(); watchData.append(buildWatchData(object, m_debugIdToIname.value(parentId), true)); @@ -829,6 +869,7 @@ void QmlInspectorAgent::clearObjectTree() m_debugIdHash.clear(); m_debugIdHash.reserve(old_count + 1); m_debugIdToIname.clear(); + m_debugIdToIname.insert(-1, QByteArray("inspect")); m_objectStack.clear(); // reset only for qt > 4.8.3. if (m_engineClient->objectName() != QLatin1String(QDECLARATIVE_ENGINE)) diff --git a/src/plugins/debugger/qml/qmlinspectoragent.h b/src/plugins/debugger/qml/qmlinspectoragent.h index d83f79b5b3..7f60e5cd8f 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.h +++ b/src/plugins/debugger/qml/qmlinspectoragent.h @@ -110,7 +110,7 @@ private slots: private: void updateObjectTree(const QmlDebug::ContextReference &context); - + void verifyAndInsertObjectInTree(const QmlDebug::ObjectReference &object); void insertObjectInTree(const QmlDebug::ObjectReference &result); void buildDebugIdHashRecursive(const QmlDebug::ObjectReference &ref); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 791336ee25..dffb00d306 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1809,6 +1809,11 @@ const WatchData *WatchHandler::watchData(const QModelIndex &idx) const return m_model->watchItem(idx); } +const QModelIndex WatchHandler::watchDataIndex(const QByteArray &iname) const +{ + return m_model->watchIndex(m_model->findItem(iname)); +} + const WatchData *WatchHandler::findData(const QByteArray &iname) const { return m_model->findItem(iname); diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index b5d8622c9e..a7c1c6d3b6 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -85,6 +85,7 @@ public: void showEditValue(const WatchData &data); const WatchData *watchData(const QModelIndex &) const; + const QModelIndex watchDataIndex(const QByteArray &iname) const; const WatchData *findData(const QByteArray &iname) const; const WatchData *findCppLocalVariable(const QString &name) const; QString displayForAutoTest(const QByteArray &iname) const; |