Commit 68513b59 authored by hjk's avatar hjk
Browse files

debugger: make MI parser accept superflous commas to reduce that burder on

the producer side
parent 28b0dcc4
...@@ -39,6 +39,12 @@ ...@@ -39,6 +39,12 @@
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
void skipCommas(const char *&from, const char *to)
{
while (*from == ',' && from != to)
++from;
}
QTextStream &operator<<(QTextStream &os, const GdbMi &mi) QTextStream &operator<<(QTextStream &os, const GdbMi &mi)
{ {
return os << mi.toString(); return os << mi.toString();
...@@ -180,6 +186,7 @@ void GdbMi::parseTuple(const char *&from, const char *to) ...@@ -180,6 +186,7 @@ void GdbMi::parseTuple(const char *&from, const char *to)
void GdbMi::parseTuple_helper(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); //qDebug() << "parseTuple_helper: " << QByteArray(from, to - from);
m_type = Tuple; m_type = Tuple;
while (from < to) { while (from < to) {
...@@ -193,8 +200,7 @@ void GdbMi::parseTuple_helper(const char *&from, const char *to) ...@@ -193,8 +200,7 @@ void GdbMi::parseTuple_helper(const char *&from, const char *to)
if (!child.isValid()) if (!child.isValid())
return; return;
m_children += child; m_children += child;
if (*from == ',') skipCommas(from, to);
++from;
} }
} }
...@@ -204,6 +210,7 @@ void GdbMi::parseList(const char *&from, const char *to) ...@@ -204,6 +210,7 @@ void GdbMi::parseList(const char *&from, const char *to)
QTC_ASSERT(*from == '[', /**/); QTC_ASSERT(*from == '[', /**/);
++from; ++from;
m_type = List; m_type = List;
skipCommas(from, to);
while (from < to) { while (from < to) {
if (*from == ']') { if (*from == ']') {
++from; ++from;
...@@ -213,8 +220,7 @@ void GdbMi::parseList(const char *&from, const char *to) ...@@ -213,8 +220,7 @@ void GdbMi::parseList(const char *&from, const char *to)
child.parseResultOrValue(from, to); child.parseResultOrValue(from, to);
if (child.isValid()) if (child.isValid())
m_children += child; m_children += child;
if (*from == ',') skipCommas(from, to);
++from;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment