Commit 6e17e7a3 authored by hjk's avatar hjk
Browse files

debugger: thread 0 is valid for cdb. so use -1 as 'any' value

parent 7ef927ac
......@@ -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)
......
......@@ -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;
......
......@@ -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
......
......@@ -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));
}
}
......
......@@ -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");
......
......@@ -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) {
......
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