From 0a2140f5e81a71e53b3ae39eceadd97232aa6240 Mon Sep 17 00:00:00 2001 From: Aurindam Jana <aurindam.jana@nokia.com> Date: Thu, 23 Feb 2012 17:14:46 +0100 Subject: [PATCH] QmlCppDebugger: Handling Stack Use a common stackhandler in the mixed engine instead of individual stackhandlers in qml engine and cpp engine. Change-Id: If363fabb32ae7c6e652452ca2b2fbf8593e684a5 Reviewed-by: Kai Koehne <kai.koehne@nokia.com> --- src/plugins/debugger/debuggerengine.cpp | 7 ++- src/plugins/debugger/qml/qmlcppengine.cpp | 45 +------------------ .../debugger/qml/qmlv8debuggerclient.cpp | 3 +- 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 36ce8e53456..fb710dee046 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -418,10 +418,9 @@ RegisterHandler *DebuggerEngine::registerHandler() const StackHandler *DebuggerEngine::stackHandler() const { - //return d->m_masterEngine - // ? d->m_masterEngine->stackHandler() - // : &d->m_stackHandler; - return &d->m_stackHandler; + return d->m_masterEngine + ? d->m_masterEngine->stackHandler() + : &d->m_stackHandler; } ThreadsHandler *DebuggerEngine::threadsHandler() const diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp index 0ef38d1443c..08a3cd7e471 100644 --- a/src/plugins/debugger/qml/qmlcppengine.cpp +++ b/src/plugins/debugger/qml/qmlcppengine.cpp @@ -83,17 +83,12 @@ public: const DebuggerStartParameters &sp); ~QmlCppEnginePrivate() {} -private slots: - void cppStackChanged(); - void qmlStackChanged(); - private: friend class QmlCppEngine; QmlCppEngine *q; QmlEngine *m_qmlEngine; DebuggerEngine *m_cppEngine; DebuggerEngine *m_activeEngine; - int m_stackBoundary; }; @@ -105,32 +100,6 @@ QmlCppEnginePrivate::QmlCppEnginePrivate(QmlCppEngine *parent, setObjectName(QLatin1String("QmlCppEnginePrivate")); } -void QmlCppEnginePrivate::cppStackChanged() -{ - const QLatin1String firstFunction("QScript::FunctionWrapper::proxyCall"); - StackFrames frames; - foreach (const StackFrame &frame, m_cppEngine->stackHandler()->frames()) { - if (frame.function.endsWith(firstFunction)) - break; - frames.append(frame); - } - int level = frames.size(); - m_stackBoundary = level; - foreach (StackFrame frame, m_qmlEngine->stackHandler()->frames()) { - frame.level = level++; - frames.append(frame); - } - q->stackHandler()->setFrames(frames); -} - -void QmlCppEnginePrivate::qmlStackChanged() -{ - StackFrames frames = m_qmlEngine->stackHandler()->frames(); - q->stackHandler()->setFrames(frames); - m_stackBoundary = 0; -} - - //////////////////////////////////////////////////////////////////////// // // QmlCppEngine @@ -149,13 +118,6 @@ QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp, return; } d->m_activeEngine = d->m_cppEngine; - - connect(d->m_cppEngine->stackHandler(), SIGNAL(stackChanged()), - d, SLOT(cppStackChanged()), Qt::QueuedConnection); - connect(d->m_qmlEngine->stackHandler(), SIGNAL(stackChanged()), - d, SLOT(qmlStackChanged()), Qt::QueuedConnection); - connect(d->m_cppEngine, SIGNAL(stackFrameCompleted()), this, SIGNAL(stackFrameCompleted())); - connect(d->m_qmlEngine, SIGNAL(stackFrameCompleted()), this, SIGNAL(stackFrameCompleted())); } QmlCppEngine::~QmlCppEngine() @@ -198,10 +160,8 @@ void QmlCppEngine::activateFrame(int index) if (state() != InferiorStopOk && state() != InferiorUnrunnable) return; - if (index >= d->m_stackBoundary) - d->m_qmlEngine->activateFrame(index - d->m_stackBoundary); - else - d->m_cppEngine->activateFrame(index); + d->m_activeEngine->activateFrame(index); + stackHandler()->setCurrentIndex(index); } @@ -451,7 +411,6 @@ void QmlCppEngine::setupEngine() { EDEBUG("\nMASTER SETUP ENGINE"); d->m_activeEngine = d->m_cppEngine; - d->m_stackBoundary = 0; d->m_qmlEngine->setupSlaveEngine(); d->m_cppEngine->setupSlaveEngine(); diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp index 9ef0989308f..b7b3d1a1d56 100644 --- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp +++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp @@ -1114,6 +1114,7 @@ void QmlV8DebuggerClient::activateFrame(int index) { if (index != d->engine->stackHandler()->currentIndex()) d->frame(index); + d->engine->stackHandler()->setCurrentIndex(index); } bool QmlV8DebuggerClient::acceptsBreakpoint(const BreakpointModelId &id) @@ -1716,7 +1717,6 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const QVariantMap currentFrame = bodyVal.toMap(); StackHandler *stackHandler = d->engine->stackHandler(); - int frameIndex = currentFrame.value(QLatin1String("index")).toInt(); d->clearCache(); //Set "this" variable @@ -1746,7 +1746,6 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const d->currentFrameScopes.append(scopeIndex); d->scope(scopeIndex); } - stackHandler->setCurrentIndex(frameIndex); d->engine->gotoLocation(stackHandler->currentFrame()); } -- GitLab