Commit e4f28995 authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: better breakpoint state handling



Removal of a breakpoint while the insertion result was pending worked,
but created a lot of noise about unexpected state transitions.

Change-Id: I6c101ee9d184efb1c44f72cbff99b0481f64b0eb
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 587e2b5a
......@@ -1017,6 +1017,8 @@ void BreakHandler::removeBreakpoint(BreakpointModelId id)
Iterator it = m_storage.find(id);
BREAK_ASSERT(it != m_storage.end(), return);
switch (it->state) {
case BreakpointRemoveRequested:
break;
case BreakpointInserted:
case BreakpointInsertProceeding:
setState(id, BreakpointRemoveRequested);
......
......@@ -2498,6 +2498,18 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
{
BreakHandler *handler = breakHandler();
BreakpointModelId id = response.cookie.value<BreakpointModelId>();
if (handler->state(id) == BreakpointRemoveRequested) {
if (response.resultClass == GdbResultDone) {
// This delete was defered. Act now.
const GdbMi mainbkpt = response.data.findChild("bkpt");
handler->notifyBreakpointRemoveProceeding(id);
QByteArray nr = mainbkpt.findChild("number").data();
postCommand("-break-delete " + nr,
NeedsStop | RebuildBreakpointModel);
handler->notifyBreakpointRemoveOk(id);
return;
}
}
if (response.resultClass == GdbResultDone) {
// The result is a list with the first entry marked "bkpt"
// and "unmarked" rest. The "bkpt" one seems to always be
......@@ -2538,7 +2550,8 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
// Remove if we only support 7.4 or later.
if (br.multiple && !m_hasBreakpointNotifications)
postCommand("info break " + QByteArray::number(br.id.majorPart()),
NeedsStop, CB(handleBreakListMultiple), QVariant::fromValue(id));
NeedsStop, CB(handleBreakListMultiple),
QVariant::fromValue(id));
}
} else if (response.data.findChild("msg").data().contains("Unknown option")) {
// Older version of gdb don't know the -a option to set tracepoints
......@@ -3056,15 +3069,21 @@ void GdbEngine::removeBreakpoint(BreakpointModelId id)
{
BreakHandler *handler = breakHandler();
QTC_CHECK(handler->state(id) == BreakpointRemoveRequested);
handler->notifyBreakpointRemoveProceeding(id);
BreakpointResponse br = handler->response(id);
showMessage(_("DELETING BP %1 IN %2").arg(br.id.toString())
.arg(handler->fileName(id)));
postCommand("-break-delete " + br.id.toByteArray(),
NeedsStop | RebuildBreakpointModel);
// Pretend it succeeds without waiting for response. Feels better.
// FIXME: Really?
handler->notifyBreakpointRemoveOk(id);
if (br.id.isValid()) {
// We already have a fully inserted breakpoint.
handler->notifyBreakpointRemoveProceeding(id);
showMessage(_("DELETING BP %1 IN %2").arg(br.id.toString())
.arg(handler->fileName(id)));
postCommand("-break-delete " + br.id.toByteArray(),
NeedsStop | RebuildBreakpointModel);
// Pretend it succeeds without waiting for response. Feels better.
// FIXME: Really?
handler->notifyBreakpointRemoveOk(id);
} else {
// Breakpoint was scheduled to be inserted, but we haven't had
// an answer so far. Postpone activity by doing nothing.
}
}
......
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