summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/breakpoint.cpp
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2011-06-21 16:45:23 +0200
committerhjk <qthjk@ovi.com>2011-06-22 12:23:46 +0200
commit41df1fb2d3983ccd1ef9bdd2810c3b394a62d028 (patch)
tree710655c521cc2382af5610c62bac064dc16a5c43 /src/plugins/debugger/breakpoint.cpp
parenta7d8f346796cb31dc1e7129df1850d2d885a4e35 (diff)
downloadqt-creator-41df1fb2d3983ccd1ef9bdd2810c3b394a62d028.tar.gz
debugger: rewrite parser for cli sub-breakpoint notifications
Change-Id: I971a2af2534bc650e8c604a5c2dc2e1846dbb045 Reviewed-on: http://codereview.qt.nokia.com/592 Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/debugger/breakpoint.cpp')
-rw-r--r--src/plugins/debugger/breakpoint.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp
index 6b48be34c4..64995dabab 100644
--- a/src/plugins/debugger/breakpoint.cpp
+++ b/src/plugins/debugger/breakpoint.cpp
@@ -46,12 +46,36 @@ namespace Internal {
//
//////////////////////////////////////////////////////////////////
+BreakpointId::BreakpointId(const QByteArray &ba)
+{
+ int pos = ba.indexOf('.');
+ if (pos == -1) {
+ m_majorPart = ba.toInt();
+ m_minorPart = 0;
+ } else {
+ m_majorPart = ba.left(pos).toInt();
+ m_minorPart = ba.mid(pos + 1).toInt();
+ }
+}
+
QDebug operator<<(QDebug d, const BreakpointId &id)
{
d << qPrintable(id.toString());
return d;
}
+QByteArray BreakpointId::toByteArray() const
+{
+ if (!isValid())
+ return "<invalid bkpt>";
+ QByteArray ba = QByteArray::number(m_majorPart);
+ if (isMinor()) {
+ ba.append('.');
+ ba.append(QByteArray::number(m_minorPart));
+ }
+ return ba;
+}
+
QString BreakpointId::toString() const
{
if (!isValid())
@@ -199,9 +223,8 @@ QString BreakpointParameters::toString() const
BreakpointResponse::BreakpointResponse()
{
- number = 0;
- subNumber = 0;
pending = true;
+ hitCount = 0;
multiple = false;
correctedLineNumber = 0;
}
@@ -210,9 +233,7 @@ QString BreakpointResponse::toString() const
{
QString result = BreakpointParameters::toString();
QTextStream ts(&result);
- ts << " Number: " << number;
- if (subNumber)
- ts << "." << subNumber;
+ ts << " Number: " << id.toString();
if (pending)
ts << " [pending]";
if (!fullName.isEmpty())
@@ -225,6 +246,7 @@ QString BreakpointResponse::toString() const
ts << " Extra: " << extra;
if (correctedLineNumber)
ts << " CorrectedLineNumber: " << correctedLineNumber;
+ ts << " Hit: " << hitCount << " times";
ts << ' ';
return result + BreakpointParameters::toString();
}
@@ -232,12 +254,12 @@ QString BreakpointResponse::toString() const
void BreakpointResponse::fromParameters(const BreakpointParameters &p)
{
BreakpointParameters::operator=(p);
- number = 0;
- subNumber = 0;
+ id = BreakpointId();
fullName.clear();
multiple = false;
extra.clear();
correctedLineNumber = 0;
+ hitCount = 0;
}
} // namespace Internal