Debugger: use oneshot of BreakpointParameters in cdbAddBreakpointCommand

Change-Id: I5167c4d11708694b488cfa6d6b5ec806255e8719
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
David Schulz
2019-05-03 10:57:09 +02:00
parent ccb5f2302d
commit 56a1b499b5
3 changed files with 11 additions and 10 deletions

View File

@@ -866,6 +866,7 @@ void CdbEngine::executeRunToLine(const ContextData &data)
{ {
// Add one-shot breakpoint // Add one-shot breakpoint
BreakpointParameters bp; BreakpointParameters bp;
bp.oneShot = true;
if (data.address) { if (data.address) {
bp.type =BreakpointByAddress; bp.type =BreakpointByAddress;
bp.address = data.address; bp.address = data.address;
@@ -875,7 +876,7 @@ void CdbEngine::executeRunToLine(const ContextData &data)
bp.lineNumber = data.lineNumber; bp.lineNumber = data.lineNumber;
} }
runCommand({cdbAddBreakpointCommand(bp, m_sourcePathMappings, {}, true), BuiltinCommand, runCommand({cdbAddBreakpointCommand(bp, m_sourcePathMappings), BuiltinCommand,
[this](const DebuggerResponse &r) { handleBreakInsert(r, Breakpoint()); }}); [this](const DebuggerResponse &r) { handleBreakInsert(r, Breakpoint()); }});
continueInferior(); continueInferior();
} }
@@ -885,7 +886,8 @@ void CdbEngine::executeRunToFunction(const QString &functionName)
// Add one-shot breakpoint // Add one-shot breakpoint
BreakpointParameters bp(BreakpointByFunction); BreakpointParameters bp(BreakpointByFunction);
bp.functionName = functionName; bp.functionName = functionName;
runCommand({cdbAddBreakpointCommand(bp, m_sourcePathMappings, {}, true), BuiltinCommand, bp.oneShot = true;
runCommand({cdbAddBreakpointCommand(bp, m_sourcePathMappings), BuiltinCommand,
[this](const DebuggerResponse &r) { handleBreakInsert(r, Breakpoint()); }}); [this](const DebuggerResponse &r) { handleBreakInsert(r, Breakpoint()); }});
continueInferior(); continueInferior();
} }
@@ -1946,7 +1948,7 @@ void CdbEngine::handleBreakInsert(const DebuggerResponse &response, const Breakp
functionName = functionName.mid(functionStart); functionName = functionName.mid(functionStart);
sub->params.functionName = functionName; sub->params.functionName = functionName;
sub->displayName = bp->displayName() + '.' + QString::number(subBreakPointID); sub->displayName = bp->displayName() + '.' + QString::number(subBreakPointID);
runCommand({cdbAddBreakpointCommand(sub->params, m_sourcePathMappings, sub->responseId, false), NoFlags}); runCommand({cdbAddBreakpointCommand(sub->params, m_sourcePathMappings, sub->responseId), NoFlags});
} }
} }
@@ -2505,10 +2507,10 @@ void CdbEngine::insertBreakpoint(const Breakpoint &bp)
&& boolSetting(CdbBreakPointCorrection)) { && boolSetting(CdbBreakPointCorrection)) {
response.lineNumber = int(lineCorrection->fixLineNumber( response.lineNumber = int(lineCorrection->fixLineNumber(
parameters.fileName, unsigned(parameters.lineNumber))); parameters.fileName, unsigned(parameters.lineNumber)));
QString cmd = cdbAddBreakpointCommand(response, m_sourcePathMappings, responseId, false); QString cmd = cdbAddBreakpointCommand(response, m_sourcePathMappings, responseId);
runCommand({cmd, BuiltinCommand, handleBreakInsertCB}); runCommand({cmd, BuiltinCommand, handleBreakInsertCB});
} else { } else {
QString cmd = cdbAddBreakpointCommand(parameters, m_sourcePathMappings, responseId, false); QString cmd = cdbAddBreakpointCommand(parameters, m_sourcePathMappings, responseId);
runCommand({cmd, BuiltinCommand, handleBreakInsertCB}); runCommand({cmd, BuiltinCommand, handleBreakInsertCB});
} }
if (!parameters.enabled) if (!parameters.enabled)
@@ -2563,7 +2565,7 @@ void CdbEngine::updateBreakpoint(const Breakpoint &bp)
} else { } else {
// Delete and re-add, triggering update // Delete and re-add, triggering update
runCommand({cdbClearBreakpointCommand(bp), NoFlags}); runCommand({cdbClearBreakpointCommand(bp), NoFlags});
QString cmd = cdbAddBreakpointCommand(parameters, m_sourcePathMappings, responseId, false); QString cmd = cdbAddBreakpointCommand(parameters, m_sourcePathMappings, responseId);
runCommand({cmd, BuiltinCommand, handleBreakInsertCB}); runCommand({cmd, BuiltinCommand, handleBreakInsertCB});
m_pendingBreakpointMap.insert(bp); m_pendingBreakpointMap.insert(bp);
listBreakpoints(); listBreakpoints();

View File

@@ -138,8 +138,7 @@ QString breakPointCdbId(const Breakpoint &bp)
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)
bool oneshot)
{ {
const BreakpointParameters params = fixWinMSVCBreakpoint(bpIn); const BreakpointParameters params = fixWinMSVCBreakpoint(bpIn);
QString rc; QString rc;
@@ -154,7 +153,7 @@ QString cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
str << (params.type == WatchpointAtAddress ? "ba" : "bu") str << (params.type == WatchpointAtAddress ? "ba" : "bu")
<< responseId << responseId
<< ' '; << ' ';
if (oneshot) if (params.oneShot)
str << "/1 "; str << "/1 ";
switch (params.type) { switch (params.type) {
case BreakpointAtFork: case BreakpointAtFork:

View File

@@ -58,7 +58,7 @@ 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,
const QList<QPair<QString, QString> > &sourcePathMapping, const QList<QPair<QString, QString> > &sourcePathMapping,
const QString &responseId = QString(), bool oneshot = false); const QString &responseId = QString());
QString cdbClearBreakpointCommand(const Breakpoint &bp); QString cdbClearBreakpointCommand(const Breakpoint &bp);
// Parse extension command listing breakpoints. // Parse extension command listing breakpoints.
// Note that not all fields are returned, since file, line, function are encoded // Note that not all fields are returned, since file, line, function are encoded