Commit 9e800bc0 authored by David Schulz's avatar David Schulz

Cdb: Pass the breakpoint id to the command handler.

This way the id doesn't have to be parsed from the command.

Change-Id: I8beb15c6d98a6628f373cf44b724dd4267efb728
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent 6633bc99
...@@ -706,9 +706,9 @@ void CdbEngine::setupInferior() ...@@ -706,9 +706,9 @@ void CdbEngine::setupInferior()
attemptBreakpointSynchronization(); attemptBreakpointSynchronization();
if (rp.breakOnMain) { if (rp.breakOnMain) {
const BreakpointParameters bp(BreakpointAtMain); const BreakpointParameters bp(BreakpointAtMain);
postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId id(quint16(-1));
BreakpointModelId(quint16(-1)), true), postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, id, true),
CB(handleBreakInsert)); [this, id](const CdbResponse &r){ handleBreakInsert(r, id); });
} }
postCommand("sxn 0x4000001f"); // Do not break on WowX86 exceptions. postCommand("sxn 0x4000001f"); // Do not break on WowX86 exceptions.
postCommand("sxn ibp"); // Do not break on initial breakpoints. postCommand("sxn ibp"); // Do not break on initial breakpoints.
...@@ -768,25 +768,25 @@ void CdbEngine::runEngine() ...@@ -768,25 +768,25 @@ void CdbEngine::runEngine()
const QByteArray debugModule = module + 'D'; const QByteArray debugModule = module + 'D';
const QByteArray wideFunc = QByteArray(CdbOptionsPage::crtDbgReport).append('W'); const QByteArray wideFunc = QByteArray(CdbOptionsPage::crtDbgReport).append('W');
postBuiltinCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, module), postBuiltinCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, module),
CB(handleBreakInsert)); [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
postBuiltinCommand(breakAtFunctionCommand(wideFunc, module), postBuiltinCommand(breakAtFunctionCommand(wideFunc, module),
CB(handleBreakInsert)); [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
postBuiltinCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, debugModule), postBuiltinCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, debugModule),
CB(handleBreakInsert)); [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
postBuiltinCommand(breakAtFunctionCommand(wideFunc, debugModule), postBuiltinCommand(breakAtFunctionCommand(wideFunc, debugModule),
CB(handleBreakInsert)); [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
} }
if (boolSetting(BreakOnWarning)) { if (boolSetting(BreakOnWarning)) {
postBuiltinCommand("bm /( QtCored4!qWarning", postBuiltinCommand("bm /( QtCored4!qWarning", // 'bm': All overloads.
CB(handleBreakInsert)); // 'bm': All overloads. [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::warning", postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::warning",
CB(handleBreakInsert)); [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
} }
if (boolSetting(BreakOnFatal)) { if (boolSetting(BreakOnFatal)) {
postBuiltinCommand("bm /( QtCored4!qFatal", postBuiltinCommand("bm /( QtCored4!qFatal", // 'bm': All overloads.
CB(handleBreakInsert)); // 'bm': All overloads. [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::fatal", postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::fatal",
CB(handleBreakInsert)); [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
} }
if (runParameters().startMode == AttachCore) { if (runParameters().startMode == AttachCore) {
QTC_ASSERT(!m_coreStopReason.isNull(), return; ); QTC_ASSERT(!m_coreStopReason.isNull(), return; );
...@@ -1047,7 +1047,7 @@ void CdbEngine::executeRunToLine(const ContextData &data) ...@@ -1047,7 +1047,7 @@ void CdbEngine::executeRunToLine(const ContextData &data)
bp.lineNumber = data.lineNumber; bp.lineNumber = data.lineNumber;
} }
postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true), postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true),
CB(handleBreakInsert)); [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
continueInferior(); continueInferior();
} }
...@@ -1058,7 +1058,7 @@ void CdbEngine::executeRunToFunction(const QString &functionName) ...@@ -1058,7 +1058,7 @@ void CdbEngine::executeRunToFunction(const QString &functionName)
bp.functionName = functionName; bp.functionName = functionName;
postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true), postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true),
CB(handleBreakInsert)); [this](const CdbResponse &r){ handleBreakInsert(r, BreakpointModelId()); });
continueInferior(); continueInferior();
} }
...@@ -2099,7 +2099,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT ...@@ -2099,7 +2099,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
showStoppedByExceptionMessageBox(exceptionBoxMessage); showStoppedByExceptionMessageBox(exceptionBoxMessage);
} }
void CdbEngine::handleBreakInsert(const CdbResponse &response) void CdbEngine::handleBreakInsert(const CdbResponse &response, const BreakpointModelId &bpId)
{ {
const QList<QByteArray> &reply = response.reply.split('\n'); const QList<QByteArray> &reply = response.reply.split('\n');
if (reply.isEmpty()) if (reply.isEmpty())
...@@ -2121,18 +2121,9 @@ void CdbEngine::handleBreakInsert(const CdbResponse &response) ...@@ -2121,18 +2121,9 @@ void CdbEngine::handleBreakInsert(const CdbResponse &response)
// Ambiguous symbol error at '`untitled2!C:\dev\src\tmp\untitled2\main.cpp:18`' // Ambiguous symbol error at '`untitled2!C:\dev\src\tmp\untitled2\main.cpp:18`'
// ^ Extra character error in 'bu1004 `untitled2!C:\dev\src\tmp\untitled2\main.cpp:18`' // ^ Extra character error in 'bu1004 `untitled2!C:\dev\src\tmp\untitled2\main.cpp:18`'
// extract break point model id from command if (!bpId.isValid())
QRegExp numberRegEx(QLatin1String("\\d"));
const int numberStart = numberRegEx.indexIn(QLatin1String(response.command));
if (numberStart == -1)
return; return;
const int numberEnd = response.command.indexOf(' ', numberStart); Breakpoint bp = breakHandler()->breakpointById(bpId);
bool ok = true;
const int cdbBreakPointId = response.command.mid(numberStart, numberEnd - numberStart).toInt(&ok);
if (!ok)
return;
const BreakpointModelId &originalId = cdbIdToBreakpointModelId(cdbBreakPointId);
Breakpoint bp = breakHandler()->breakpointById(originalId);
// add break point for every match // add break point for every match
const QList<QByteArray>::const_iterator &end = reply.constEnd(); const QList<QByteArray>::const_iterator &end = reply.constEnd();
int subBreakPointID = 0; int subBreakPointID = 0;
...@@ -2151,7 +2142,7 @@ void CdbEngine::handleBreakInsert(const CdbResponse &response) ...@@ -2151,7 +2142,7 @@ void CdbEngine::handleBreakInsert(const CdbResponse &response)
if (!ok) if (!ok)
continue; continue;
BreakpointModelId id(originalId.majorPart(), ++subBreakPointID); BreakpointModelId id(bpId.majorPart(), ++subBreakPointID);
BreakpointResponse res = bp.response(); BreakpointResponse res = bp.response();
res.type = BreakpointByAddress; res.type = BreakpointByAddress;
res.address = address; res.address = address;
...@@ -2730,11 +2721,11 @@ void CdbEngine::attemptBreakpointSynchronization() ...@@ -2730,11 +2721,11 @@ void CdbEngine::attemptBreakpointSynchronization()
response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber); response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber);
postBuiltinCommand( postBuiltinCommand(
cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false), cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false),
CB(handleBreakInsert)); [this, id](const CdbResponse &r){ handleBreakInsert(r, id); });
} else { } else {
postBuiltinCommand( postBuiltinCommand(
cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false), cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false),
CB(handleBreakInsert)); [this, id](const CdbResponse &r){ handleBreakInsert(r, id); });
} }
if (!parameters.enabled) if (!parameters.enabled)
postCommand("bd " + QByteArray::number(breakPointIdToCdbId(id))); postCommand("bd " + QByteArray::number(breakPointIdToCdbId(id)));
...@@ -2767,7 +2758,7 @@ void CdbEngine::attemptBreakpointSynchronization() ...@@ -2767,7 +2758,7 @@ void CdbEngine::attemptBreakpointSynchronization()
postCommand(cdbClearBreakpointCommand(id)); postCommand(cdbClearBreakpointCommand(id));
postBuiltinCommand( postBuiltinCommand(
cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false), cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false),
CB(handleBreakInsert)); [this, id](const CdbResponse &r){ handleBreakInsert(r, id); });
m_pendingBreakpointMap.insert(id, response); m_pendingBreakpointMap.insert(id, response);
} }
bp.notifyBreakpointChangeOk(); bp.notifyBreakpointChangeOk();
......
...@@ -210,7 +210,7 @@ private: ...@@ -210,7 +210,7 @@ private:
void handleExpression(const CdbResponse &command, BreakpointModelId id, const GdbMi &stopReason); void handleExpression(const CdbResponse &command, BreakpointModelId id, const GdbMi &stopReason);
void handleResolveSymbol(const CdbResponse &command, const QString &symbol, DisassemblerAgent *agent); void handleResolveSymbol(const CdbResponse &command, const QString &symbol, DisassemblerAgent *agent);
void handleResolveSymbolHelper(const QList<quint64> &addresses, DisassemblerAgent *agent); void handleResolveSymbolHelper(const QList<quint64> &addresses, DisassemblerAgent *agent);
void handleBreakInsert(const CdbResponse &response); void handleBreakInsert(const CdbResponse &response, const BreakpointModelId &bpId);
void handleCheckWow64(const CdbResponse &response, const GdbMi &stack); void handleCheckWow64(const CdbResponse &response, const GdbMi &stack);
void ensureUsing32BitStackInWow64(const CdbResponse &response, const GdbMi &stack); void ensureUsing32BitStackInWow64(const CdbResponse &response, const GdbMi &stack);
void handleSwitchWow64Stack(const CdbResponse &response); void handleSwitchWow64Stack(const CdbResponse &response);
......
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