forked from qt-creator/qt-creator
debugger: make "threadspec" an int instead of a bytearray
This commit is contained in:
@@ -255,7 +255,7 @@ void BreakHandler::saveBreakpoints()
|
|||||||
map.insert(_("condition"), data.condition);
|
map.insert(_("condition"), data.condition);
|
||||||
if (data.ignoreCount)
|
if (data.ignoreCount)
|
||||||
map.insert(_("ignorecount"), data.ignoreCount);
|
map.insert(_("ignorecount"), data.ignoreCount);
|
||||||
if (!data.threadSpec.isEmpty())
|
if (data.threadSpec)
|
||||||
map.insert(_("threadspec"), data.threadSpec);
|
map.insert(_("threadspec"), data.threadSpec);
|
||||||
if (!data.enabled)
|
if (!data.enabled)
|
||||||
map.insert(_("disabled"), _("1"));
|
map.insert(_("disabled"), _("1"));
|
||||||
@@ -294,7 +294,7 @@ void BreakHandler::loadBreakpoints()
|
|||||||
data.ignoreCount = v.toString().toInt();
|
data.ignoreCount = v.toString().toInt();
|
||||||
v = map.value(_("threadspec"));
|
v = map.value(_("threadspec"));
|
||||||
if (v.isValid())
|
if (v.isValid())
|
||||||
data.threadSpec = v.toString().toLatin1();
|
data.threadSpec = v.toString().toInt();
|
||||||
v = map.value(_("funcname"));
|
v = map.value(_("funcname"));
|
||||||
if (v.isValid())
|
if (v.isValid())
|
||||||
data.functionName = v.toString();
|
data.functionName = v.toString();
|
||||||
@@ -375,6 +375,11 @@ Qt::ItemFlags BreakHandler::flags(const QModelIndex &index) const
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString threadString(int spec)
|
||||||
|
{
|
||||||
|
return spec == 0 ? BreakHandler::tr("(all)") : QString::number(spec);
|
||||||
|
}
|
||||||
|
|
||||||
QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|
QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|
||||||
{
|
{
|
||||||
static const QString empty = QString(QLatin1Char('-'));
|
static const QString empty = QString(QLatin1Char('-'));
|
||||||
@@ -488,11 +493,8 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|
|||||||
return data.ignoreCount;
|
return data.ignoreCount;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole)
|
||||||
if (orig)
|
return threadString(orig ? data.threadSpec : response.threadSpec);
|
||||||
return !data.threadSpec.isEmpty() ? data.threadSpec : tr("(all)");
|
|
||||||
return !response.threadSpec.isEmpty() ? response.threadSpec : tr("(all)");
|
|
||||||
}
|
|
||||||
if (role == Qt::ToolTipRole)
|
if (role == Qt::ToolTipRole)
|
||||||
return tr("Breakpoint will only be hit in the specified thread(s).");
|
return tr("Breakpoint will only be hit in the specified thread(s).");
|
||||||
if (role == Qt::UserRole + 1)
|
if (role == Qt::UserRole + 1)
|
||||||
@@ -538,7 +540,7 @@ PROPERTY(bool, useFullPath, setUseFullPath)
|
|||||||
PROPERTY(QString, fileName, setFileName)
|
PROPERTY(QString, fileName, setFileName)
|
||||||
PROPERTY(QString, functionName, setFunctionName)
|
PROPERTY(QString, functionName, setFunctionName)
|
||||||
PROPERTY(BreakpointType, type, setType)
|
PROPERTY(BreakpointType, type, setType)
|
||||||
PROPERTY(QByteArray, threadSpec, setThreadSpec)
|
PROPERTY(int, threadSpec, setThreadSpec)
|
||||||
PROPERTY(QByteArray, condition, setCondition)
|
PROPERTY(QByteArray, condition, setCondition)
|
||||||
GETTER(int, lineNumber)
|
GETTER(int, lineNumber)
|
||||||
PROPERTY(quint64, address, setAddress)
|
PROPERTY(quint64, address, setAddress)
|
||||||
@@ -745,10 +747,10 @@ void BreakHandler::notifyBreakpointAdjusted(BreakpointId id,
|
|||||||
|
|
||||||
void BreakHandler::notifyBreakpointNeedsReinsertion(BreakpointId id)
|
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);
|
Iterator it = m_storage.find(id);
|
||||||
QTC_ASSERT(it != m_storage.end(), return);
|
QTC_ASSERT(it != m_storage.end(), return);
|
||||||
it->state = BreakpointNew;
|
it->state = BreakpointInsertRequested;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakHandler::removeBreakpoint(BreakpointId id)
|
void BreakHandler::removeBreakpoint(BreakpointId id)
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ public:
|
|||||||
void setCondition(BreakpointId, const QByteArray &condition);
|
void setCondition(BreakpointId, const QByteArray &condition);
|
||||||
int ignoreCount(BreakpointId id) const;
|
int ignoreCount(BreakpointId id) const;
|
||||||
void setIgnoreCount(BreakpointId, const int &count);
|
void setIgnoreCount(BreakpointId, const int &count);
|
||||||
QByteArray threadSpec(BreakpointId id) const;
|
int threadSpec(BreakpointId id) const;
|
||||||
void setThreadSpec(BreakpointId, const QByteArray &spec);
|
void setThreadSpec(BreakpointId, const int&spec);
|
||||||
QString fileName(BreakpointId id) const;
|
QString fileName(BreakpointId id) const;
|
||||||
void setFileName(BreakpointId, const QString &fileName);
|
void setFileName(BreakpointId, const QString &fileName);
|
||||||
QString functionName(BreakpointId id) const;
|
QString functionName(BreakpointId id) const;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Internal {
|
|||||||
|
|
||||||
BreakpointParameters::BreakpointParameters(BreakpointType t)
|
BreakpointParameters::BreakpointParameters(BreakpointType t)
|
||||||
: type(t), enabled(true), useFullPath(false),
|
: 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
|
bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public:
|
|||||||
int ignoreCount; // Ignore count associated with breakpoint.
|
int ignoreCount; // Ignore count associated with breakpoint.
|
||||||
int lineNumber; // Line in source file.
|
int lineNumber; // Line in source file.
|
||||||
quint64 address; // Address for watchpoints.
|
quint64 address; // Address for watchpoints.
|
||||||
QByteArray threadSpec; // Thread specification.
|
int threadSpec; // Thread specification.
|
||||||
QString functionName;
|
QString functionName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ void BreakpointDialog::setParameters(const BreakpointParameters &data)
|
|||||||
setParts(AllParts, data);
|
setParts(AllParts, data);
|
||||||
m_ui.lineEditCondition->setText(QString::fromUtf8(data.condition));
|
m_ui.lineEditCondition->setText(QString::fromUtf8(data.condition));
|
||||||
m_ui.lineEditIgnoreCount->setText(QString::number(data.ignoreCount));
|
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
|
BreakpointParameters BreakpointDialog::parameters() const
|
||||||
@@ -150,7 +150,7 @@ BreakpointParameters BreakpointDialog::parameters() const
|
|||||||
getParts(AllParts, &data);
|
getParts(AllParts, &data);
|
||||||
data.condition = m_ui.lineEditCondition->text().toUtf8();
|
data.condition = m_ui.lineEditCondition->text().toUtf8();
|
||||||
data.ignoreCount = m_ui.lineEditIgnoreCount->text().toInt();
|
data.ignoreCount = m_ui.lineEditIgnoreCount->text().toInt();
|
||||||
data.threadSpec = m_ui.lineEditThreadSpec->text().toUtf8();
|
data.threadSpec = m_ui.lineEditThreadSpec->text().toInt();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,7 +564,7 @@ void BreakWindow::editBreakpoints(const BreakpointIds &ids)
|
|||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
const QString oldCondition = QString::fromLatin1(handler->condition(id));
|
const QString oldCondition = QString::fromLatin1(handler->condition(id));
|
||||||
const QString oldIgnoreCount = QString::number(handler->ignoreCount(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.lineEditCondition->setText(oldCondition);
|
||||||
ui.lineEditIgnoreCount->setText(oldIgnoreCount);
|
ui.lineEditIgnoreCount->setText(oldIgnoreCount);
|
||||||
@@ -584,16 +584,15 @@ void BreakWindow::editBreakpoints(const BreakpointIds &ids)
|
|||||||
foreach (const BreakpointId id, ids) {
|
foreach (const BreakpointId id, ids) {
|
||||||
handler->setCondition(id, newCondition.toLatin1());
|
handler->setCondition(id, newCondition.toLatin1());
|
||||||
handler->setIgnoreCount(id, newIgnoreCount.toInt());
|
handler->setIgnoreCount(id, newIgnoreCount.toInt());
|
||||||
handler->setThreadSpec(id, newThreadSpec.toLatin1());
|
handler->setThreadSpec(id, newThreadSpec.toInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::associateBreakpoint(const BreakpointIds &ids, int threadId)
|
void BreakWindow::associateBreakpoint(const BreakpointIds &ids, int threadId)
|
||||||
{
|
{
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
QByteArray spec = QByteArray::number(threadId);
|
|
||||||
foreach (const BreakpointId id, ids)
|
foreach (const BreakpointId id, ids)
|
||||||
handler->setThreadSpec(id, spec);
|
handler->setThreadSpec(id, threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::resizeColumnsToContents()
|
void BreakWindow::resizeColumnsToContents()
|
||||||
|
|||||||
@@ -49,12 +49,7 @@ static CdbCore::BreakPoint breakPointFromBreakPointData(const BreakpointParamete
|
|||||||
CdbCore::BreakPoint::Code ;
|
CdbCore::BreakPoint::Code ;
|
||||||
|
|
||||||
rc.address = bpd.address;
|
rc.address = bpd.address;
|
||||||
if (!bpd.threadSpec.isEmpty()) {
|
rc.threadId = bpd.threadSpec;
|
||||||
bool ok;
|
|
||||||
rc.threadId = bpd.threadSpec.toInt(&ok);
|
|
||||||
if (!ok)
|
|
||||||
qWarning("Cdb: Cannot convert breakpoint thread specification '%s'", bpd.threadSpec.constData());
|
|
||||||
}
|
|
||||||
rc.fileName = QDir::toNativeSeparators(bpd.fileName);
|
rc.fileName = QDir::toNativeSeparators(bpd.fileName);
|
||||||
rc.condition = bpd.condition;
|
rc.condition = bpd.condition;
|
||||||
rc.funcName = functionName.isEmpty() ? bpd.functionName : functionName;
|
rc.funcName = functionName.isEmpty() ? bpd.functionName : functionName;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ QByteArray cdbAddBreakpointCommand(const Debugger::Internal::BreakpointParameter
|
|||||||
QByteArray rc;
|
QByteArray rc;
|
||||||
ByteArrayInputStream str(rc);
|
ByteArrayInputStream str(rc);
|
||||||
|
|
||||||
if (!bp.threadSpec.isEmpty())
|
if (bp.threadSpec > 0)
|
||||||
str << '~' << bp.threadSpec << ' ';
|
str << '~' << bp.threadSpec << ' ';
|
||||||
|
|
||||||
str << (bp.type == Debugger::Internal::Watchpoint ? "ba" : "bp");
|
str << (bp.type == Debugger::Internal::Watchpoint ? "ba" : "bp");
|
||||||
|
|||||||
@@ -2091,7 +2091,7 @@ void GdbEngine::updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkp
|
|||||||
ba = ba.mid(1, ba.size() - 2);
|
ba = ba.mid(1, ba.size() - 2);
|
||||||
response.functionName = _(ba);
|
response.functionName = _(ba);
|
||||||
} else if (child.hasName("thread")) {
|
} else if (child.hasName("thread")) {
|
||||||
response.threadSpec = child.data();
|
response.threadSpec = child.data().toInt();
|
||||||
} else if (child.hasName("type")) {
|
} else if (child.hasName("type")) {
|
||||||
if (!child.data().contains("reakpoint")) // "breakpoint", "hw breakpoint"
|
if (!child.data().contains("reakpoint")) // "breakpoint", "hw breakpoint"
|
||||||
response.type = Watchpoint;
|
response.type = Watchpoint;
|
||||||
@@ -2337,12 +2337,11 @@ void GdbEngine::handleBreakThreadSpec(const GdbResponse &response)
|
|||||||
QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
|
QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
|
||||||
const BreakpointId id = response.cookie.toInt();
|
const BreakpointId id = response.cookie.toInt();
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
handler->notifyBreakpointChangeOk(id);
|
|
||||||
handler->notifyBreakpointNeedsReinsertion(id);
|
|
||||||
BreakpointResponse br = handler->response(id);
|
BreakpointResponse br = handler->response(id);
|
||||||
br.threadSpec = handler->threadSpec(id);
|
br.threadSpec = handler->threadSpec(id);
|
||||||
handler->setResponse(id, br);
|
handler->setResponse(id, br);
|
||||||
changeBreakpoint(id); // Maybe there's more to do.
|
handler->notifyBreakpointNeedsReinsertion(id);
|
||||||
|
insertBreakpoint(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleBreakIgnore(const GdbResponse &response)
|
void GdbEngine::handleBreakIgnore(const GdbResponse &response)
|
||||||
@@ -2377,7 +2376,6 @@ void GdbEngine::handleBreakCondition(const GdbResponse &response)
|
|||||||
// Can happen at invalid condition strings.
|
// Can happen at invalid condition strings.
|
||||||
//QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
|
//QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
|
||||||
const BreakpointId id = response.cookie.toInt();
|
const BreakpointId id = response.cookie.toInt();
|
||||||
qDebug() << "CONDITION FOR" << id;
|
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
// We just assume it was successful. Otherwise we had to parse
|
// We just assume it was successful. Otherwise we had to parse
|
||||||
// the output stream data.
|
// the output stream data.
|
||||||
@@ -2518,10 +2516,10 @@ void GdbEngine::insertBreakpoint(BreakpointId id)
|
|||||||
} else if (m_gdbAdapter->isTrkAdapter()) {
|
} else if (m_gdbAdapter->isTrkAdapter()) {
|
||||||
cmd = "-break-insert -h -f ";
|
cmd = "-break-insert -h -f ";
|
||||||
} else if (m_gdbVersion >= 70000) {
|
} else if (m_gdbVersion >= 70000) {
|
||||||
QByteArray spec = handler->threadSpec(id);
|
int spec = handler->threadSpec(id);
|
||||||
cmd = "-break-insert ";
|
cmd = "-break-insert ";
|
||||||
if (!spec.isEmpty())
|
if (spec)
|
||||||
cmd += "-p " + spec;
|
cmd += "-p " + QByteArray::number(spec);
|
||||||
cmd += " -f ";
|
cmd += " -f ";
|
||||||
} else if (m_gdbVersion >= 60800) {
|
} else if (m_gdbVersion >= 60800) {
|
||||||
// Probably some earlier version would work as well.
|
// Probably some earlier version would work as well.
|
||||||
@@ -2551,6 +2549,13 @@ void GdbEngine::changeBreakpoint(BreakpointId id)
|
|||||||
const BreakpointState state2 = handler->state(id);
|
const BreakpointState state2 = handler->state(id);
|
||||||
QTC_ASSERT(state2 == BreakpointChangeProceeding, qDebug() << state2);
|
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)) {
|
if (!data.conditionsMatch(response.condition)) {
|
||||||
postCommand("condition " + bpnr + ' ' + data.condition,
|
postCommand("condition " + bpnr + ' ' + data.condition,
|
||||||
NeedsStop | RebuildBreakpointModel,
|
NeedsStop | RebuildBreakpointModel,
|
||||||
@@ -2575,14 +2580,6 @@ void GdbEngine::changeBreakpoint(BreakpointId id)
|
|||||||
CB(handleBreakEnable), id);
|
CB(handleBreakEnable), id);
|
||||||
return;
|
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);
|
handler->notifyBreakpointChangeOk(id);
|
||||||
attemptAdjustBreakpointLocation(id);
|
attemptAdjustBreakpointLocation(id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user