From c04128675385eeb3c358691952db05311478751a Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 24 Jun 2011 16:25:30 +0200 Subject: debugger: split BreakpointIndex into plugin and debugger specific part Change-Id: I21d10cf42eb039c74475e106537b6e107d155196 Reviewed-on: http://codereview.qt.nokia.com/745 Reviewed-by: hjk --- src/plugins/debugger/breakpoint.cpp | 88 ++++++++++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 15 deletions(-) (limited to 'src/plugins/debugger/breakpoint.cpp') diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp index b78f11f17d..f2777027a8 100644 --- a/src/plugins/debugger/breakpoint.cpp +++ b/src/plugins/debugger/breakpoint.cpp @@ -42,11 +42,72 @@ namespace Internal { ////////////////////////////////////////////////////////////////// // -// BreakpointId +// BreakpointModelId // ////////////////////////////////////////////////////////////////// -BreakpointId::BreakpointId(const QByteArray &ba) +/*! + \class Debugger::Internal::ModelId + + This identifies a breakpoint in the \c BreakHandler. The + major parts are strictly increasing over time. +*/ + + +QDebug operator<<(QDebug d, const BreakpointModelId &id) +{ + d << qPrintable(id.toString()); + return d; +} + +QByteArray BreakpointModelId::toByteArray() const +{ + if (!isValid()) + return ""; + QByteArray ba = QByteArray::number(m_majorPart); + if (isMinor()) { + ba.append('.'); + ba.append(QByteArray::number(m_minorPart)); + } + return ba; +} + +QString BreakpointModelId::toString() const +{ + if (!isValid()) + return ""; + if (isMinor()) + return QString("%1.%2").arg(m_majorPart).arg(m_minorPart); + return QString::number(m_majorPart); +} + +BreakpointModelId BreakpointModelId::parent() const +{ + QTC_ASSERT(isMinor(), return BreakpointModelId()); + return BreakpointModelId(m_majorPart, 0); +} + +BreakpointModelId BreakpointModelId::child(int row) const +{ + QTC_ASSERT(isMajor(), return BreakpointModelId()); + return BreakpointModelId(m_majorPart, row + 1); +} + + +////////////////////////////////////////////////////////////////// +// +// BreakpointResponseId +// +////////////////////////////////////////////////////////////////// + +/*! + \class Debugger::Internal::BreakpointResponseId + + This is what the external debuggers use to identify a breakpoint. + It is only valid for one debugger run. +*/ + +BreakpointResponseId::BreakpointResponseId(const QByteArray &ba) { int pos = ba.indexOf('.'); if (pos == -1) { @@ -58,13 +119,13 @@ BreakpointId::BreakpointId(const QByteArray &ba) } } -QDebug operator<<(QDebug d, const BreakpointId &id) +QDebug operator<<(QDebug d, const BreakpointResponseId &id) { d << qPrintable(id.toString()); return d; } -QByteArray BreakpointId::toByteArray() const +QByteArray BreakpointResponseId::toByteArray() const { if (!isValid()) return ""; @@ -76,7 +137,7 @@ QByteArray BreakpointId::toByteArray() const return ba; } -QString BreakpointId::toString() const +QString BreakpointResponseId::toString() const { if (!isValid()) return ""; @@ -85,16 +146,16 @@ QString BreakpointId::toString() const return QString::number(m_majorPart); } -BreakpointId BreakpointId::parent() const +BreakpointResponseId BreakpointResponseId::parent() const { - QTC_ASSERT(isMinor(), return BreakpointId()); - return BreakpointId(m_majorPart, 0); + QTC_ASSERT(isMinor(), return BreakpointResponseId()); + return BreakpointResponseId(m_majorPart, 0); } -BreakpointId BreakpointId::child(int row) const +BreakpointResponseId BreakpointResponseId::child(int row) const { - QTC_ASSERT(isMajor(), return BreakpointId()); - return BreakpointId(m_majorPart, row + 1); + QTC_ASSERT(isMajor(), return BreakpointResponseId()); + return BreakpointResponseId(m_majorPart, row + 1); } ////////////////////////////////////////////////////////////////// @@ -251,8 +312,6 @@ QString BreakpointResponse::toString() const ts << " Function: " << functionName; if (multiple) ts << " Multiple: " << multiple; - if (!extra.isEmpty()) - ts << " Extra: " << extra; if (correctedLineNumber) ts << " CorrectedLineNumber: " << correctedLineNumber; ts << " Hit: " << hitCount << " times"; @@ -263,10 +322,9 @@ QString BreakpointResponse::toString() const void BreakpointResponse::fromParameters(const BreakpointParameters &p) { BreakpointParameters::operator=(p); - id = BreakpointId(); + id = BreakpointResponseId(); fullName.clear(); multiple = false; - extra.clear(); correctedLineNumber = 0; hitCount = 0; } -- cgit v1.2.1