Commit 0a2140f5 authored by Aurindam Jana's avatar Aurindam Jana
Browse files

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: default avatarKai Koehne <kai.koehne@nokia.com>
parent 6668ee13
...@@ -418,10 +418,9 @@ RegisterHandler *DebuggerEngine::registerHandler() const ...@@ -418,10 +418,9 @@ RegisterHandler *DebuggerEngine::registerHandler() const
StackHandler *DebuggerEngine::stackHandler() const StackHandler *DebuggerEngine::stackHandler() const
{ {
//return d->m_masterEngine return d->m_masterEngine
// ? d->m_masterEngine->stackHandler() ? d->m_masterEngine->stackHandler()
// : &d->m_stackHandler; : &d->m_stackHandler;
return &d->m_stackHandler;
} }
ThreadsHandler *DebuggerEngine::threadsHandler() const ThreadsHandler *DebuggerEngine::threadsHandler() const
......
...@@ -83,17 +83,12 @@ public: ...@@ -83,17 +83,12 @@ public:
const DebuggerStartParameters &sp); const DebuggerStartParameters &sp);
~QmlCppEnginePrivate() {} ~QmlCppEnginePrivate() {}
private slots:
void cppStackChanged();
void qmlStackChanged();
private: private:
friend class QmlCppEngine; friend class QmlCppEngine;
QmlCppEngine *q; QmlCppEngine *q;
QmlEngine *m_qmlEngine; QmlEngine *m_qmlEngine;
DebuggerEngine *m_cppEngine; DebuggerEngine *m_cppEngine;
DebuggerEngine *m_activeEngine; DebuggerEngine *m_activeEngine;
int m_stackBoundary;
}; };
...@@ -105,32 +100,6 @@ QmlCppEnginePrivate::QmlCppEnginePrivate(QmlCppEngine *parent, ...@@ -105,32 +100,6 @@ QmlCppEnginePrivate::QmlCppEnginePrivate(QmlCppEngine *parent,
setObjectName(QLatin1String("QmlCppEnginePrivate")); 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 // QmlCppEngine
...@@ -149,13 +118,6 @@ QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp, ...@@ -149,13 +118,6 @@ QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp,
return; return;
} }
d->m_activeEngine = d->m_cppEngine; 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() QmlCppEngine::~QmlCppEngine()
...@@ -198,10 +160,8 @@ void QmlCppEngine::activateFrame(int index) ...@@ -198,10 +160,8 @@ void QmlCppEngine::activateFrame(int index)
if (state() != InferiorStopOk && state() != InferiorUnrunnable) if (state() != InferiorStopOk && state() != InferiorUnrunnable)
return; return;
if (index >= d->m_stackBoundary) d->m_activeEngine->activateFrame(index);
d->m_qmlEngine->activateFrame(index - d->m_stackBoundary);
else
d->m_cppEngine->activateFrame(index);
stackHandler()->setCurrentIndex(index); stackHandler()->setCurrentIndex(index);
} }
...@@ -451,7 +411,6 @@ void QmlCppEngine::setupEngine() ...@@ -451,7 +411,6 @@ void QmlCppEngine::setupEngine()
{ {
EDEBUG("\nMASTER SETUP ENGINE"); EDEBUG("\nMASTER SETUP ENGINE");
d->m_activeEngine = d->m_cppEngine; d->m_activeEngine = d->m_cppEngine;
d->m_stackBoundary = 0;
d->m_qmlEngine->setupSlaveEngine(); d->m_qmlEngine->setupSlaveEngine();
d->m_cppEngine->setupSlaveEngine(); d->m_cppEngine->setupSlaveEngine();
......
...@@ -1114,6 +1114,7 @@ void QmlV8DebuggerClient::activateFrame(int index) ...@@ -1114,6 +1114,7 @@ void QmlV8DebuggerClient::activateFrame(int index)
{ {
if (index != d->engine->stackHandler()->currentIndex()) if (index != d->engine->stackHandler()->currentIndex())
d->frame(index); d->frame(index);
d->engine->stackHandler()->setCurrentIndex(index);
} }
bool QmlV8DebuggerClient::acceptsBreakpoint(const BreakpointModelId &id) bool QmlV8DebuggerClient::acceptsBreakpoint(const BreakpointModelId &id)
...@@ -1716,7 +1717,6 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const ...@@ -1716,7 +1717,6 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const
QVariantMap currentFrame = bodyVal.toMap(); QVariantMap currentFrame = bodyVal.toMap();
StackHandler *stackHandler = d->engine->stackHandler(); StackHandler *stackHandler = d->engine->stackHandler();
int frameIndex = currentFrame.value(QLatin1String("index")).toInt();
d->clearCache(); d->clearCache();
//Set "this" variable //Set "this" variable
...@@ -1746,7 +1746,6 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const ...@@ -1746,7 +1746,6 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const
d->currentFrameScopes.append(scopeIndex); d->currentFrameScopes.append(scopeIndex);
d->scope(scopeIndex); d->scope(scopeIndex);
} }
stackHandler->setCurrentIndex(frameIndex);
d->engine->gotoLocation(stackHandler->currentFrame()); d->engine->gotoLocation(stackHandler->currentFrame());
} }
......
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