CDB: Handle "ambiguous symbol" messages on breakpoint inserts.

These messages usually appear when there is a lambda at the position
the breakpoint is about to be inserted.

Task-number: QTCREATORBUG-12178
Task-number: QTCREATORBUG-12016
Change-Id: I20f7b0e900147030bfd08206fab869ac22810825
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
David Schulz
2014-05-14 10:38:16 +02:00
parent 84790f9aef
commit 04fdbe3d01
4 changed files with 188 additions and 45 deletions

View File

@@ -132,7 +132,7 @@ static BreakpointParameters fixWinMSVCBreakpoint(const BreakpointParameters &p)
int breakPointIdToCdbId(const BreakpointModelId &id)
{
return cdbBreakPointStartId + id.majorPart();
return cdbBreakPointStartId + id.majorPart() * cdbBreakPointIdMinorPart + id.minorPart();
}
template <class ModelId>
@@ -141,8 +141,22 @@ 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);
if (ok)
return cdbIdToBreakpointId<ModelId>(id);
}
return ModelId();
}
template <class ModelId>
inline ModelId cdbIdToBreakpointId(const int &id)
{
if (id >= cdbBreakPointStartId) {
int major = (id - cdbBreakPointStartId) / cdbBreakPointIdMinorPart;
int minor = id % cdbBreakPointIdMinorPart;
if (minor)
return ModelId(major, minor);
else
return ModelId(major);
}
return ModelId();
}
@@ -152,11 +166,21 @@ BreakpointModelId cdbIdToBreakpointModelId(const GdbMi &id)
return cdbIdToBreakpointId<BreakpointModelId>(id);
}
BreakpointModelId cdbIdToBreakpointModelId(int id)
{
return cdbIdToBreakpointId<BreakpointModelId>(id);
}
BreakpointResponseId cdbIdToBreakpointResponseId(const GdbMi &id)
{
return cdbIdToBreakpointId<BreakpointResponseId>(id);
}
BreakpointResponseId cdbIdToBreakpointResponseId(int id)
{
return cdbIdToBreakpointId<BreakpointResponseId>(id);
}
QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
const QList<QPair<QString, QString> > &sourcePathMapping,
BreakpointModelId id /* = BreakpointId() */,
@@ -220,6 +244,16 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
return rc;
}
QByteArray cdbClearBreakpointCommand(const BreakpointModelId &id)
{
const int firstBreakPoint = breakPointIdToCdbId(id);
if (id.isMinor())
return "bc " + QByteArray::number(firstBreakPoint);
// If this is a major break point we also want to delete all sub break points
const int lastBreakPoint = firstBreakPoint + cdbBreakPointIdMinorPart - 1;
return "bc " + QByteArray::number(firstBreakPoint) + '-' + QByteArray::number(lastBreakPoint);
}
// Fix a CDB integer value: '00000000`0012a290' -> '12a290', '0n10' ->'10'
QByteArray fixCdbIntegerValue(QByteArray t, bool stripLeadingZeros, int *basePtr /* = 0 */)
{