Commit abd7ab2c authored by hjk's avatar hjk
Browse files

debugger: fix some breakpoint state transitions in gdb engine

parent caa9a992
......@@ -678,6 +678,12 @@ void BreakHandler::notifyBreakpointRemoveFailed(BreakpointId id)
cleanupBreakpoint(id);
}
void BreakHandler::notifyBreakpointChangeProceeding(BreakpointId id)
{
QTC_ASSERT(state(id) == BreakpointChangeRequested, /**/);
setState(id, BreakpointChangeProceeding);
}
void BreakHandler::notifyBreakpointChangeOk(BreakpointId id)
{
QTC_ASSERT(state(id) == BreakpointChangeProceeding, /**/);
......
......@@ -132,6 +132,7 @@ public:
void notifyBreakpointInsertOk(BreakpointId id);
void notifyBreakpointInsertFailed(BreakpointId id);
void notifyBreakpointChangeOk(BreakpointId id);
void notifyBreakpointChangeProceeding(BreakpointId id);
void notifyBreakpointChangeFailed(BreakpointId id);
void notifyBreakpointPending(BreakpointId id);
void notifyBreakpointRemoveProceeding(BreakpointId id);
......
......@@ -2622,31 +2622,42 @@ void GdbEngine::insertBreakpoint(BreakpointId id)
void GdbEngine::changeBreakpoint(BreakpointId id)
{
const BreakpointParameters &data = breakHandler()->breakpointData(id);
BreakHandler *handler = breakHandler();
const BreakpointParameters &data = handler->breakpointData(id);
QTC_ASSERT(data.type != UnknownType, return);
const BreakpointResponse &response = breakHandler()->response(id);
const BreakpointResponse &response = handler->response(id);
QTC_ASSERT(response.number > 0, return);
const QByteArray bpnr = QByteArray::number(response.number);
QTC_ASSERT(response.number > 0, return);
bool finished = true;
if (data.condition != response.condition
&& !data.conditionsMatch(response.condition)) {
// Update conditions if needed.
handler->notifyBreakpointChangeProceeding(id);
finished = false;
postCommand("condition " + bpnr + ' ' + data.condition,
NeedsStop | RebuildBreakpointModel,
CB(handleBreakCondition), id);
}
if (data.ignoreCount != response.ignoreCount) {
// Update ignorecount if needed.
handler->notifyBreakpointChangeProceeding(id);
finished = false;
postCommand("ignore " + bpnr + ' ' + QByteArray::number(data.ignoreCount),
NeedsStop | RebuildBreakpointModel,
CB(handleBreakIgnore), id);
}
if (!data.enabled && response.enabled) {
handler->notifyBreakpointChangeProceeding(id);
finished = false;
postCommand("-break-disable " + bpnr,
NeedsStop | RebuildBreakpointModel,
CB(handleBreakDisable), id);
}
if (data.enabled && !response.enabled) {
handler->notifyBreakpointChangeProceeding(id);
finished = false;
postCommand("-break-enable " + bpnr,
NeedsStop | RebuildBreakpointModel,
CB(handleBreakEnable), id);
......@@ -2663,6 +2674,9 @@ void GdbEngine::changeBreakpoint(BreakpointId id)
}
attemptAdjustBreakpointLocation(id);
if (finished)
handler->notifyBreakpointChangeOk(id);
}
void GdbEngine::removeBreakpoint(BreakpointId id)
......
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