map.insert(_("condition"), data.condition);
if (data.ignoreCount)
map.insert(_("ignorecount"), data.ignoreCount);
- if (!data.threadSpec.isEmpty())
+ if (data.threadSpec)
map.insert(_("threadspec"), data.threadSpec);
if (!data.enabled)
map.insert(_("disabled"), _("1"));
data.ignoreCount = v.toString().toInt();
v = map.value(_("threadspec"));
if (v.isValid())
- data.threadSpec = v.toString().toLatin1();
+ data.threadSpec = v.toString().toInt();
v = map.value(_("funcname"));
if (v.isValid())
data.functionName = v.toString();
// }
}
+static QString threadString(int spec)
+{
+ return spec == 0 ? BreakHandler::tr("(all)") : QString::number(spec);
+}
+
QVariant BreakHandler::data(const QModelIndex &mi, int role) const
{
static const QString empty = QString(QLatin1Char('-'));
return data.ignoreCount;
break;
case 7:
- if (role == Qt::DisplayRole) {
- if (orig)
- return !data.threadSpec.isEmpty() ? data.threadSpec : tr("(all)");
- return !response.threadSpec.isEmpty() ? response.threadSpec : tr("(all)");
- }
+ if (role == Qt::DisplayRole)
+ return threadString(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)
PROPERTY(QString, fileName, setFileName)
PROPERTY(QString, functionName, setFunctionName)
PROPERTY(BreakpointType, type, setType)
-PROPERTY(QByteArray, threadSpec, setThreadSpec)
+PROPERTY(int, threadSpec, setThreadSpec)
PROPERTY(QByteArray, condition, setCondition)
GETTER(int, lineNumber)
PROPERTY(quint64, address, setAddress)
void BreakHandler::notifyBreakpointNeedsReinsertion(BreakpointId id)
{
- QTC_ASSERT(state(id) == BreakpointInserted, qDebug() << state(id));
+ QTC_ASSERT(state(id) == BreakpointChangeProceeding, qDebug() << state(id));
Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return);
- it->state = BreakpointNew;
+ it->state = BreakpointInsertRequested;
}
void BreakHandler::removeBreakpoint(BreakpointId id)
void setCondition(BreakpointId, const QByteArray &condition);
int ignoreCount(BreakpointId id) const;
void setIgnoreCount(BreakpointId, const int &count);
- QByteArray threadSpec(BreakpointId id) const;
- void setThreadSpec(BreakpointId, const QByteArray &spec);
+ int threadSpec(BreakpointId id) const;
+ void setThreadSpec(BreakpointId, const int&spec);
QString fileName(BreakpointId id) const;
void setFileName(BreakpointId, const QString &fileName);
QString functionName(BreakpointId id) const;
BreakpointParameters::BreakpointParameters(BreakpointType t)
: type(t), enabled(true), useFullPath(false),
- ignoreCount(0), lineNumber(0), address(0)
+ ignoreCount(0), lineNumber(0), address(0), threadSpec(0)
{}
bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
int ignoreCount; // Ignore count associated with breakpoint.
int lineNumber; // Line in source file.
quint64 address; // Address for watchpoints.
- QByteArray threadSpec; // Thread specification.
+ int threadSpec; // Thread specification.
QString functionName;
};
setParts(AllParts, data);
m_ui.lineEditCondition->setText(QString::fromUtf8(data.condition));
m_ui.lineEditIgnoreCount->setText(QString::number(data.ignoreCount));
- m_ui.lineEditThreadSpec->setText(data.threadSpec);
+ m_ui.lineEditThreadSpec->setText(QString::number(data.threadSpec));
}
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().toUtf8();
+ data.threadSpec = m_ui.lineEditThreadSpec->text().toInt();
return data;
}
BreakHandler *handler = breakHandler();
const QString oldCondition = QString::fromLatin1(handler->condition(id));
const QString oldIgnoreCount = QString::number(handler->ignoreCount(id));
- const QString oldThreadSpec = QString::fromLatin1(handler->threadSpec(id));
+ const QString oldThreadSpec = QString::number(handler->threadSpec(id));
ui.lineEditCondition->setText(oldCondition);
ui.lineEditIgnoreCount->setText(oldIgnoreCount);
foreach (const BreakpointId id, ids) {
handler->setCondition(id, newCondition.toLatin1());
handler->setIgnoreCount(id, newIgnoreCount.toInt());
- handler->setThreadSpec(id, newThreadSpec.toLatin1());
+ handler->setThreadSpec(id, newThreadSpec.toInt());
}
}
void BreakWindow::associateBreakpoint(const BreakpointIds &ids, int threadId)
{
BreakHandler *handler = breakHandler();
- QByteArray spec = QByteArray::number(threadId);
foreach (const BreakpointId id, ids)
- handler->setThreadSpec(id, spec);
+ handler->setThreadSpec(id, threadId);
}
void BreakWindow::resizeColumnsToContents()
CdbCore::BreakPoint::Code ;
rc.address = bpd.address;
- if (!bpd.threadSpec.isEmpty()) {
- bool ok;
- rc.threadId = bpd.threadSpec.toInt(&ok);
- if (!ok)
- qWarning("Cdb: Cannot convert breakpoint thread specification '%s'", bpd.threadSpec.constData());
- }
+ rc.threadId = bpd.threadSpec;
rc.fileName = QDir::toNativeSeparators(bpd.fileName);
rc.condition = bpd.condition;
rc.funcName = functionName.isEmpty() ? bpd.functionName : functionName;
QByteArray rc;
ByteArrayInputStream str(rc);
- if (!bp.threadSpec.isEmpty())
+ if (bp.threadSpec > 0)
str << '~' << bp.threadSpec << ' ';
str << (bp.type == Debugger::Internal::Watchpoint ? "ba" : "bp");
ba = ba.mid(1, ba.size() - 2);
response.functionName = _(ba);
} else if (child.hasName("thread")) {
- response.threadSpec = child.data();
+ response.threadSpec = child.data().toInt();
} else if (child.hasName("type")) {
if (!child.data().contains("reakpoint")) // "breakpoint", "hw breakpoint"
response.type = Watchpoint;
QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
const BreakpointId id = response.cookie.toInt();
BreakHandler *handler = breakHandler();
- handler->notifyBreakpointChangeOk(id);
- handler->notifyBreakpointNeedsReinsertion(id);
BreakpointResponse br = handler->response(id);
br.threadSpec = handler->threadSpec(id);
handler->setResponse(id, br);
- changeBreakpoint(id); // Maybe there's more to do.
+ handler->notifyBreakpointNeedsReinsertion(id);
+ insertBreakpoint(id);
}
void GdbEngine::handleBreakIgnore(const GdbResponse &response)
// Can happen at invalid condition strings.
//QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
const BreakpointId id = response.cookie.toInt();
- qDebug() << "CONDITION FOR" << id;
BreakHandler *handler = breakHandler();
// We just assume it was successful. Otherwise we had to parse
// the output stream data.
} else if (m_gdbAdapter->isTrkAdapter()) {
cmd = "-break-insert -h -f ";
} else if (m_gdbVersion >= 70000) {
- QByteArray spec = handler->threadSpec(id);
+ int spec = handler->threadSpec(id);
cmd = "-break-insert ";
- if (!spec.isEmpty())
- cmd += "-p " + spec;
+ if (spec)
+ cmd += "-p " + QByteArray::number(spec);
cmd += " -f ";
} else if (m_gdbVersion >= 60800) {
// Probably some earlier version would work as well.
const BreakpointState state2 = handler->state(id);
QTC_ASSERT(state2 == BreakpointChangeProceeding, qDebug() << state2);
+ if (data.threadSpec != response.threadSpec) {
+ // The only way to change this seems to be to re-set the bp completely.
+ postCommand("-break-delete " + bpnr,
+ NeedsStop | RebuildBreakpointModel,
+ CB(handleBreakThreadSpec), id);
+ return;
+ }
if (!data.conditionsMatch(response.condition)) {
postCommand("condition " + bpnr + ' ' + data.condition,
NeedsStop | RebuildBreakpointModel,
CB(handleBreakEnable), id);
return;
}
- if (data.threadSpec != response.threadSpec) {
- // The only way to change this seems to be to re-set the bp completely.
- postCommand("-break-delete " + bpnr,
- NeedsStop | RebuildBreakpointModel,
- CB(handleBreakThreadSpec), id);
- return;
- }
-
handler->notifyBreakpointChangeOk(id);
attemptAdjustBreakpointLocation(id);
}