diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-12-05 13:16:14 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2014-12-09 11:55:04 +0100 |
commit | 8397f640e81f0eff1f6f32ae4a35d40f115ea339 (patch) | |
tree | 2bb50bc6be262979cb9e7c49f02d96cbc5c50be5 /src/qml/jsruntime/qv4context_p.h | |
parent | 4524856ae21f85d572155c8a399d43116143e25c (diff) |
QML Debugging: Fix crash when stepping through try-catch block.
Also fix the stack-trace generation, otherwise the debugger engine would
report a breakpoint hit on the wrong line.
Task-number: QTBUG-42723
Change-Id: I1f655a5174b28a1c9c31c85bbe023fbce5ddbb96
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 6d95f039c5..c0ca4aec19 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -55,7 +55,6 @@ struct Function; } struct CallContext; -struct CallContext; struct CatchContext; struct WithContext; @@ -149,6 +148,9 @@ struct Q_QML_EXPORT ExecutionContext : public Managed inline CallContext *asCallContext(); inline const CallContext *asCallContext() const; + inline const CatchContext *asCatchContext() const; + + inline FunctionObject *getFunctionObject() const; static void markObjects(Managed *m, ExecutionEngine *e); }; @@ -225,6 +227,24 @@ inline const CallContext *ExecutionContext::asCallContext() const return d()->type >= Type_SimpleCallContext ? static_cast<const CallContext *>(this) : 0; } +inline const CatchContext *ExecutionContext::asCatchContext() const +{ + return d()->type == Type_CatchContext ? static_cast<const CatchContext *>(this) : 0; +} + +inline FunctionObject *ExecutionContext::getFunctionObject() const +{ + for (const ExecutionContext *it = this; it; it = it->d()->parent) { + if (const CallContext *callCtx = it->asCallContext()) + return callCtx->d()->function; + else if (it->asCatchContext()) + continue; // look in the parent context for a FunctionObject + else + break; + } + + return 0; +} inline void ExecutionEngine::pushContext(CallContext *context) { |