Commit 459f0064 authored by Aurindam Jana's avatar Aurindam Jana Committed by hjk
Browse files

QmlDebugger: Refactor QML Signal Handler



Refactor QML Signal Handler to QML Signal Emit. This is because the
debugger breaks when a matching signal is emitted irrespective of
whether there is a handler connected to the signal.

Change-Id: I852ace75c1962290717ed127ac5938d7505b9a7e
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent b9661b03
......@@ -122,8 +122,8 @@ static QString typeToString(BreakpointType type)
return BreakHandler::tr("Watchpoint at Address");
case WatchpointAtExpression:
return BreakHandler::tr("Watchpoint at Expression");
case BreakpointOnQmlSignalHandler:
return BreakHandler::tr("Breakpoint on QML Signal Handler");
case BreakpointOnQmlSignalEmit:
return BreakHandler::tr("Breakpoint on QML Signal Emit");
case BreakpointAtJavaScriptThrow:
return BreakHandler::tr("Breakpoint at JavaScript throw");
case UnknownType:
......
......@@ -236,7 +236,7 @@ bool BreakpointParameters::isValid() const
case Debugger::Internal::BreakpointAtFork:
case Debugger::Internal::BreakpointAtExec:
case Debugger::Internal::BreakpointAtSysCall:
case Debugger::Internal::BreakpointOnQmlSignalHandler:
case Debugger::Internal::BreakpointOnQmlSignalEmit:
case Debugger::Internal::BreakpointAtJavaScriptThrow:
break;
case Debugger::Internal::WatchpointAtExpression:
......@@ -280,7 +280,7 @@ bool BreakpointParameters::isCppBreakpoint() const
{
// Qml specific breakpoint types.
if (type == BreakpointAtJavaScriptThrow
|| type == BreakpointOnQmlSignalHandler)
|| type == BreakpointOnQmlSignalEmit)
return false;
// Qml is currently only file.
......@@ -302,7 +302,7 @@ QString BreakpointParameters::toString() const
<< " PathUsage: " << pathUsage;
break;
case BreakpointByFunction:
case BreakpointOnQmlSignalHandler:
case BreakpointOnQmlSignalEmit:
ts << " FunctionName: " << functionName;
break;
case BreakpointByAddress:
......
......@@ -140,7 +140,7 @@ enum BreakpointType
BreakpointAtSysCall,
WatchpointAtAddress,
WatchpointAtExpression,
BreakpointOnQmlSignalHandler,
BreakpointOnQmlSignalEmit,
BreakpointAtJavaScriptThrow
};
......
......@@ -122,7 +122,7 @@ BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent)
<< tr("Break when a system call is executed")
<< tr("Break on data access at fixed address")
<< tr("Break on data access at address given by expression")
<< tr("Break on QML signal handler")
<< tr("Break on QML signal emit")
<< tr("Break when JavaScript exception is thrown");
QTC_ASSERT(types.size() == BreakpointAtJavaScriptThrow, return);
......@@ -374,7 +374,7 @@ void BreakpointDialog::typeChanged(int)
case WatchpointAtExpression:
getParts(ExpressionPart|AllConditionParts|TracePointPart, &m_savedParameters);
break;
case BreakpointOnQmlSignalHandler:
case BreakpointOnQmlSignalEmit:
getParts(FunctionPart, &m_savedParameters);
}
......@@ -421,7 +421,7 @@ void BreakpointDialog::typeChanged(int)
setPartsEnabled(ExpressionPart|AllConditionParts|TracePointPart|TracePointPart);
clearOtherParts(ExpressionPart|AllConditionParts|TracePointPart);
break;
case BreakpointOnQmlSignalHandler:
case BreakpointOnQmlSignalEmit:
setParts(FunctionPart, m_savedParameters);
setPartsEnabled(FunctionPart);
clearOtherParts(FunctionPart);
......
......@@ -2604,7 +2604,7 @@ bool CdbEngine::acceptsBreakpoint(BreakpointModelId id) const
case BreakpointAtFork:
case WatchpointAtExpression:
case BreakpointAtSysCall:
case BreakpointOnQmlSignalHandler:
case BreakpointOnQmlSignalEmit:
case BreakpointAtJavaScriptThrow:
return false;
case WatchpointAtAddress:
......
......@@ -106,7 +106,7 @@ static BreakpointParameters fixWinMSVCBreakpoint(const BreakpointParameters &p)
case WatchpointAtExpression:
case BreakpointAtSysCall:
case WatchpointAtAddress:
case BreakpointOnQmlSignalHandler:
case BreakpointOnQmlSignalEmit:
case BreakpointAtJavaScriptThrow:
break;
case BreakpointAtExec: { // Emulate by breaking on CreateProcessW().
......@@ -164,7 +164,7 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
case BreakpointAtCatch:
case BreakpointAtThrow:
case BreakpointAtMain:
case BreakpointOnQmlSignalHandler:
case BreakpointOnQmlSignalEmit:
case BreakpointAtJavaScriptThrow:
QTC_ASSERT(false, return QByteArray(); )
break;
......
......@@ -538,8 +538,8 @@ void QmlV8DebuggerClientPrivate::setBreakpoint(const QString type, const QString
QByteArray params;
QDataStream rs(&params, QIODevice::WriteOnly);
rs << target.toUtf8() << enabled;
logSendMessage(QString(_("%1 %2 %3 %4")).arg(_(V8DEBUG), _(SIGNALHANDLER), target, enabled?_("enabled"):_("disabled")));
q->sendMessage(packMessage(SIGNALHANDLER, params));
logSendMessage(QString(_("%1 %2 %3 %4")).arg(_(V8DEBUG), _(BREAKONSIGNAL), target, enabled?_("enabled"):_("disabled")));
q->sendMessage(packMessage(BREAKONSIGNAL, params));
} else {
QScriptValue jsonVal = initObject();
......@@ -966,7 +966,7 @@ void QmlV8DebuggerClientPrivate::reformatRequest(QByteArray &request)
}
q->sendMessage(packMessage(QByteArray(), data));
} else if (command == SIGNALHANDLER) {
} else if (command == BREAKONSIGNAL) {
QDataStream rs(data);
QByteArray signalHandler;
bool enabled;
......@@ -1091,7 +1091,7 @@ void QmlV8DebuggerClient::activateFrame(int index)
bool QmlV8DebuggerClient::acceptsBreakpoint(const BreakpointModelId &id)
{
BreakpointType type = d->engine->breakHandler()->breakpointData(id).type;
return (type == BreakpointOnQmlSignalHandler
return (type == BreakpointOnQmlSignalEmit
|| type == BreakpointByFileAndLine
|| type == BreakpointAtJavaScriptThrow);
}
......@@ -1112,7 +1112,7 @@ void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id,
params.enabled, adjustedLine, adjustedColumn,
QLatin1String(params.condition), params.ignoreCount);
} else if (params.type == BreakpointOnQmlSignalHandler) {
} else if (params.type == BreakpointOnQmlSignalEmit) {
d->setBreakpoint(QString(_(EVENT)), params.functionName, params.enabled);
d->engine->breakHandler()->notifyBreakpointInsertOk(id);
}
......@@ -1130,7 +1130,7 @@ void QmlV8DebuggerClient::removeBreakpoint(const BreakpointModelId &id)
if (params.type == BreakpointAtJavaScriptThrow)
d->setExceptionBreak(AllExceptions);
else if (params.type == BreakpointOnQmlSignalHandler)
else if (params.type == BreakpointOnQmlSignalEmit)
d->setBreakpoint(QString(_(EVENT)), params.functionName, false);
else
d->clearBreakpoint(breakpoint);
......@@ -1146,7 +1146,7 @@ void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &id)
d->setExceptionBreak(AllExceptions, params.enabled);
br.enabled = params.enabled;
handler->setResponse(id, br);
} else if (params.type == BreakpointOnQmlSignalHandler) {
} else if (params.type == BreakpointOnQmlSignalEmit) {
d->setBreakpoint(QString(_(EVENT)), params.functionName, params.enabled);
br.enabled = params.enabled;
handler->setResponse(id, br);
......@@ -1259,7 +1259,7 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
} else if (type == INTERRUPT) {
//debug break requested
} else if (type == SIGNALHANDLER) {
} else if (type == BREAKONSIGNAL) {
//break on signal handler requested
} else if (type == V8MESSAGE) {
......
......@@ -39,7 +39,7 @@ namespace Internal {
const float CURRENT_SUPPORTED_VERSION = 2.0;
const char V8REQUEST[] = "v8request";
const char V8MESSAGE[] = "v8message";
const char SIGNALHANDLER[] = "signalhandler";
const char BREAKONSIGNAL[] = "breakonsignal";
const char CONNECT[] = "connect";
const char INTERRUPT[] = "interrupt";
const char V8DEBUG[] = "V8DEBUG";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment