diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 683117239c2e8761351cda82e0fc48635ce58682..f1d1a0140a122cd8a2b6ca841cf9a55449b4979e 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -712,27 +712,8 @@ void BreakHandler::toggleBreakpointEnabled(const QString &fileName, int lineNumb toggleBreakpointEnabled(at(findBreakpoint(fileName, lineNumber))); } -void BreakHandler::setBreakpoint(const QString &fileName, int lineNumber) +void BreakHandler::appendBreakpoint(BreakpointData *data) { - QFileInfo fi(fileName); - - BreakpointData *data = new BreakpointData(this); - if (lineNumber > 0) { - data->fileName = fileName; - data->lineNumber = QByteArray::number(lineNumber); - data->pending = true; - data->setMarkerFileName(fileName); - data->setMarkerLineNumber(lineNumber); - } else { - data->funcName = fileName; - data->lineNumber = 0; - data->pending = true; - // FIXME: Figure out in which disassembler view the Marker sits. - // Might be better to let the user code create the BreakpointData - // structure and insert it here. - data->setMarkerFileName(QString()); - data->setMarkerLineNumber(0); - } append(data); emit layoutChanged(); saveBreakpoints(); diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index de7b751e7013e6e532e5b0d3de83aac58b109b81..638ec497c9ecf1681a1ced5f600ab2d093eedb0f 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -157,7 +157,7 @@ public: QIcon pendingBreakPointIcon() const { return m_pendingBreakPointIcon; } public slots: - void setBreakpoint(const QString &fileName, int lineNumber); + void appendBreakpoint(BreakpointData *data); void toggleBreakpointEnabled(BreakpointData *data); void toggleBreakpointEnabled(const QString &fileName, int lineNumber); void breakByFunction(const QString &functionName); diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index f776251580e5d3d0bacbc8395377c0a479a32d8f..dea5e4f482b07ef13c730b1c5e21548a9fc34851 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -899,6 +899,31 @@ void DebuggerManager::toggleBreakpoint() toggleBreakpoint(fileName, lineNumber); } +// FIXME: move further up the plugin where there's more specific context +// information available. +static BreakpointData *createBreakpointByFileAndLine + (const QString &fileName, int lineNumber, BreakHandler *handler) +{ + BreakpointData *data = new BreakpointData(handler); + if (lineNumber > 0) { + data->fileName = fileName; + data->lineNumber = QByteArray::number(lineNumber); + data->pending = true; + data->setMarkerFileName(fileName); + data->setMarkerLineNumber(lineNumber); + } else { + data->funcName = fileName; + data->lineNumber = 0; + data->pending = true; + // FIXME: Figure out in which disassembler view the Marker sits. + // Might be better to let the user code create the BreakpointData + // structure and insert it here. + data->setMarkerFileName(QString()); + data->setMarkerLineNumber(0); + } + return data; +} + void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber) { STATE_DEBUG(fileName << lineNumber); @@ -913,7 +938,8 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber) int index = d->m_breakHandler->findBreakpoint(fileName, lineNumber); if (index == -1) - d->m_breakHandler->setBreakpoint(fileName, lineNumber); + d->m_breakHandler->appendBreakpoint( + createBreakpointByFileAndLine(fileName, lineNumber, d->m_breakHandler)); else d->m_breakHandler->removeBreakpoint(index); @@ -1339,14 +1365,6 @@ void DebuggerManager::addToWatchWindow() d->m_watchHandler->watchExpression(exp); } -void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber) -{ - STATE_DEBUG(Q_FUNC_INFO << fileName << lineNumber); - QTC_ASSERT(d->m_breakHandler, return); - d->m_breakHandler->setBreakpoint(fileName, lineNumber); - attemptBreakpointSynchronization(); -} - void DebuggerManager::breakByFunctionMain() { #ifdef Q_OS_WIN diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index b1e5dd2b5426ff3118fa20c30d2b5fafda7206cf..955ca1aa4b204c08034ea05ccffbfc110dbb34d9 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -219,7 +219,6 @@ public slots: void toggleBreakpoint(); void breakByFunction(const QString &functionName); void breakByFunctionMain(); - void setBreakpoint(const QString &fileName, int lineNumber); void activateFrame(int index); void selectThread(int index); void activateSnapshot(int index);