GDB: Don't reset breakpoint when line numbers differ

When the breakpoint is put on a non-code line, it will be moved to the next
line that has debuggable code on it. When attempting to reset the
breakpoint to the originally requested line, this causes an infinite loop
of removing and re-adding the breakpoint.

Fixes: QTCREATORBUG-21611
Fixes: QTCREATORBUG-21616
Change-Id: I8943de0eae991644eb6728f491010599f62192ff
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Aaron Barany
2018-12-10 21:08:38 -08:00
parent aa70799795
commit f635af8908

View File

@@ -2488,15 +2488,17 @@ void GdbEngine::updateBreakpoint(const Breakpoint &bp)
QTC_ASSERT(state2 == BreakpointUpdateProceeding, qDebug() << state2);
DebuggerCommand cmd;
if (!bp->isPending() && requested.threadSpec != bp->threadSpec()) {
// The only way to change this seems to be to re-set the bp completely.
cmd.function = "-break-delete " + bpnr;
cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); };
} else if (!bp->isPending() && requested.lineNumber != bp->lineNumber()) {
// The only way to change this seems to be to re-set the bp completely.
cmd.function = "-break-delete " + bpnr;
cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); };
} else if (requested.command != bp->command()) {
// FIXME: See QTCREATORBUG-21611, QTCREATORBUG-21616
// if (!bp->isPending() && requested.threadSpec != bp->threadSpec()) {
// // The only way to change this seems to be to re-set the bp completely.
// cmd.function = "-break-delete " + bpnr;
// cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); };
// } else if (!bp->isPending() && requested.lineNumber != bp->lineNumber()) {
// // The only way to change this seems to be to re-set the bp completely.
// cmd.function = "-break-delete " + bpnr;
// cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); };
// } else if
if (requested.command != bp->command()) {
cmd.function = "-break-commands " + bpnr;
for (QString command : requested.command.split('\n')) {
if (!command.isEmpty()) {