Debugger: Be less eager on breakpoint synchronization

Triggering synchronization too early leads to unnecessary pending
breakpoints and complicates debugger startup.

Change-Id: Ic1c0064f29eaa325a110baf9b22ec6bf66a00a2d
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
hjk
2014-12-05 12:08:41 +01:00
committed by David Schulz
parent 877d482c85
commit ec607055c4
2 changed files with 10 additions and 5 deletions

View File

@@ -404,7 +404,7 @@ void BreakHandler::loadBreakpoints()
if (v.isValid()) if (v.isValid())
data.message = v.toString(); data.message = v.toString();
if (data.isValid()) if (data.isValid())
appendBreakpoint(data); appendBreakpointInternal(data);
else else
qWarning("Not restoring invalid breakpoint: %s", qPrintable(data.toString())); qWarning("Not restoring invalid breakpoint: %s", qPrintable(data.toString()));
} }
@@ -845,7 +845,7 @@ void BreakHandler::setEngine(BreakpointModelId id, DebuggerEngine *value)
it->state = BreakpointInsertRequested; it->state = BreakpointInsertRequested;
it->response = BreakpointResponse(); it->response = BreakpointResponse();
it->updateMarker(id); it->updateMarker(id);
scheduleSynchronization(); //scheduleSynchronization();
} }
static bool isAllowedTransition(BreakpointState from, BreakpointState to) static bool isAllowedTransition(BreakpointState from, BreakpointState to)
@@ -1053,6 +1053,12 @@ void BreakHandler::removeBreakpoint(BreakpointModelId id)
static int currentId = 0; static int currentId = 0;
void BreakHandler::appendBreakpoint(const BreakpointParameters &data) void BreakHandler::appendBreakpoint(const BreakpointParameters &data)
{
appendBreakpointInternal(data);
scheduleSynchronization();
}
void BreakHandler::appendBreakpointInternal(const BreakpointParameters &data)
{ {
if (!data.isValid()) { if (!data.isValid()) {
qWarning("Not adding invalid breakpoint: %s", qPrintable(data.toString())); qWarning("Not adding invalid breakpoint: %s", qPrintable(data.toString()));
@@ -1068,8 +1074,6 @@ void BreakHandler::appendBreakpoint(const BreakpointParameters &data)
// Create marker after copy is inserted into hash. // Create marker after copy is inserted into hash.
it->data = data; it->data = data;
it->updateMarker(id); it->updateMarker(id);
scheduleSynchronization();
} }
void BreakHandler::handleAlienBreakpoint(const BreakpointResponse &response, DebuggerEngine *engine) void BreakHandler::handleAlienBreakpoint(const BreakpointResponse &response, DebuggerEngine *engine)
@@ -1095,7 +1099,7 @@ void BreakHandler::handleAlienBreakpoint(const BreakpointResponse &response, Deb
it->updateMarker(id); it->updateMarker(id);
layoutChanged(); layoutChanged();
scheduleSynchronization(); //scheduleSynchronization();
} }
} }

View File

@@ -187,6 +187,7 @@ private:
void loadBreakpoints(); void loadBreakpoints();
void saveBreakpoints(); void saveBreakpoints();
void cleanupBreakpoint(BreakpointModelId id); void cleanupBreakpoint(BreakpointModelId id);
void appendBreakpointInternal(const BreakpointParameters &data);
Q_SLOT void changeLineNumberFromMarkerHelper(Debugger::Internal::BreakpointModelId id, int lineNumber); Q_SLOT void changeLineNumberFromMarkerHelper(Debugger::Internal::BreakpointModelId id, int lineNumber);
struct BreakpointItem struct BreakpointItem