{
Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return);
- BreakpointMarker *marker = it->marker;
- if (marker && (it->markerFileName != marker->fileName()
- || it->markerLineNumber != marker->lineNumber()))
+ QString markerFileName = it->markerFileName();
+ int markerLineNumber = it->markerLineNumber();
+ if (it->marker && (markerFileName != it->marker->fileName()
+ || markerLineNumber != it->marker->lineNumber()))
it->destroyMarker();
- if (!marker && !it->markerFileName.isEmpty() && it->markerLineNumber > 0) {
- marker = new BreakpointMarker(id, it->markerFileName, it->markerLineNumber);
- it->marker = marker;
- }
+ if (!it->marker && !markerFileName.isEmpty() && markerLineNumber > 0)
+ it->marker = new BreakpointMarker(id, markerFileName, markerLineNumber);
}
QVariant BreakHandler::headerData(int section,
? data.fileName : response.fileName;
str = QFileInfo(str).fileName();
// FIXME: better?
- //if (data.bpMultiple && str.isEmpty() && !data.markerFileName.isEmpty())
- // str = data.markerFileName;
+ //if (data.multiple && str.isEmpty() && !response.fileName.isEmpty())
+ // str = response.fileName;
str = str.isEmpty() ? empty : str;
if (data.useFullPath)
str = QDir::toNativeSeparators(QLatin1String("/.../") + str);
case 3:
if (role == Qt::DisplayRole) {
// FIXME: better?
- //if (data.bpMultiple && str.isEmpty() && !data.markerFileName.isEmpty())
- // str = data.markerLineNumber;
+ //if (data.multiple && str.isEmpty() && !reponse.fileName.isEmpty())
+ // str = response.lineNumber;
const int nr = it->isPending()
? data.lineNumber : response.lineNumber;
return nr ? QString::number(nr) : empty;
{
Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return);
- if (it->markerFileName == fileName && it->markerLineNumber == lineNumber)
+ if (it->response.fileName == fileName && it->response.lineNumber == lineNumber)
return;
- it->markerFileName = fileName;
- it->markerLineNumber = lineNumber;
it->response.fileName = fileName;
it->response.lineNumber = lineNumber;
updateMarker(id);
BreakpointId id(++currentId);
BreakpointItem item;
item.data = data;
- item.markerFileName = data.fileName;
- item.markerLineNumber = data.lineNumber;
+ item.response.fileName = data.fileName;
+ item.response.lineNumber = data.lineNumber;
m_storage.insert(id, item);
scheduleSynchronization();
}
QTC_ASSERT(it != m_storage.end(), return);
//if (data.markerLineNumber == lineNumber)
// return;
- if (it->markerLineNumber != lineNumber) {
- it->markerLineNumber = lineNumber;
+ if (it->response.lineNumber != lineNumber) {
+ it->response.lineNumber = lineNumber;
// FIXME: Should we tell gdb about the change?
// Ignore it for now, as we would require re-compilation
// and debugger re-start anyway.
// FIXME: Do we need yet another data member?
if (it->response.number == 0) {
it->data.lineNumber = lineNumber;
- updateMarker(id);
}
+ updateMarker(id);
}
BreakpointIds BreakHandler::allBreakpointIds() const
//////////////////////////////////////////////////////////////////
BreakHandler::BreakpointItem::BreakpointItem()
- : state(BreakpointNew), engine(0), marker(0), markerLineNumber(0)
+ : state(BreakpointNew), engine(0), marker(0)
{}
void BreakHandler::BreakpointItem::destroyMarker()
delete m;
}
+QString BreakHandler::BreakpointItem::markerFileName() const
+{
+ return !response.fileName.isEmpty() ? response.fileName : data.fileName;
+}
+
+
+int BreakHandler::BreakpointItem::markerLineNumber() const
+{
+ return response.lineNumber ? response.lineNumber : data.lineNumber;
+}
+
static void formatAddress(QTextStream &str, quint64 address)
{
if (address) {
bool BreakHandler::BreakpointItem::isLocatedAt
(const QString &fileName, int lineNumber, bool useMarkerPosition) const
{
- int line = useMarkerPosition ? markerLineNumber : data.lineNumber;
- return lineNumber == line && fileNameMatch(fileName, markerFileName);
+ int line = useMarkerPosition ? response.lineNumber : data.lineNumber;
+ return lineNumber == line && fileNameMatch(fileName, response.fileName);
}
QString BreakHandler::BreakpointItem::toToolTip() const
<< "</td><td>" << state << " (" << stateToString(state) << ")</td></tr>"
<< "<tr><td>" << tr("Engine:")
<< "</td><td>" << (engine ? engine->objectName() : "0") << "</td></tr>"
- << "<tr><td>" << tr("Marker File:")
- << "</td><td>" << QDir::toNativeSeparators(markerFileName) << "</td></tr>"
- << "<tr><td>" << tr("Marker Line:")
- << "</td><td>" << markerLineNumber << "</td></tr>"
<< "<tr><td>" << tr("Breakpoint Number:")
<< "</td><td>" << response.number << "</td></tr>"
<< "<tr><td>" << tr("Breakpoint Type:")
<< "</th><th>" << tr("Obtained") << "</th></tr>"
<< "<tr><td>" << tr("Internal Number:")
<< "</td><td>—</td><td>" << response.number << "</td></tr>"
+ << "<tr><td>" << tr("Function Name:")
+ << "</td><td>" << data.functionName
+ << "</td><td>" << response.functionName
+ << "</td></tr>"
<< "<tr><td>" << tr("File Name:")
<< "</td><td>" << QDir::toNativeSeparators(data.fileName)
<< "</td><td>" << QDir::toNativeSeparators(response.fileName)
<< "</td></tr>"
- << "<tr><td>" << tr("Function Name:")
- << "</td><td>" << data.functionName
- << "</td><td>" << response.functionName << "</td></tr>"
- << "<tr><td>" << tr("Line Number:") << "</td><td>";
- if (data.lineNumber)
- str << data.lineNumber;
- str << "</td><td>";
- if (response.lineNumber)
- str << response.lineNumber;
- str << "</td></tr>"
+ << "<tr><td>" << tr("Line Number:")
+ << "</td><td>" << data.lineNumber
+ << "</td><td>" << response.lineNumber << "</td></tr>"
<< "<tr><td>" << tr("Breakpoint Address:")
<< "</td><td>";
formatAddress(str, data.address);
const QString fileName =
QString::fromUtf8(frame.findChild("fullname").data());
const int lineNumber = frame.findChild("line").data().toInt();
- qDebug() << "HIT " << fileName << lineNumber;
if (!fileName.isEmpty()) {
BreakHandler *handler = breakHandler();
BreakpointId id = handler->findBreakpointByNumber(bkptno);
}
}
+void GdbEngine::attemptAdjustBreakpointLocation(BreakpointId id)
+{
+ if (!debuggerCore()->boolSetting(AdjustBreakpointLocations))
+ return;
+ BreakpointResponse response = breakHandler()->response(id);
+ if (response.address == 0 || response.correctedLineNumber != 0)
+ return;
+ // Prevent endless loop.
+ response.correctedLineNumber = -1;
+ breakHandler()->setResponse(id, response);
+ postCommand("info line *0x" + QByteArray::number(response.address, 16),
+ NeedsStop | RebuildBreakpointModel,
+ CB(handleInfoLine), id);
+}
+
void GdbEngine::handleBreakInsert1(const GdbResponse &response)
{
const int id = response.cookie.toInt();
// Interesting only on Mac?
GdbMi bkpt = response.data.findChild("bkpt");
updateBreakpointDataFromOutput(id, bkpt);
- //attempAdjustBreakpointLocation(id);
+ attemptAdjustBreakpointLocation(id);
} else {
// Some versions of gdb like "GNU gdb (GDB) SUSE (6.8.91.20090930-2.4)"
// know how to do pending breakpoints using CLI but not MI. So try
//continue;
}
- if (response.address && response.correctedLineNumber == 0) {
- // Prevent endless loop.
- BreakpointResponse r = response;
- r.correctedLineNumber = -1;
- breakHandler()->setResponse(id, r);
- if (debuggerCore()->boolSetting(AdjustBreakpointLocations)) {
- postCommand(
- "info line *0x" + QByteArray::number(response.address, 16),
- NeedsStop | RebuildBreakpointModel,
- CB(handleInfoLine), id);
- }
- }
+ attemptAdjustBreakpointLocation(id);
}
void GdbEngine::removeBreakpoint(BreakpointId id)