forked from qt-creator/qt-creator
debugger: replace BreakpointPending state with a flag in BreakpointResponse
To keep the breakpoint state machinery simple
This commit is contained in:
@@ -569,17 +569,12 @@ static bool isAllowedTransition(BreakpointState from, BreakpointState to)
|
||||
return to == BreakpointInsertProceeding;
|
||||
case BreakpointInsertProceeding:
|
||||
return to == BreakpointInserted
|
||||
|| to == BreakpointPending
|
||||
|| to == BreakpointDead;
|
||||
case BreakpointChangeRequested:
|
||||
return to == BreakpointChangeProceeding;
|
||||
case BreakpointChangeProceeding:
|
||||
return to == BreakpointInserted
|
||||
|| to == BreakpointPending
|
||||
|| to == BreakpointDead;
|
||||
case BreakpointPending:
|
||||
return to == BreakpointChangeRequested
|
||||
|| to == BreakpointRemoveRequested;
|
||||
case BreakpointInserted:
|
||||
return to == BreakpointChangeRequested
|
||||
|| to == BreakpointRemoveRequested;
|
||||
@@ -610,6 +605,18 @@ void BreakHandler::setState(BreakpointId id, BreakpointState state)
|
||||
it->state = state;
|
||||
}
|
||||
|
||||
static bool needsChange(const BreakpointParameters &data,
|
||||
const BreakpointResponse &response)
|
||||
{
|
||||
if (!data.conditionsMatch(response.condition))
|
||||
return true;
|
||||
if (data.ignoreCount != response.ignoreCount)
|
||||
return true;
|
||||
if (data.enabled != response.enabled)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void BreakHandler::notifyBreakpointInsertProceeding(BreakpointId id)
|
||||
{
|
||||
QTC_ASSERT(state(id)== BreakpointInsertRequested, /**/);
|
||||
@@ -620,6 +627,12 @@ void BreakHandler::notifyBreakpointInsertOk(BreakpointId id)
|
||||
{
|
||||
QTC_ASSERT(state(id)== BreakpointInsertProceeding, /**/);
|
||||
setState(id, BreakpointInserted);
|
||||
ConstIterator it = m_storage.find(id);
|
||||
QTC_ASSERT(it != m_storage.end(), return);
|
||||
if (needsChange(it->data, it->response)) {
|
||||
setState(id, BreakpointChangeRequested);
|
||||
scheduleSynchronization();
|
||||
}
|
||||
}
|
||||
|
||||
void BreakHandler::notifyBreakpointInsertFailed(BreakpointId id)
|
||||
@@ -660,12 +673,6 @@ void BreakHandler::notifyBreakpointChangeFailed(BreakpointId id)
|
||||
setState(id, BreakpointDead);
|
||||
}
|
||||
|
||||
void BreakHandler::notifyBreakpointPending(BreakpointId id)
|
||||
{
|
||||
//QTC_ASSERT(state(id)== BreakpointInsertProceeding, /**/);
|
||||
setState(id, BreakpointPending);
|
||||
}
|
||||
|
||||
void BreakHandler::notifyBreakpointReleased(BreakpointId id)
|
||||
{
|
||||
//QTC_ASSERT(state(id) == BreakpointChangeProceeding, /**/);
|
||||
@@ -902,7 +909,7 @@ void BreakHandler::setResponse(BreakpointId id, const BreakpointResponse &data)
|
||||
{
|
||||
Iterator it = m_storage.find(id);
|
||||
QTC_ASSERT(it != m_storage.end(), return);
|
||||
it->response = BreakpointResponse(data);
|
||||
it->response = data;
|
||||
updateMarker(id);
|
||||
}
|
||||
|
||||
@@ -952,7 +959,6 @@ static QString stateToString(BreakpointState state)
|
||||
case BreakpointInsertProceeding: return "insertion proceeding";
|
||||
case BreakpointChangeRequested: return "change requested";
|
||||
case BreakpointChangeProceeding: return "change proceeding";
|
||||
case BreakpointPending: return "breakpoint pending";
|
||||
case BreakpointInserted: return "breakpoint inserted";
|
||||
case BreakpointRemoveRequested: return "removal requested";
|
||||
case BreakpointRemoveProceeding: return "removal is proceeding";
|
||||
|
@@ -176,8 +176,7 @@ private:
|
||||
BreakpointItem();
|
||||
|
||||
void destroyMarker();
|
||||
bool isPending() const { return state == BreakpointPending
|
||||
|| state == BreakpointNew; }
|
||||
bool isPending() const { return response.pending; }
|
||||
bool isLocatedAt(const QString &fileName, int lineNumber,
|
||||
bool useMarkerPosition) const;
|
||||
QString toToolTip() const;
|
||||
|
@@ -92,7 +92,7 @@ QString BreakpointParameters::toString() const
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
BreakpointResponse::BreakpointResponse()
|
||||
: number(0), multiple(false)
|
||||
: number(0), pending(true), multiple(false)
|
||||
{}
|
||||
|
||||
QString BreakpointResponse::toString() const
|
||||
@@ -100,15 +100,11 @@ QString BreakpointResponse::toString() const
|
||||
QString result;
|
||||
QTextStream ts(&result);
|
||||
ts << number;
|
||||
ts << condition;
|
||||
ts << ignoreCount;
|
||||
ts << fileName;
|
||||
ts << pending;
|
||||
ts << fullName;
|
||||
ts << lineNumber;
|
||||
ts << threadSpec;
|
||||
ts << functionName;
|
||||
ts << address;
|
||||
return result;
|
||||
ts << multiple;
|
||||
ts << extra;
|
||||
return result + BreakpointParameters::toString();
|
||||
}
|
||||
|
||||
void BreakpointResponse::fromParameters(const BreakpointParameters &p)
|
||||
|
@@ -65,7 +65,6 @@ enum BreakpointState
|
||||
BreakpointInsertProceeding,
|
||||
BreakpointChangeRequested,
|
||||
BreakpointChangeProceeding,
|
||||
BreakpointPending,
|
||||
BreakpointInserted,
|
||||
BreakpointRemoveRequested,
|
||||
BreakpointRemoveProceeding,
|
||||
@@ -110,6 +109,7 @@ public:
|
||||
void fromParameters(const BreakpointParameters &p);
|
||||
|
||||
int number; // Breakpoint number assigned by the debugger engine.
|
||||
bool pending; // Breakpoint not fully resolved.
|
||||
QString fullName; // Full file name acknowledged by the debugger engine.
|
||||
bool multiple; // Happens in constructors/gdb.
|
||||
QByteArray extra; // gdb: <PENDING>, <MULTIPLE>
|
||||
|
@@ -1257,11 +1257,8 @@ void DebuggerEngine::attemptBreakpointSynchronization()
|
||||
//qDebug() << "BREAKPOINT " << id << " STILL IN PROGRESS, STATE"
|
||||
// << handler->state(id);
|
||||
continue;
|
||||
case BreakpointPending:
|
||||
//qDebug() << "BREAKPOINT " << id << " IS GOOD: PENDING";
|
||||
continue;
|
||||
case BreakpointInserted:
|
||||
//qDebug() << "BREAKPOINT " << id << " IS GOOD: INSERTED";
|
||||
//qDebug() << "BREAKPOINT " << id << " IS GOOD";
|
||||
continue;
|
||||
case BreakpointDead:
|
||||
// Should not only be visible inside BreakpointHandler.
|
||||
|
@@ -2026,7 +2026,6 @@ void GdbEngine::updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkp
|
||||
QTC_ASSERT(bkpt.isValid(), return);
|
||||
BreakpointResponse response = breakHandler()->response(id);
|
||||
|
||||
bool pending = false;
|
||||
response.multiple = false;
|
||||
response.enabled = true;
|
||||
response.condition.clear();
|
||||
@@ -2065,8 +2064,7 @@ void GdbEngine::updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkp
|
||||
} else if (child.hasName("enabled")) {
|
||||
response.enabled = (child.data() == "y");
|
||||
} else if (child.hasName("pending")) {
|
||||
//data->setState(BreakpointPending);
|
||||
pending = true;
|
||||
response.pending = true;
|
||||
// Any content here would be interesting only if we did accept
|
||||
// spontaneously appearing breakpoints (user using gdb commands).
|
||||
} else if (child.hasName("at")) {
|
||||
@@ -2104,12 +2102,8 @@ void GdbEngine::updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkp
|
||||
if (!name.isEmpty())
|
||||
response.fileName = name;
|
||||
|
||||
// FIXME: Should this honour current state?
|
||||
if (pending)
|
||||
breakHandler()->notifyBreakpointPending(id);
|
||||
else
|
||||
breakHandler()->notifyBreakpointInsertOk(id);
|
||||
breakHandler()->setResponse(id, response);
|
||||
breakHandler()->notifyBreakpointInsertOk(id);
|
||||
}
|
||||
|
||||
QString GdbEngine::breakLocation(const QString &file) const
|
||||
|
Reference in New Issue
Block a user