Debugger: Do not use deprecated bp model id to construct response ids

fixes breakpoint deletion

Change-Id: Ie5bda4e2664338ad4210f275abca374c6918753c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2018-10-22 13:06:05 +02:00
parent 6796839da3
commit 08e27a5542
3 changed files with 9 additions and 20 deletions

View File

@@ -2492,7 +2492,7 @@ void CdbEngine::insertBreakpoint(const Breakpoint &bp)
BreakpointParameters parameters = bp->requestedParameters(); BreakpointParameters parameters = bp->requestedParameters();
const auto handleBreakInsertCB = [this, bp](const DebuggerResponse &r) { handleBreakInsert(r, bp); }; const auto handleBreakInsertCB = [this, bp](const DebuggerResponse &r) { handleBreakInsert(r, bp); };
BreakpointParameters response = parameters; BreakpointParameters response = parameters;
auto responseId = QString::number(breakPointIdToCdbId(bp)); const QString responseId = breakPointCdbId(bp);
QScopedPointer<BreakpointCorrectionContext> lineCorrection( QScopedPointer<BreakpointCorrectionContext> lineCorrection(
new BreakpointCorrectionContext(m_codeModelSnapshot, CppTools::CppModelManager::instance()->workingCopy())); new BreakpointCorrectionContext(m_codeModelSnapshot, CppTools::CppModelManager::instance()->workingCopy()));
if (!m_autoBreakPointCorrection if (!m_autoBreakPointCorrection
@@ -2539,7 +2539,7 @@ void CdbEngine::updateBreakpoint(const Breakpoint &bp)
BreakpointParameters parameters = bp->requestedParameters(); BreakpointParameters parameters = bp->requestedParameters();
const auto handleBreakInsertCB = [this, bp](const DebuggerResponse &r) { handleBreakInsert(r, bp); }; const auto handleBreakInsertCB = [this, bp](const DebuggerResponse &r) { handleBreakInsert(r, bp); };
BreakpointParameters response = parameters; BreakpointParameters response = parameters;
auto responseId = QString::number(breakPointIdToCdbId(bp)); const QString responseId = breakPointCdbId(bp);
notifyBreakpointChangeProceeding(bp); notifyBreakpointChangeProceeding(bp);
if (debugBreakpoints) if (debugBreakpoints)
qDebug("Changing %d:\n %s\nTo %s\n", bp->modelId(), qDebug("Changing %d:\n %s\nTo %s\n", bp->modelId(),

View File

@@ -128,25 +128,14 @@ static BreakpointParameters fixWinMSVCBreakpoint(const BreakpointParameters &p)
return p; return p;
} }
int breakPointIdToCdbId(const Breakpoint &bp) QString breakPointCdbId(const Breakpoint &bp)
{ {
// return cdbBreakPointStartId + bp.majorPart() * cdbBreakPointIdMinorPart + bp.minorPart(); static int bpId = 1;
if (!bp->responseId().isEmpty()) if (!bp->responseId().isEmpty())
return bp->responseId().toInt(); return bp->responseId();
return cdbBreakPointStartId + bp->modelId() * cdbBreakPointIdMinorPart; return QString::number(cdbBreakPointStartId + (bpId++) * cdbBreakPointIdMinorPart);
} }
//static int cdbIdToBreakpointModel(int cdbid)
//{
// if (cdbid >= cdbBreakPointStartId) {
// int major = (cdbid - cdbBreakPointStartId) / cdbBreakPointIdMinorPart;
// int minor = cdbid % cdbBreakPointIdMinorPart;
// (void) minor;
// return major;
// }
// return 0;
//}
QString cdbAddBreakpointCommand(const BreakpointParameters &bpIn, QString cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
const QList<QPair<QString, QString> > &sourcePathMapping, const QList<QPair<QString, QString> > &sourcePathMapping,
const QString &responseId, const QString &responseId,
@@ -212,11 +201,11 @@ QString cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
QString cdbClearBreakpointCommand(const Breakpoint &bp) QString cdbClearBreakpointCommand(const Breakpoint &bp)
{ {
// FIME: Check // FIME: Check
// const int firstBreakPoint = breakPointIdToCdbId(id); // const int firstBreakPoint = breakPointCdbId(id);
// if (id.isMinor()) // if (id.isMinor())
// return "bc " + QString::number(firstBreakPoint); // return "bc " + QString::number(firstBreakPoint);
// If this is a major break point we also want to delete all sub break points // If this is a major break point we also want to delete all sub break points
const int firstBreakPoint = cdbBreakPointStartId + bp->modelId() * cdbBreakPointIdMinorPart; const int firstBreakPoint = bp->responseId().toInt();
const int lastBreakPoint = firstBreakPoint + cdbBreakPointIdMinorPart - 1; const int lastBreakPoint = firstBreakPoint + cdbBreakPointIdMinorPart - 1;
return "bc " + QString::number(firstBreakPoint) + '-' + QString::number(lastBreakPoint); return "bc " + QString::number(firstBreakPoint) + '-' + QString::number(lastBreakPoint);
} }

View File

@@ -53,7 +53,7 @@ QString cdbSourcePathMapping(QString fileName,
enum { cdbBreakPointStartId = 100000, enum { cdbBreakPointStartId = 100000,
cdbBreakPointIdMinorPart = 100}; cdbBreakPointIdMinorPart = 100};
int breakPointIdToCdbId(const Breakpoint &bp); QString breakPointCdbId(const Breakpoint &bp);
// Convert breakpoint in CDB syntax (applying source path mappings using native paths). // Convert breakpoint in CDB syntax (applying source path mappings using native paths).
QString cdbAddBreakpointCommand(const BreakpointParameters &d, QString cdbAddBreakpointCommand(const BreakpointParameters &d,