From 68513b596a814c767e7bec28be41da58c8ba287e Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 10 Feb 2010 13:51:42 +0100 Subject: [PATCH] debugger: make MI parser accept superflous commas to reduce that burder on the producer side --- src/plugins/debugger/gdb/gdbmi.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbmi.cpp b/src/plugins/debugger/gdb/gdbmi.cpp index f6b736599a7..3a8a2ed488d 100644 --- a/src/plugins/debugger/gdb/gdbmi.cpp +++ b/src/plugins/debugger/gdb/gdbmi.cpp @@ -39,6 +39,12 @@ namespace Debugger { namespace Internal { +void skipCommas(const char *&from, const char *to) +{ + while (*from == ',' && from != to) + ++from; +} + QTextStream &operator<<(QTextStream &os, const GdbMi &mi) { return os << mi.toString(); @@ -180,6 +186,7 @@ void GdbMi::parseTuple(const char *&from, const char *to) void GdbMi::parseTuple_helper(const char *&from, const char *to) { + skipCommas(from, to); //qDebug() << "parseTuple_helper: " << QByteArray(from, to - from); m_type = Tuple; while (from < to) { @@ -193,8 +200,7 @@ void GdbMi::parseTuple_helper(const char *&from, const char *to) if (!child.isValid()) return; m_children += child; - if (*from == ',') - ++from; + skipCommas(from, to); } } @@ -204,6 +210,7 @@ void GdbMi::parseList(const char *&from, const char *to) QTC_ASSERT(*from == '[', /**/); ++from; m_type = List; + skipCommas(from, to); while (from < to) { if (*from == ']') { ++from; @@ -213,8 +220,7 @@ void GdbMi::parseList(const char *&from, const char *to) child.parseResultOrValue(from, to); if (child.isValid()) m_children += child; - if (*from == ',') - ++from; + skipCommas(from, to); } } -- GitLab