Commit ccfc4e03 authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: fix manual changing of breakpoint line numbers



Task-number: QTCREATORBUG-6178
Change-Id: I3e0a3cae0ee5df02ad8ceee7222bc667e61774c8
Reviewed-by: default avatarRobert Löhning <robert.loehning@nokia.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent b0ca5610
......@@ -1230,7 +1230,6 @@ void BreakHandler::gotoLocation(BreakpointModelId id) const
void BreakHandler::updateLineNumberFromMarker(BreakpointModelId id, int lineNumber)
{
Iterator it = m_storage.find(id);
it->response.pending = false;
BREAK_ASSERT(it != m_storage.end(), return);
// Ignore updates to the "real" line number while the debugger is
// running, as this can be triggered by moving the breakpoint to
......@@ -1241,10 +1240,6 @@ void BreakHandler::updateLineNumberFromMarker(BreakpointModelId id, int lineNumb
it->data.lineNumber += lineNumber - it->response.lineNumber;
else
it->data.lineNumber = lineNumber;
if (it->response.lineNumber != lineNumber) {
// FIXME: Should we tell gdb about the change?
it->response.lineNumber = lineNumber;
}
it->updateMarker(id);
emit layoutChanged();
}
......@@ -1335,11 +1330,10 @@ void BreakHandler::changeBreakpointData(BreakpointModelId id,
if (data == it->data)
return;
it->data = data;
if (parts == NoParts) {
it->destroyMarker();
it->updateMarker(id);
layoutChanged();
} else if (it->needsChange() && it->engine && it->state != BreakpointNew) {
it->destroyMarker();
it->updateMarker(id);
layoutChanged();
if (it->needsChange() && it->engine && it->state != BreakpointNew) {
setState(id, BreakpointChangeRequested);
scheduleSynchronization();
}
......@@ -1411,6 +1405,8 @@ bool BreakHandler::BreakpointItem::needsChange() const
return true;
if (data.command != response.command)
return true;
if (data.lineNumber != response.lineNumber)
return true;
return false;
}
......
......@@ -2713,6 +2713,18 @@ void GdbEngine::handleBreakThreadSpec(const GdbResponse &response)
insertBreakpoint(id);
}
void GdbEngine::handleBreakLineNumber(const GdbResponse &response)
{
QTC_CHECK(response.resultClass == GdbResultDone)
const BreakpointModelId id = response.cookie.value<BreakpointModelId>();
BreakHandler *handler = breakHandler();
BreakpointResponse br = handler->response(id);
br.lineNumber = handler->lineNumber(id);
handler->setResponse(id, br);
handler->notifyBreakpointNeedsReinsertion(id);
insertBreakpoint(id);
}
void GdbEngine::handleBreakIgnore(const GdbResponse &response)
{
// gdb 6.8:
......@@ -3022,6 +3034,13 @@ void GdbEngine::changeBreakpoint(BreakpointModelId id)
CB(handleBreakThreadSpec), vid);
return;
}
if (data.lineNumber != response.lineNumber) {
// The only way to change this seems to be to re-set the bp completely.
postCommand("-break-delete " + bpnr,
NeedsStop | RebuildBreakpointModel,
CB(handleBreakLineNumber), vid);
return;
}
if (data.command != response.command) {
QByteArray breakCommand = "-break-commands " + bpnr;
foreach (const QString &command, data.command.split(QLatin1String("\\n"))) {
......
......@@ -504,6 +504,7 @@ private: ////////// View & Data Stuff //////////
void handleTraceInsert2(const GdbResponse &response);
void handleBreakCondition(const GdbResponse &response);
void handleBreakThreadSpec(const GdbResponse &response);
void handleBreakLineNumber(const GdbResponse &response);
void handleWatchInsert(const GdbResponse &response);
void handleCatchInsert(const GdbResponse &response);
void handleInfoLine(const GdbResponse &response);
......
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