Commit d9f89048 authored by Vlas Puhov's avatar Vlas Puhov
Browse files

Don't insert the same breakpoint multiple times while starting. Part 2.

First compare "fullname" and "line" entries and only if it fails fall
back to "original-location", as the latter can contaion literally
anything. Note that even a better solution'd be to store a full path
in the first place (if available).

BUG: 270970
parent 184e3a0b
......@@ -230,11 +230,26 @@ void BreakpointController::handleBreakpointListInitial(const GDBMI::ResultRecord
if (condition != b->condition())
continue;
QString location = mi_b["original-location"].literal();
QString location;
QString line;
if (mi_b.hasField("fullname") && mi_b.hasField("line")) {
location = unquoteExpression(mi_b["fullname"].literal());
line = mi_b["line"].literal();
if (location == b->url().pathOrUrl(KUrl::RemoveTrailingSlash) && line.toInt() - 1 == b->line()) {
updateBreakpoint = b;
} else {
kDebug() << location << ":" << line << "!=" << b->location();
}
}
if (updateBreakpoint) {
break;
}
location = mi_b["original-location"].literal();
kDebug() << "location" << location;
QRegExp rx("^(.+):(\\d+)$");
if (rx.indexIn(location) != -1) {
if (unquoteExpression(rx.cap(1)) == b->url().pathOrUrl(KUrl::RemoveTrailingSlash) && rx.cap(2).toInt()-1 == b->line()) {
if (unquoteExpression(rx.cap(1)) == b->url().pathOrUrl(KUrl::RemoveTrailingSlash) && rx.cap(2).toInt() - 1 == b->line()) {
updateBreakpoint = b;
} else {
kDebug() << "!=" << b->location();
......
......@@ -1434,6 +1434,7 @@ void GdbTest::testRemoteDebugInsertBreakpoint()
TestDebugSession *session = new TestDebugSession;
breakpoints()->addCodeBreakpoint(debugeeFileName, 29);
breakpoints()->addCodeBreakpoint(debugeeFileName, 35);
QTemporaryFile shellScript(QDir::currentPath()+"/shellscript");
......
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