diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-09 06:48:34 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-09 06:58:33 (GMT) |
commit | f7906352b21b0634745094f7bb7966d5f6941192 (patch) | |
tree | 007ddee96637af9a5cfe82c72500a505f285414c /src/script/api/qscriptengine.cpp | |
parent | eb3d5a73148cd7206c6b3b6672ed47b44611f745 (diff) | |
download | Qt-f7906352b21b0634745094f7bb7966d5f6941192.zip Qt-f7906352b21b0634745094f7bb7966d5f6941192.tar.gz Qt-f7906352b21b0634745094f7bb7966d5f6941192.tar.bz2 |
Fix the bactkrace in the QScript Debugger
This patch remove the 'fake' context that appears in the debugger
backtrace when there is a break point in the global context.
This problem never appeared in the tests because the
QScriptContext::backtrace has always at least two items in the backtrace
as it needs the native 'bt' function to be called.
Changed QScriptEnginePrivate::contextForFrame to skip the fake frame
(instead of QScriptContext::parentContext). So we never have a QScriptContext
pointing to that frame.
The changes in QScriptContextInfo are for retreiving the right filename
information for the global context when the global context is on top.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 6dc10d6..087e49c 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -985,6 +985,11 @@ void QScriptEnginePrivate::setDefaultPrototype(int metaTypeId, JSC::JSValue prot QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame) { + if (frame && frame->callerFrame()->hasHostCallFrameFlag() + && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) { + //skip the "fake" context created in Interpreter::execute. + frame = frame->callerFrame()->removeHostCallFrameFlag(); + } return reinterpret_cast<QScriptContext *>(frame); } |