Commit 15fc9396 authored by hjk's avatar hjk
Browse files

debugger: allow breakpoint removal also at the original position, not the "acknolegdged" one

Task-number: QTCREATORBUG-2264
parent 6c7c84d1
......@@ -571,17 +571,20 @@ void BreakHandler::removeAllBreakpoints()
BreakpointData *BreakHandler::findBreakpoint(const QString &fileName, int lineNumber)
BreakpointData *BreakHandler::findBreakpoint(const QString &fileName,
int lineNumber, bool useMarkerPosition)
foreach (BreakpointData *data, m_bp)
if (data->isLocatedAt(fileName, lineNumber))
if (data->isLocatedAt(fileName, lineNumber, useMarkerPosition))
return data;
return 0;
void BreakHandler::toggleBreakpoint(const QString &fileName, int lineNumber)
BreakpointData *data = findBreakpoint(fileName, lineNumber);
BreakpointData *data = findBreakpoint(fileName, lineNumber, true);
if (!data)
data = findBreakpoint(fileName, lineNumber, false);
if (data) {
} else {
......@@ -93,7 +93,8 @@ public:
void storeToTemplate(BreakHandler *other);
void toggleBreakpoint(const QString &fileName, int lineNumber);
void toggleBreakpointEnabled(const QString &fileName, int lineNumber);
BreakpointData *findBreakpoint(const QString &fileName, int lineNumber);
BreakpointData *findBreakpoint(const QString &fileName, int lineNumber,
bool useMarkerPosition = true);
public slots:
void appendBreakpoint(BreakpointData *data);
......@@ -304,19 +304,11 @@ QString BreakpointData::toString() const
return rc;
bool BreakpointData::isLocatedAt(const QString &fileName_, int lineNumber_) const
bool BreakpointData::isLocatedAt(const QString &fileName_, int lineNumber_,
bool useMarkerPosition) const
if (lineNumber != QString::number(lineNumber_))
return false;
if (fileName == fileName_)
return true;
if (fileName_.endsWith(fileName))
return true;
return false;
return lineNumber_ == m_markerLineNumber
&& fileNameMatch(fileName_, m_markerFileName);
int line = useMarkerPosition ? m_markerLineNumber : lineNumber.toInt();
return lineNumber_ == line && fileNameMatch(fileName_, m_markerFileName);
bool BreakpointData::isSimilarTo(const BreakpointData *needle) const
......@@ -58,7 +58,8 @@ public:
QString toString() const;
BreakHandler *handler() { return m_handler; }
bool isLocatedAt(const QString &fileName, int lineNumber) const;
bool isLocatedAt(const QString &fileName, int lineNumber,
bool useMarkerPosition) const;
bool isSimilarTo(const BreakpointData *needle) const;
bool conditionsMatch() const;
Supports Markdown
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