Commit bf1f351f authored by hjk's avatar hjk
Browse files

debugger: first step to re-enable breakpoint location update.

parent 203c7a2f
......@@ -529,9 +529,14 @@ void BreakHandler::setMarkerFileAndLine(BreakpointId id,
{
Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return);
if (it->markerFileName == fileName && it->markerLineNumber == lineNumber)
return;
it->markerFileName = fileName;
it->markerLineNumber = lineNumber;
it->response.fileName = fileName;
it->response.lineNumber = lineNumber;
updateMarker(id);
scheduleSynchronization();
}
BreakpointState BreakHandler::state(BreakpointId id) const
......@@ -569,7 +574,8 @@ static bool isAllowedTransition(BreakpointState from, BreakpointState to)
return to == BreakpointInsertProceeding;
case BreakpointInsertProceeding:
return to == BreakpointInserted
|| to == BreakpointDead;
|| to == BreakpointDead
|| to == BreakpointChangeRequested;
case BreakpointChangeRequested:
return to == BreakpointChangeProceeding;
case BreakpointChangeProceeding:
......
......@@ -92,7 +92,7 @@ QString BreakpointParameters::toString() const
//////////////////////////////////////////////////////////////////
BreakpointResponse::BreakpointResponse()
: number(0), pending(true), multiple(false)
: number(0), pending(true), multiple(false), correctedLineNumber(0)
{}
QString BreakpointResponse::toString() const
......@@ -104,6 +104,7 @@ QString BreakpointResponse::toString() const
ts << fullName;
ts << multiple;
ts << extra;
ts << correctedLineNumber;
return result + BreakpointParameters::toString();
}
......@@ -114,6 +115,7 @@ void BreakpointResponse::fromParameters(const BreakpointParameters &p)
fullName.clear();
multiple = false;
extra.clear();
correctedLineNumber = 0;
}
} // namespace Internal
......
......@@ -113,6 +113,7 @@ public:
QString fullName; // Full file name acknowledged by the debugger engine.
bool multiple; // Happens in constructors/gdb.
QByteArray extra; // gdb: <PENDING>, <MULTIPLE>
int correctedLineNumber;
};
typedef QList<BreakpointId> BreakpointIds;
......
......@@ -1163,6 +1163,22 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
return;
}
const int bkptno = data.findChild("bkptno").data().toInt();
const GdbMi frame = data.findChild("frame");
if (bkptno && frame.isValid()) {
// Use opportunity to update the marker position.
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);
handler->setMarkerFileAndLine(id, fileName, lineNumber);
}
}
if (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state())
notifyInferiorStopOk();
......@@ -1226,8 +1242,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
// FIXME: Replace the #ifdef by the "target" architecture
#ifdef Q_OS_LINUX
if (!m_entryPoint.isEmpty()) {
GdbMi frameData = data.findChild("frame");
if (frameData.findChild("addr").data() == m_entryPoint) {
if (frame.findChild("addr").data() == m_entryPoint) {
// There are two expected reasons for getting here:
// 1) For some reason, attaching to a stopped process causes *two* SIGSTOPs
// when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8).
......@@ -2170,6 +2185,7 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
// Interesting only on Mac?
GdbMi bkpt = response.data.findChild("bkpt");
updateBreakpointDataFromOutput(id, bkpt);
//attempAdjustBreakpointLocation(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
......@@ -2608,31 +2624,29 @@ void GdbEngine::changeBreakpoint(BreakpointId id)
NeedsStop | RebuildBreakpointModel,
CB(handleBreakEnable), id);
}
/*
if (data.threadSpec() != response.bpThreadSpec)
if (data.threadSpec != response.threadSpec) {
// The only way to change this seems to be to re-set the bp completely.
//qDebug() << "FIXME: THREAD: " << data.threadSpec << response.bpThreadSpec;
FIXME
data.setThreadSpec.clear();
postCommand("-break-delete " + bpnr,
NeedsStop | RebuildBreakpointModel);
sendInsertBreakpoint(index);
continue;
qDebug() << "FIXME: THREAD: " << data.threadSpec << response.threadSpec;
//response.threadSpec.clear();
//postCommand("-break-delete " + bpnr,
// NeedsStop | RebuildBreakpointModel);
//sendInsertBreakpoint(index);
//continue;
}
*/
/*
if (data->bpAddress && data->bpCorrectedLineNumber == 0) {
if (response.address && response.correctedLineNumber == 0) {
// Prevent endless loop.
data->bpCorrectedLineNumber = -1;
BreakpointResponse r = response;
r.correctedLineNumber = -1;
breakHandler()->setResponse(id, r);
if (debuggerCore()->boolSetting(AdjustBreakpointLocations)) {
postCommand(
"info line *0x" + QByteArray::number(data->bpAddress, 16),
"info line *0x" + QByteArray::number(response.address, 16),
NeedsStop | RebuildBreakpointModel,
CB(handleInfoLine), id)
CB(handleInfoLine), id);
}
}
*/
}
void GdbEngine::removeBreakpoint(BreakpointId id)
......
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