forked from qt-creator/qt-creator
debugger: fix scheduling of deletion of data watch points
This commit is contained in:
@@ -219,6 +219,12 @@ QString BreakpointData::toToolTip() const
|
||||
<< "</td><td>" << m_markerLineNumber << "</td></tr>"
|
||||
<< "<tr><td>" << BreakHandler::tr("Breakpoint Number:")
|
||||
<< "</td><td>" << bpNumber << "</td></tr>"
|
||||
<< "<tr><td>" << BreakHandler::tr("Breakpoint Type:")
|
||||
<< "</td><td>"
|
||||
<< (type == BreakpointType ? BreakHandler::tr("Breakpoint")
|
||||
: type == WatchpointType ? BreakHandler::tr("Watchpoint")
|
||||
: BreakHandler::tr("Unknown breakpoint type"))
|
||||
<< "</td></tr>"
|
||||
<< "</table><br><hr><table>"
|
||||
<< "<tr><th>" << BreakHandler::tr("Property")
|
||||
<< "</th><th>" << BreakHandler::tr("Requested")
|
||||
@@ -249,22 +255,26 @@ QString BreakpointData::toString() const
|
||||
{
|
||||
QString rc;
|
||||
QTextStream str(&rc);
|
||||
str << BreakHandler::tr("Marker File:") << m_markerFileName << ' '
|
||||
<< BreakHandler::tr("Marker Line:") << m_markerLineNumber << ' '
|
||||
<< BreakHandler::tr("Breakpoint Number:") << bpNumber << ' '
|
||||
<< BreakHandler::tr("File Name:")
|
||||
str << BreakHandler::tr("Marker File:") << ' ' << m_markerFileName << '\n'
|
||||
<< BreakHandler::tr("Marker Line:") << ' ' << m_markerLineNumber << '\n'
|
||||
<< BreakHandler::tr("Breakpoint Number:") << ' ' << bpNumber << '\n'
|
||||
<< BreakHandler::tr("Breakpoint Type:") << ' '
|
||||
<< (type == BreakpointType ? BreakHandler::tr("Breakpoint")
|
||||
: type == WatchpointType ? BreakHandler::tr("Watchpoint")
|
||||
: BreakHandler::tr("Unknown breakpoint type")) << '\n'
|
||||
<< BreakHandler::tr("File Name:") << ' '
|
||||
<< fileName << " -- " << bpFileName << '\n'
|
||||
<< BreakHandler::tr("Function Name:")
|
||||
<< BreakHandler::tr("Function Name:") << ' '
|
||||
<< funcName << " -- " << bpFuncName << '\n'
|
||||
<< BreakHandler::tr("Line Number:")
|
||||
<< BreakHandler::tr("Line Number:") << ' '
|
||||
<< lineNumber << " -- " << bpLineNumber << '\n'
|
||||
<< BreakHandler::tr("Breakpoint Address:")
|
||||
<< BreakHandler::tr("Breakpoint Address:") << ' '
|
||||
<< address << " -- " << bpAddress << '\n'
|
||||
<< BreakHandler::tr("Condition:")
|
||||
<< BreakHandler::tr("Condition:") << ' '
|
||||
<< condition << " -- " << bpCondition << '\n'
|
||||
<< BreakHandler::tr("Ignore Count:")
|
||||
<< BreakHandler::tr("Ignore Count:") << ' '
|
||||
<< ignoreCount << " -- " << bpIgnoreCount << '\n'
|
||||
<< BreakHandler::tr("Thread Specification:")
|
||||
<< BreakHandler::tr("Thread Specification:") << ' '
|
||||
<< threadSpec << " -- " << bpThreadSpec << '\n';
|
||||
return rc;
|
||||
}
|
||||
@@ -357,21 +367,30 @@ void BreakHandler::clear()
|
||||
m_inserted.clear();
|
||||
}
|
||||
|
||||
int BreakHandler::findSimilarBreakpoint(const BreakpointData &needle) const
|
||||
BreakpointData *BreakHandler::findSimilarBreakpoint(const BreakpointData &needle) const
|
||||
{
|
||||
// Search a breakpoint we might refer to.
|
||||
for (int index = 0; index != size(); ++index) {
|
||||
const BreakpointData *data = at(index);
|
||||
BreakpointData *data = m_bp[index];
|
||||
// Clear hit.
|
||||
if (data->bpNumber == needle.bpNumber)
|
||||
return index;
|
||||
return data;
|
||||
// Clear miss.
|
||||
if (data->type != needle.type)
|
||||
continue;
|
||||
// We have numbers, but they are different.
|
||||
if (!data->bpNumber.isEmpty() && !needle.bpNumber.isEmpty()
|
||||
&& !data->bpNumber.startsWith(needle.bpNumber)
|
||||
&& !needle.bpNumber.startsWith(data->bpNumber))
|
||||
continue;
|
||||
// At least at a position we were looking for.
|
||||
// FIXME: breaks multiple breakpoints at the same location
|
||||
if (fileNameMatch(data->fileName, needle.bpFileName)
|
||||
if (!data->fileName.isEmpty()
|
||||
&& fileNameMatch(data->fileName, needle.bpFileName)
|
||||
&& data->lineNumber == needle.bpLineNumber)
|
||||
return index;
|
||||
return data;
|
||||
}
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BreakHandler::findBreakpoint(const QString &fileName, int lineNumber) const
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
int indexOf(BreakpointData *data) { return m_bp.indexOf(data); }
|
||||
// If lineNumber < 0, interpret fileName as address.
|
||||
int findBreakpoint(const QString &fileName, int lineNumber) const;
|
||||
int findSimilarBreakpoint(const BreakpointData &data) const; // Returns index.
|
||||
BreakpointData *findSimilarBreakpoint(const BreakpointData &data) const;
|
||||
BreakpointData *findBreakpointByNumber(int bpNumber) const;
|
||||
void updateMarkers();
|
||||
|
||||
|
||||
@@ -337,6 +337,7 @@ void BreakWindow::deleteBreakpoints(QList<int> list)
|
||||
const int row = qMin(firstRow, model()->rowCount() - 1);
|
||||
if (row >= 0)
|
||||
setCurrentIndex(model()->index(row, 0));
|
||||
emit breakpointSynchronizationRequested();
|
||||
}
|
||||
|
||||
void BreakWindow::editBreakpoint(const QModelIndexList &list)
|
||||
|
||||
@@ -2138,12 +2138,17 @@ void GdbEngine::setBreakpointDataFromOutput(BreakpointData *data, const GdbMi &b
|
||||
data->bpFuncName = _(ba);
|
||||
} else if (child.hasName("thread")) {
|
||||
data->bpThreadSpec = child.data();
|
||||
} else if (child.hasName("type")) {
|
||||
if (child.data() == "breakpoint")
|
||||
data->type = BreakpointData::BreakpointType;
|
||||
else // FIXME: Incomplete list of cases.
|
||||
data->type = BreakpointData::WatchpointType;
|
||||
}
|
||||
// This field is not present. Contents needs to be parsed from
|
||||
// the plain "ignore" response.
|
||||
//else if (child.hasName("ignore"))
|
||||
// data->bpIgnoreCount = child.data();
|
||||
}
|
||||
// This field is not present. Contents needs to be parsed from
|
||||
// the plain "ignore" response.
|
||||
//else if (child.hasName("ignore"))
|
||||
// data->bpIgnoreCount = child.data();
|
||||
|
||||
QString name;
|
||||
if (!fullName.isEmpty()) {
|
||||
@@ -2293,7 +2298,7 @@ void GdbEngine::handleBreakList(const GdbResponse &response)
|
||||
|
||||
void GdbEngine::handleBreakList(const GdbMi &table)
|
||||
{
|
||||
GdbMi body = table.findChild("body");
|
||||
const GdbMi body = table.findChild("body");
|
||||
QList<GdbMi> bkpts;
|
||||
if (body.isValid()) {
|
||||
// Non-Mac
|
||||
@@ -2311,14 +2316,19 @@ void GdbEngine::handleBreakList(const GdbMi &table)
|
||||
}
|
||||
|
||||
BreakHandler *handler = manager()->breakHandler();
|
||||
for (int index = 0; index != bkpts.size(); ++index) {
|
||||
foreach (const GdbMi &bkpt, bkpts) {
|
||||
BreakpointData temp;
|
||||
setBreakpointDataFromOutput(&temp, bkpts.at(index));
|
||||
int found = handler->findSimilarBreakpoint(temp);
|
||||
if (found != -1)
|
||||
setBreakpointDataFromOutput(handler->at(found), bkpts.at(index));
|
||||
//else
|
||||
//qDebug() << "CANNOT HANDLE RESPONSE" << bkpts.at(index).toString();
|
||||
setBreakpointDataFromOutput(&temp, bkpt);
|
||||
BreakpointData *data = handler->findSimilarBreakpoint(temp);
|
||||
//qDebug() << "\n\nGOT: " << bkpt.toString() << '\n' << temp.toString();
|
||||
if (data) {
|
||||
//qDebug() << " FROM: " << data->toString();
|
||||
setBreakpointDataFromOutput(data, bkpt);
|
||||
//qDebug() << " TO: " << data->toString();
|
||||
} else {
|
||||
//qDebug() << " NOTHING SUITABLE FOUND";
|
||||
debugMessage(_("CANNOT FIND BP: " + bkpt.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
m_breakListOutdated = false;
|
||||
@@ -2548,11 +2558,14 @@ void GdbEngine::attemptBreakpointSynchronization()
|
||||
|
||||
foreach (BreakpointData *data, handler->takeRemovedBreakpoints()) {
|
||||
QByteArray bpNumber = data->bpNumber;
|
||||
debugMessage(_("DELETING BP " + bpNumber + " IN "
|
||||
+ data->markerFileName().toLocal8Bit()));
|
||||
if (!bpNumber.trimmed().isEmpty())
|
||||
if (!bpNumber.trimmed().isEmpty()) {
|
||||
debugMessage(_("DELETING BP " + bpNumber + " IN "
|
||||
+ data->markerFileName().toLocal8Bit()));
|
||||
postCommand("-break-delete " + bpNumber,
|
||||
NeedsStop | RebuildBreakpointModel);
|
||||
} else {
|
||||
debugMessage(_("QUIETLY REMOVING UNNUMBERED BREAKPOINT"));
|
||||
}
|
||||
delete data;
|
||||
}
|
||||
|
||||
@@ -2586,7 +2599,7 @@ void GdbEngine::attemptBreakpointSynchronization()
|
||||
if (!data->enabled && data->bpEnabled) {
|
||||
postCommand("-break-disable " + data->bpNumber,
|
||||
NeedsStop | RebuildBreakpointModel,
|
||||
CB(handleBreakInfo));
|
||||
CB(handleBreakDisable), data->bpNumber.toInt());
|
||||
data->bpEnabled = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user