From b7521acd2c77f9f7ace8d49cf1e11affe2ccbd21 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 18 Aug 2015 11:14:56 +0200 Subject: V4 debugger: Fix expression evaluation We need to collect the refs in the debugService's list in order for them to show up on addRefs() and we need to generate proper error responses if either the debugger is not stopped or the evaluation throws an exception. Task-number: QTBUG-47797 Task-number: QTBUG-47816 Change-Id: I98f17c1f3976859ee50b9bfac41091276ff60982 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4debugging.cpp | 10 +++++++++- src/qml/jsruntime/qv4debugging_p.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/qml') diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp index ceeef80b9f..6efc3793ce 100644 --- a/src/qml/jsruntime/qv4debugging.cpp +++ b/src/qml/jsruntime/qv4debugging.cpp @@ -59,6 +59,7 @@ Debugger::JavaScriptJob::JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr : engine(engine) , frameNr(frameNr) , script(script) + , resultIsException(false) {} void Debugger::JavaScriptJob::run() @@ -85,11 +86,18 @@ void Debugger::JavaScriptJob::run() QV4::ScopedValue result(scope); if (!scope.engine->hasException) result = script.run(); - if (scope.engine->hasException) + if (scope.engine->hasException) { result = scope.engine->catchException(); + resultIsException = true; + } handleResult(result); } +bool Debugger::JavaScriptJob::hasExeption() const +{ + return resultIsException; +} + class EvalJob: public Debugger::JavaScriptJob { bool result; diff --git a/src/qml/jsruntime/qv4debugging_p.h b/src/qml/jsruntime/qv4debugging_p.h index ac0c934d42..86faba45f7 100644 --- a/src/qml/jsruntime/qv4debugging_p.h +++ b/src/qml/jsruntime/qv4debugging_p.h @@ -95,10 +95,12 @@ public: QV4::ExecutionEngine *engine; int frameNr; const QString &script; + bool resultIsException; public: JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr, const QString &script); void run(); + bool hasExeption() const; protected: virtual void handleResult(QV4::ScopedValue &result) = 0; -- cgit v1.2.3