aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/debugger
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2011-12-14 12:50:41 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-14 20:25:06 +0100
commite133073a7e8ae28b0b0d5c0c29ea7941767744d8 (patch)
treeb4b24efce2a2b81f92a4f03437b21739ac63f10e /src/declarative/debugger
parent4e2924fbc30905a136cc54f229f1906b11602c3e (diff)
QV8DebugService: Add breakaftercompile
Add breakaftercompile command that will set the v8::DebugBreak() whenever a new script is compiled. Change-Id: Id9027066826b6de621058d3170fa628463ef0152 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'src/declarative/debugger')
-rw-r--r--src/declarative/debugger/qv8debugservice.cpp25
-rw-r--r--src/declarative/debugger/qv8debugservice_p.h3
2 files changed, 21 insertions, 7 deletions
diff --git a/src/declarative/debugger/qv8debugservice.cpp b/src/declarative/debugger/qv8debugservice.cpp
index 39c991ff77..2fd54dc61d 100644
--- a/src/declarative/debugger/qv8debugservice.cpp
+++ b/src/declarative/debugger/qv8debugservice.cpp
@@ -41,7 +41,6 @@
#include "qv8debugservice_p.h"
#include "qdeclarativedebugservice_p_p.h"
-#include <private/qv8debug_p.h>
#include <private/qjsconverter_impl_p.h>
#include <private/qv8engine_p.h>
@@ -55,6 +54,7 @@ const char *V8_DEBUGGER_KEY_DISCONNECT = "disconnect";
const char *V8_DEBUGGER_KEY_REQUEST = "v8request";
const char *V8_DEBUGGER_KEY_V8MESSAGE = "v8message";
const char *V8_DEBUGGER_KEY_BREAK_ON_SIGNAL = "breakonsignal";
+const char *V8_DEBUGGER_KEY_BREAK_AFTER_COMPILE = "breakaftercompile";
QT_BEGIN_NAMESPACE
@@ -82,7 +82,7 @@ void DebugMessageHandler(const v8::Debug::Message& message)
if (event != v8::Break && event != v8::Exception &&
event != v8::AfterCompile && event != v8::BeforeCompile)
return;
- v8ServiceInstancePtr->debugMessageHandler(QJSConverter::toString(message.GetJSON()));
+ v8ServiceInstancePtr->debugMessageHandler(QJSConverter::toString(message.GetJSON()), event);
}
class QV8DebugServicePrivate : public QDeclarativeDebugServicePrivate
@@ -90,6 +90,7 @@ class QV8DebugServicePrivate : public QDeclarativeDebugServicePrivate
public:
QV8DebugServicePrivate()
: connectReceived(false)
+ , breakAfterCompile(false)
, engine(0)
{
}
@@ -99,7 +100,7 @@ public:
static QByteArray packMessage(const QString &type, const QString &message = QString());
bool connectReceived;
-
+ bool breakAfterCompile;
QMutex initializeMutex;
QStringList breakOnSignals;
const QV8Engine *engine;
@@ -149,13 +150,18 @@ void QV8DebugService::setEngine(const QV8Engine *engine)
//V8 DEBUG SERVICE PROTOCOL
// <HEADER><TYPE><DATA>
// <HEADER> : "V8DEBUG"
-// <TYPE> : ("connect", "disconnect", "interrupt", "v8request", "v8message", "breakonsignal")
+// <TYPE> : ("connect", "disconnect", "interrupt", "v8request", "v8message",
+// "breakonsignal", "breakaftercompile")
// <DATA> : For _v8request_ and _v8message_ it is the JSON request string.
// For _breakonsignal_ it is <signalname_string><enabled_bool>
+// For _breakaftercompile_ it is <enabled_bool>
// Empty string for the other types
-void QV8DebugService::debugMessageHandler(const QString &message)
+void QV8DebugService::debugMessageHandler(const QString &message, const v8::DebugEvent &event)
{
+ Q_D(QV8DebugService);
sendMessage(QV8DebugServicePrivate::packMessage(QLatin1String(V8_DEBUGGER_KEY_V8MESSAGE), message));
+ if (event == v8::AfterCompile && d->breakAfterCompile)
+ scheduledDebugBreak(true);
}
@@ -211,9 +217,11 @@ void QV8DebugService::statusChanged(QDeclarativeDebugService::Status newStatus)
//V8 DEBUG SERVICE PROTOCOL
// <HEADER><TYPE><DATA>
// <HEADER> : "V8DEBUG"
-// <TYPE> : ("connect", "disconnect", "interrupt", "v8request", "v8message", "breakonsignal")
+// <TYPE> : ("connect", "disconnect", "interrupt", "v8request", "v8message",
+// "breakonsignal", "breakaftercompile")
// <DATA> : For _v8request_ and _v8message_ it is the JSON request string.
// For _breakonsignal_ it is <signalname_string><enabled_bool>
+// For _breakaftercompile_ it is <enabled_bool>
// Empty string for the other types
// executed in the debugger thread
void QV8DebugService::messageReceived(const QByteArray &message)
@@ -259,6 +267,11 @@ void QV8DebugService::messageReceived(const QByteArray &message)
else
d->breakOnSignals.removeOne(signalName);
sendMessage(QV8DebugServicePrivate::packMessage(QLatin1String(V8_DEBUGGER_KEY_BREAK_ON_SIGNAL)));
+
+ } else if (type == V8_DEBUGGER_KEY_BREAK_AFTER_COMPILE) {
+ QDataStream rs(data);
+ rs >> d->breakAfterCompile;
+ sendMessage(QV8DebugServicePrivate::packMessage(QLatin1String(V8_DEBUGGER_KEY_BREAK_AFTER_COMPILE)));
}
}
}
diff --git a/src/declarative/debugger/qv8debugservice_p.h b/src/declarative/debugger/qv8debugservice_p.h
index 9430f95965..923a446a07 100644
--- a/src/declarative/debugger/qv8debugservice_p.h
+++ b/src/declarative/debugger/qv8debugservice_p.h
@@ -54,6 +54,7 @@
//
#include "qdeclarativedebugservice_p.h"
+#include <private/qv8debug_p.h>
QT_BEGIN_HEADER
@@ -74,7 +75,7 @@ public:
static QV8DebugService *instance();
static void initialize(const QV8Engine *engine);
- void debugMessageHandler(const QString &message);
+ void debugMessageHandler(const QString &message, const v8::DebugEvent &event);
void signalEmitted(const QString &signal);