Debugger: Remove remains of QmlEngine live update feature

Change-Id: Iaa77f9d9af103046841637862b8aacdc6b0342c7
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
This commit is contained in:
hjk
2015-09-18 09:41:17 +02:00
parent 374f84acc7
commit e298500379
4 changed files with 2 additions and 74 deletions

View File

@@ -208,7 +208,6 @@ public:
QmlOutputParser outputParser; QmlOutputParser outputParser;
QTimer noDebugOutputTimer; QTimer noDebugOutputTimer;
QHash<QString,Breakpoint> pendingBreakpoints;
QList<quint32> queryIds; QList<quint32> queryIds;
bool retryOnConnectFail = false; bool retryOnConnectFail = false;
bool automaticConnect = false; bool automaticConnect = false;
@@ -274,10 +273,6 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
d->noDebugOutputTimer.setInterval(8000); d->noDebugOutputTimer.setInterval(8000);
connect(&d->noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(tryToConnect())); connect(&d->noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(tryToConnect()));
if (auto mmIface = ModelManagerInterface::instance()) {
connect(mmIface, &ModelManagerInterface::documentUpdated,
this, &QmlEngine::documentUpdated);
}
// we won't get any debug output // we won't get any debug output
if (startParameters.useTerminal) { if (startParameters.useTerminal) {
d->noDebugOutputTimer.setInterval(0); d->noDebugOutputTimer.setInterval(0);
@@ -718,14 +713,7 @@ void QmlEngine::executeRunToLine(const ContextData &data)
{ {
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
showStatusMessage(tr("Run to line %1 (%2) requested...").arg(data.lineNumber).arg(data.fileName), 5000); showStatusMessage(tr("Run to line %1 (%2) requested...").arg(data.lineNumber).arg(data.fileName), 5000);
ContextData modifiedData = data; d->setBreakpoint(QString(_(SCRIPTREGEXP)), data.fileName, true, data.lineNumber);
quint32 line = data.lineNumber;
quint32 column;
bool valid;
if (adjustBreakpointLineAndColumn(data.fileName, &line, &column, &valid))
modifiedData.lineNumber = line;
d->setBreakpoint(QString(_(SCRIPTREGEXP)), modifiedData.fileName,
true, modifiedData.lineNumber);
clearExceptionSelection(); clearExceptionSelection();
d->continueDebugging(Continue); d->continueDebugging(Continue);
@@ -768,26 +756,13 @@ void QmlEngine::insertBreakpoint(Breakpoint bp)
bp.notifyBreakpointInsertProceeding(); bp.notifyBreakpointInsertProceeding();
const BreakpointParameters &params = bp.parameters(); const BreakpointParameters &params = bp.parameters();
quint32 line = params.lineNumber;
quint32 column = 0;
if (params.type == BreakpointByFileAndLine) {
bool valid = false;
if (!adjustBreakpointLineAndColumn(params.fileName, &line, &column,
&valid)) {
d->pendingBreakpoints.insertMulti(params.fileName, bp);
return;
}
if (!valid)
return;
}
if (params.type == BreakpointAtJavaScriptThrow) { if (params.type == BreakpointAtJavaScriptThrow) {
bp.notifyBreakpointInsertOk(); bp.notifyBreakpointInsertOk();
d->setExceptionBreak(AllExceptions, params.enabled); d->setExceptionBreak(AllExceptions, params.enabled);
} else if (params.type == BreakpointByFileAndLine) { } else if (params.type == BreakpointByFileAndLine) {
d->setBreakpoint(QString(_(SCRIPTREGEXP)), params.fileName, d->setBreakpoint(QString(_(SCRIPTREGEXP)), params.fileName,
params.enabled, line, column, params.enabled, params.lineNumber, 0,
QLatin1String(params.condition), params.ignoreCount); QLatin1String(params.condition), params.ignoreCount);
} else if (params.type == BreakpointOnQmlSignalEmit) { } else if (params.type == BreakpointOnQmlSignalEmit) {
@@ -801,17 +776,6 @@ void QmlEngine::insertBreakpoint(Breakpoint bp)
void QmlEngine::removeBreakpoint(Breakpoint bp) void QmlEngine::removeBreakpoint(Breakpoint bp)
{ {
const BreakpointParameters &params = bp.parameters(); const BreakpointParameters &params = bp.parameters();
if (params.type == BreakpointByFileAndLine &&
d->pendingBreakpoints.contains(params.fileName)) {
auto it = d->pendingBreakpoints.find(params.fileName);
while (it != d->pendingBreakpoints.end() && it.key() == params.fileName) {
if (it.value() == bp.id()) {
d->pendingBreakpoints.erase(it);
return;
}
++it;
}
}
BreakpointState state = bp.state(); BreakpointState state = bp.state();
QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << bp << this << state); QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << bp << this << state);
@@ -1124,17 +1088,6 @@ void QmlEngine::disconnected()
notifyInferiorExited(); notifyInferiorExited();
} }
void QmlEngine::documentUpdated(Document::Ptr doc)
{
QString fileName = doc->fileName();
if (d->pendingBreakpoints.contains(fileName)) {
QList<Breakpoint> bps = d->pendingBreakpoints.values(fileName);
d->pendingBreakpoints.remove(fileName);
foreach (const Breakpoint bp, bps)
insertBreakpoint(bp);
}
}
void QmlEngine::updateCurrentContext() void QmlEngine::updateCurrentContext()
{ {
QString context; QString context;

View File

@@ -66,8 +66,6 @@ public:
private slots: private slots:
void disconnected(); void disconnected();
void documentUpdated(QmlJS::Document::Ptr doc);
void errorMessageBoxFinished(int result); void errorMessageBoxFinished(int result);
void updateCurrentContext(); void updateCurrentContext();

View File

@@ -209,28 +209,6 @@ public:
quint32 *column; quint32 *column;
}; };
bool adjustBreakpointLineAndColumn(const QString &filePath, quint32 *line, quint32 *column, bool *valid)
{
bool success = false;
//check if file is in the latest snapshot
//ignoring documentChangedOnDisk
//TODO:: update breakpoints if document is changed.
ModelManagerInterface *mmIface = ModelManagerInterface::instance();
if (mmIface) {
Document::Ptr doc = mmIface->newestSnapshot().document(filePath);
if (doc.isNull()) {
ModelManagerInterface::instance()->updateSourceFiles(
QStringList() << filePath, false);
} else {
ASTWalker walker;
walker(doc->ast(), line, column);
*valid = walker.done;
success = true;
}
}
return success;
}
void appendDebugOutput(QtMsgType type, const QString &message, const QDebugContextInfo &info) void appendDebugOutput(QtMsgType type, const QString &message, const QDebugContextInfo &info)
{ {
ConsoleItem::ItemType itemType; ConsoleItem::ItemType itemType;

View File

@@ -37,7 +37,6 @@
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
bool adjustBreakpointLineAndColumn(const QString &filePath, quint32 *line, quint32 *column, bool *valid);
void appendDebugOutput(QtMsgType type, const QString &message, const QmlDebug::QDebugContextInfo &info); void appendDebugOutput(QtMsgType type, const QString &message, const QmlDebug::QDebugContextInfo &info);
void clearExceptionSelection(); void clearExceptionSelection();