CDB: Start all CDB breakpoint IDs at 1000.

Avoid clashes with breakpoints resulting from options
(break at functions from options, potentially using bm).

Change-Id: I3746f5a246d7bbeea36df412460edf3f2a90e2c0
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Friedemann Kleint
2012-12-20 15:24:32 +01:00
parent 2764ed4f51
commit 278c0fef74
3 changed files with 45 additions and 18 deletions

View File

@@ -131,6 +131,33 @@ static BreakpointParameters fixWinMSVCBreakpoint(const BreakpointParameters &p)
return p;
}
int breakPointIdToCdbId(const BreakpointModelId &id)
{
return cdbBreakPointStartId + id.majorPart();
}
template <class ModelId>
inline ModelId cdbIdToBreakpointId(const GdbMi &data)
{
if (data.isValid()) { // Might not be valid if there is not id
bool ok;
const int id = data.data().toInt(&ok);
if (ok && id >= cdbBreakPointStartId)
return ModelId(id - cdbBreakPointStartId);
}
return ModelId();
}
BreakpointModelId cdbIdToBreakpointModelId(const GdbMi &id)
{
return cdbIdToBreakpointId<BreakpointModelId>(id);
}
BreakpointResponseId cdbIdToBreakpointResponseId(const GdbMi &id)
{
return cdbIdToBreakpointId<BreakpointResponseId>(id);
}
QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
const QList<QPair<QString, QString> > &sourcePathMapping,
BreakpointModelId id /* = BreakpointId() */,
@@ -148,7 +175,7 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
// when resolving).
str << (bp.type == WatchpointAtAddress ? "ba" : "bu");
if (id.isValid())
str << id.toString();
str << breakPointIdToCdbId(id);
str << ' ';
if (oneshot)
str << "/1 ";
@@ -304,13 +331,8 @@ void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
gdbmiChildToBool(gdbmi, "enabled", &(r->enabled));
gdbmiChildToBool(gdbmi, "deferred", &(r->pending));
r->id = BreakpointResponseId();
const GdbMi idG = gdbmi.findChild("id");
if (idG.isValid()) { // Might not be valid if there is not id
bool ok;
const int id = idG.data().toInt(&ok);
if (ok)
r->id = BreakpointResponseId(id);
}
// Might not be valid if there is not id
r->id = cdbIdToBreakpointResponseId(gdbmi.findChild("id"));
const GdbMi moduleG = gdbmi.findChild("module");
if (moduleG.isValid())
r->module = QString::fromLocal8Bit(moduleG.data());