Commit d4aed1ae authored by hjk's avatar hjk
Browse files

debugger: refactoring of breakpoint creation

parent 4eb83cd8
......@@ -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();
......
......@@ -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);
......
......@@ -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
......
......@@ -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);
......
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