diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index f7bb60320b4082af422dbddccb8ef8dab3477d46..571517488e6ecb0efb5cea0fffa31bfaa80c88aa 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -375,9 +375,16 @@ Qt::ItemFlags BreakHandler::flags(const QModelIndex &index) const // } } -static QString threadString(int spec) +QString BreakHandler::displayFromThreadSpec(int spec) { - return spec == 0 ? BreakHandler::tr("(all)") : QString::number(spec); + return spec == -1 ? BreakHandler::tr("(all)") : QString::number(spec); +} + +int BreakHandler::threadSpecFromDisplay(const QString &str) +{ + bool ok = false; + int result = str.toInt(&ok); + return ok ? result : -1; } QVariant BreakHandler::data(const QModelIndex &mi, int role) const @@ -494,11 +501,11 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const break; case 7: if (role == Qt::DisplayRole) - return threadString(orig ? data.threadSpec : response.threadSpec); + return displayFromThreadSpec(orig ? data.threadSpec : response.threadSpec); if (role == Qt::ToolTipRole) return tr("Breakpoint will only be hit in the specified thread(s)."); if (role == Qt::UserRole + 1) - return data.threadSpec; + return displayFromThreadSpec(data.threadSpec); break; } if (role == Qt::ToolTipRole) diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index 383e8b0c797796dead38ee0c3960e2e3f67a25b7..9e8c24bb0931f5fab32e39b6ad5077db69817487 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -149,6 +149,9 @@ public: void notifyBreakpointAdjusted(BreakpointId id, const BreakpointParameters &data); + static QString displayFromThreadSpec(int spec); + static int threadSpecFromDisplay(const QString &str); + private: // QAbstractItemModel implementation. int columnCount(const QModelIndex &parent) const; diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp index 0d510c0293115b88b30c7a9b2627a7dfec3ad4d0..9c4d56b9e9089b1e91e641c4d2a01c16844fd4d2 100644 --- a/src/plugins/debugger/breakpoint.cpp +++ b/src/plugins/debugger/breakpoint.cpp @@ -43,7 +43,7 @@ namespace Internal { BreakpointParameters::BreakpointParameters(BreakpointType t) : type(t), enabled(true), useFullPath(false), - ignoreCount(0), lineNumber(0), address(0), threadSpec(0) + ignoreCount(0), lineNumber(0), address(0), threadSpec(-1) {} bool BreakpointParameters::equals(const BreakpointParameters &rhs) const diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 310578d54446adb016ced6ca4dd96216b4aa47c3..f9c8f851fab429c40c3b2a1302cc233787c12821 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -141,7 +141,8 @@ void BreakpointDialog::setParameters(const BreakpointParameters &data) setParts(AllParts, data); m_ui.lineEditCondition->setText(QString::fromUtf8(data.condition)); m_ui.lineEditIgnoreCount->setText(QString::number(data.ignoreCount)); - m_ui.lineEditThreadSpec->setText(QString::number(data.threadSpec)); + m_ui.lineEditThreadSpec-> + setText(BreakHandler::displayFromThreadSpec(data.threadSpec)); } BreakpointParameters BreakpointDialog::parameters() const @@ -150,7 +151,8 @@ BreakpointParameters BreakpointDialog::parameters() const getParts(AllParts, &data); data.condition = m_ui.lineEditCondition->text().toUtf8(); data.ignoreCount = m_ui.lineEditIgnoreCount->text().toInt(); - data.threadSpec = m_ui.lineEditThreadSpec->text().toInt(); + data.threadSpec = + BreakHandler::threadSpecFromDisplay(m_ui.lineEditThreadSpec->text()); return data; } @@ -564,7 +566,8 @@ void BreakWindow::editBreakpoints(const BreakpointIds &ids) BreakHandler *handler = breakHandler(); const QString oldCondition = QString::fromLatin1(handler->condition(id)); const QString oldIgnoreCount = QString::number(handler->ignoreCount(id)); - const QString oldThreadSpec = QString::number(handler->threadSpec(id)); + const QString oldThreadSpec = + BreakHandler::displayFromThreadSpec(handler->threadSpec(id)); ui.lineEditCondition->setText(oldCondition); ui.lineEditIgnoreCount->setText(oldIgnoreCount); @@ -584,7 +587,8 @@ void BreakWindow::editBreakpoints(const BreakpointIds &ids) foreach (const BreakpointId id, ids) { handler->setCondition(id, newCondition.toLatin1()); handler->setIgnoreCount(id, newIgnoreCount.toInt()); - handler->setThreadSpec(id, newThreadSpec.toInt()); + handler->setThreadSpec(id, + BreakHandler::threadSpecFromDisplay(newThreadSpec)); } } diff --git a/src/plugins/debugger/cdb2/cdbparsehelpers.cpp b/src/plugins/debugger/cdb2/cdbparsehelpers.cpp index 82444570fddcfab5c3be7a299286d8853aee349e..78e56a3551956715351a102b451921ae950e7615 100644 --- a/src/plugins/debugger/cdb2/cdbparsehelpers.cpp +++ b/src/plugins/debugger/cdb2/cdbparsehelpers.cpp @@ -61,7 +61,7 @@ QByteArray cdbAddBreakpointCommand(const Debugger::Internal::BreakpointParameter QByteArray rc; ByteArrayInputStream str(rc); - if (bp.threadSpec > 0) + if (bp.threadSpec >= 0) str << '~' << bp.threadSpec << ' '; str << (bp.type == Debugger::Internal::Watchpoint ? "ba" : "bp"); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index a252132c6563ed9daba1487257e7576d32d1a2a6..d6e268bf548a0add825bbd04cd5b9f3741ca6600 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2486,7 +2486,7 @@ void GdbEngine::insertBreakpoint(BreakpointId id) } else if (m_gdbVersion >= 70000) { int spec = handler->threadSpec(id); cmd = "-break-insert "; - if (spec) + if (spec >= 0) cmd += "-p " + QByteArray::number(spec); cmd += " -f "; } else if (m_gdbVersion >= 60800) {