forked from qt-creator/qt-creator
V4 Debugger: Use changebreakpoint command if available
Newer versions of QML will support proper changing of break points, we won't need to work around it anymore. Task-number: QTCREATORBUG-20795 Change-Id: Idb5aaeb8ea59c7d2fd7c924e336ea259d3573d3d Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -170,6 +170,10 @@ public:
|
|||||||
bool enabled = true,int line = 0, int column = 0,
|
bool enabled = true,int line = 0, int column = 0,
|
||||||
const QString condition = QString(), int ignoreCount = -1);
|
const QString condition = QString(), int ignoreCount = -1);
|
||||||
void clearBreakpoint(int breakpoint);
|
void clearBreakpoint(int breakpoint);
|
||||||
|
|
||||||
|
bool canChangeBreakpoint() const;
|
||||||
|
void changeBreakpoint(int breakpoint, bool enabled);
|
||||||
|
|
||||||
void setExceptionBreak(Exceptions type, bool enabled = false);
|
void setExceptionBreak(Exceptions type, bool enabled = false);
|
||||||
|
|
||||||
void flushSendBuffer();
|
void flushSendBuffer();
|
||||||
@@ -225,6 +229,7 @@ public:
|
|||||||
bool automaticConnect = false;
|
bool automaticConnect = false;
|
||||||
bool unpausedEvaluate = false;
|
bool unpausedEvaluate = false;
|
||||||
bool contextEvaluate = false;
|
bool contextEvaluate = false;
|
||||||
|
bool supportChangeBreakpoint = false;
|
||||||
|
|
||||||
QTimer connectionTimer;
|
QTimer connectionTimer;
|
||||||
QmlDebug::QDebugMessageClient *msgClient = nullptr;
|
QmlDebug::QDebugMessageClient *msgClient = nullptr;
|
||||||
@@ -759,6 +764,8 @@ void QmlEngine::changeBreakpoint(Breakpoint bp)
|
|||||||
d->setBreakpoint(EVENT, params.functionName, params.enabled);
|
d->setBreakpoint(EVENT, params.functionName, params.enabled);
|
||||||
br.enabled = params.enabled;
|
br.enabled = params.enabled;
|
||||||
bp.setResponse(br);
|
bp.setResponse(br);
|
||||||
|
} else if (d->canChangeBreakpoint()) {
|
||||||
|
d->changeBreakpoint(d->breakpoints.value(bp.id()), params.enabled);
|
||||||
} else {
|
} else {
|
||||||
//V8 supports only minimalistic changes in breakpoint
|
//V8 supports only minimalistic changes in breakpoint
|
||||||
//Remove the breakpoint and add again
|
//Remove the breakpoint and add again
|
||||||
@@ -1502,6 +1509,19 @@ void QmlEnginePrivate::clearBreakpoint(int breakpoint)
|
|||||||
runCommand(cmd);
|
runCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QmlEnginePrivate::canChangeBreakpoint() const
|
||||||
|
{
|
||||||
|
return supportChangeBreakpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlEnginePrivate::changeBreakpoint(int breakpoint, bool enabled)
|
||||||
|
{
|
||||||
|
DebuggerCommand cmd(CHANGEBREAKPOINT);
|
||||||
|
cmd.arg(BREAKPOINT, breakpoint);
|
||||||
|
cmd.arg(ENABLED, enabled);
|
||||||
|
runCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void QmlEnginePrivate::setExceptionBreak(Exceptions type, bool enabled)
|
void QmlEnginePrivate::setExceptionBreak(Exceptions type, bool enabled)
|
||||||
{
|
{
|
||||||
// { "seq" : <number>,
|
// { "seq" : <number>,
|
||||||
@@ -2478,8 +2498,10 @@ void QmlEnginePrivate::stateChanged(State state)
|
|||||||
|
|
||||||
void QmlEnginePrivate::handleVersion(const QVariantMap &response)
|
void QmlEnginePrivate::handleVersion(const QVariantMap &response)
|
||||||
{
|
{
|
||||||
unpausedEvaluate = response.value(BODY).toMap().value("UnpausedEvaluate", false).toBool();
|
const QVariantMap body = response.value(BODY).toMap();
|
||||||
contextEvaluate = response.value(BODY).toMap().value("ContextEvaluate", false).toBool();
|
unpausedEvaluate = body.value("UnpausedEvaluate", false).toBool();
|
||||||
|
contextEvaluate = body.value("ContextEvaluate", false).toBool();
|
||||||
|
supportChangeBreakpoint = body.value("ChangeBreakpoint", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEnginePrivate::flushSendBuffer()
|
void QmlEnginePrivate::flushSendBuffer()
|
||||||
|
@@ -73,6 +73,7 @@ const char SCOPE[] = "scope";
|
|||||||
const char SCRIPTS[] = "scripts";
|
const char SCRIPTS[] = "scripts";
|
||||||
const char SETBREAKPOINT[] = "setbreakpoint";
|
const char SETBREAKPOINT[] = "setbreakpoint";
|
||||||
const char CLEARBREAKPOINT[] = "clearbreakpoint";
|
const char CLEARBREAKPOINT[] = "clearbreakpoint";
|
||||||
|
const char CHANGEBREAKPOINT[] = "changebreakpoint";
|
||||||
const char SETEXCEPTIONBREAK[] = "setexceptionbreak";
|
const char SETEXCEPTIONBREAK[] = "setexceptionbreak";
|
||||||
const char VERSION[] = "version";
|
const char VERSION[] = "version";
|
||||||
const char DISCONNECT[] = "disconnect";
|
const char DISCONNECT[] = "disconnect";
|
||||||
|
Reference in New Issue
Block a user