Commit 9c66c068 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

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

parent b4be611e
......@@ -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");
......
......@@ -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)
......
......@@ -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:
......
......@@ -975,11 +975,8 @@ bool QtDumperHelper::parseQuery(const GdbMi &contents, Debugger debugger)
// parse a query
bool QtDumperHelper::parseQuery(const char *data, Debugger debugger)
{
QByteArray fullData = data;
fullData.insert(0, '{');
fullData.append(data);
fullData.append('}');
GdbMi root(fullData);
GdbMi root;
root.fromStringMultiple(QByteArray(data));
if (!root.isValid())
return false;
return parseQuery(root, debugger);
......@@ -1475,11 +1472,8 @@ bool QtDumperHelper::parseValue(const char *data,
QList<WatchData> *l)
{
l->clear();
QByteArray fullData = data;
fullData.insert(0, '{');
fullData.append(data);
fullData.append('}');
GdbMi root(fullData);
GdbMi root;
root.fromStringMultiple(QByteArray(data));
if (!root.isValid())
return false;
gbdMiToWatchData(root, GdbMiRecursionContext(), l);
......
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