summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-20 13:55:13 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-20 13:55:13 (GMT)
commit6fec99fd1fc256437c5c651209084f479005a7a7 (patch)
tree91b2369cf4d8e0a5160b1b0ed87458627c8ab25a
parent909512e0f0ab2a11d0c4ecdaef957ad7a5c58292 (diff)
downloadQt-6fec99fd1fc256437c5c651209084f479005a7a7.zip
Qt-6fec99fd1fc256437c5c651209084f479005a7a7.tar.gz
Qt-6fec99fd1fc256437c5c651209084f479005a7a7.tar.bz2
provide line number information for innermost call frame
For the innermost frame, we don't have a returnPC, so use the line number that was last passed to the engine agent.
-rw-r--r--src/script/api/qscriptcontextinfo.cpp3
-rw-r--r--src/script/api/qscriptengine.cpp1
-rw-r--r--src/script/api/qscriptengine_p.h1
-rw-r--r--src/script/api/qscriptengineagent.cpp6
4 files changed, 11 insertions, 0 deletions
diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp
index 04c26e2..0049680 100644
--- a/src/script/api/qscriptcontextinfo.cpp
+++ b/src/script/api/qscriptcontextinfo.cpp
@@ -175,6 +175,9 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte
returnPC - codeBlock->instructions().begin() -1);
}
}
+ } else {
+ // An agent might have provided the line number.
+ lineNumber = QScript::scriptEngineFromExec(frame)->agentLineNumber;
}
// Get the filename and the scriptId:
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 32c63ab..c7729d7 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -830,6 +830,7 @@ QScriptEnginePrivate::QScriptEnginePrivate()
originalGlobalObjectProxy = 0;
activeAgent = 0;
+ agentLineNumber = -1;
processEventsInterval = -1;
}
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index cf773b6..8a7dd1a 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -239,6 +239,7 @@ public:
QList<QScriptEngineAgent*> ownedAgents;
QScriptEngineAgent *activeAgent;
+ int agentLineNumber;
QHash<JSC::JSCell*, QBasicAtomicInt> keepAliveValues;
QHash<int, QScriptTypeInfo*> m_typeInfos;
int processEventsInterval;
diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp
index ba8e5e9..6417ed8 100644
--- a/src/script/api/qscriptengineagent.cpp
+++ b/src/script/api/qscriptengineagent.cpp
@@ -163,9 +163,12 @@ void QScriptEngineAgentPrivate::exceptionCatch(const JSC::DebuggerCallFrame& fra
void QScriptEngineAgentPrivate::atStatement(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, int column)
{
JSC::CallFrame *oldFrame = engine->currentFrame;
+ int oldAgentLineNumber = engine->agentLineNumber;
engine->currentFrame = frame.callFrame();
+ engine->agentLineNumber = lineno;
q_ptr->positionChange(sourceID, lineno, column);
engine->currentFrame = oldFrame;
+ engine->agentLineNumber = oldAgentLineNumber;
}
void QScriptEngineAgentPrivate::functionExit(const JSC::JSValue& returnValue, intptr_t sourceID)
@@ -186,11 +189,14 @@ void QScriptEngineAgentPrivate::didReachBreakpoint(const JSC::DebuggerCallFrame&
{
if (q_ptr->supportsExtension(QScriptEngineAgent::DebuggerInvocationRequest)) {
JSC::CallFrame *oldFrame = engine->currentFrame;
+ int oldAgentLineNumber = engine->agentLineNumber;
engine->currentFrame = frame.callFrame();
+ engine->agentLineNumber = lineno;
QList<QVariant> args;
args << qint64(sourceID) << lineno << column;
q_ptr->extension(QScriptEngineAgent::DebuggerInvocationRequest, args);
engine->currentFrame = oldFrame;
+ engine->agentLineNumber = oldAgentLineNumber;
}
};