mi parser: don't construct dummy tuples, but parse lists directly

This commit is contained in:
Oswald Buddenhagen
2009-11-30 15:17:34 +01:00
parent b4be611e1b
commit 9c66c06820
4 changed files with 15 additions and 15 deletions

View File

@@ -155,9 +155,8 @@ static bool parseConsoleStream(const GdbResponse &response, GdbMi *contents)
out = out.left(out.lastIndexOf('"'));
// optimization: dumper output never needs real C unquoting
out.replace('\\', "");
out = "dummy={" + out + "}";
contents->fromString(out);
contents->fromStringMultiple(out);
//qDebug() << "CONTENTS" << contents->toString(true);
return contents->isValid();
}
@@ -3584,8 +3583,8 @@ void GdbEngine::handleStackFrame(const GdbResponse &response)
<< out.left(pos);
out = out.mid(pos);
}
GdbMi all("[" + out + "]");
//GdbMi all(out);
GdbMi all;
all.fromStringMultiple(out);
//qDebug() << "\n\n\nALL: " << all.toString() << "\n";
GdbMi locals = all.findChild("locals");

View File

@@ -348,6 +348,13 @@ void GdbMi::fromString(const QByteArray &ba)
parseResultOrValue(from, to);
}
void GdbMi::fromStringMultiple(const QByteArray &ba)
{
const char *from = ba.constBegin();
const char *to = ba.constEnd();
parseTuple_helper(from, to);
}
GdbMi GdbMi::findChild(const char *name) const
{
for (int i = 0; i < m_children.size(); ++i)

View File

@@ -91,7 +91,6 @@ class GdbMi
{
public:
GdbMi() : m_type(Invalid) {}
explicit GdbMi(const QByteArray &str) { fromString(str); }
QByteArray m_name;
QByteArray m_data;
@@ -126,6 +125,7 @@ public:
QByteArray toString(bool multiline = false, int indent = 0) const;
void fromString(const QByteArray &str);
void fromStringMultiple(const QByteArray &str);
void setStreamOutput(const QByteArray &name, const QByteArray &content);
private: