forked from qt-creator/qt-creator
mi parser: don't construct dummy tuples, but parse lists directly
This commit is contained in:
@@ -155,9 +155,8 @@ static bool parseConsoleStream(const GdbResponse &response, GdbMi *contents)
|
|||||||
out = out.left(out.lastIndexOf('"'));
|
out = out.left(out.lastIndexOf('"'));
|
||||||
// optimization: dumper output never needs real C unquoting
|
// optimization: dumper output never needs real C unquoting
|
||||||
out.replace('\\', "");
|
out.replace('\\', "");
|
||||||
out = "dummy={" + out + "}";
|
|
||||||
|
|
||||||
contents->fromString(out);
|
contents->fromStringMultiple(out);
|
||||||
//qDebug() << "CONTENTS" << contents->toString(true);
|
//qDebug() << "CONTENTS" << contents->toString(true);
|
||||||
return contents->isValid();
|
return contents->isValid();
|
||||||
}
|
}
|
||||||
@@ -3584,8 +3583,8 @@ void GdbEngine::handleStackFrame(const GdbResponse &response)
|
|||||||
<< out.left(pos);
|
<< out.left(pos);
|
||||||
out = out.mid(pos);
|
out = out.mid(pos);
|
||||||
}
|
}
|
||||||
GdbMi all("[" + out + "]");
|
GdbMi all;
|
||||||
//GdbMi all(out);
|
all.fromStringMultiple(out);
|
||||||
|
|
||||||
//qDebug() << "\n\n\nALL: " << all.toString() << "\n";
|
//qDebug() << "\n\n\nALL: " << all.toString() << "\n";
|
||||||
GdbMi locals = all.findChild("locals");
|
GdbMi locals = all.findChild("locals");
|
||||||
|
@@ -348,6 +348,13 @@ void GdbMi::fromString(const QByteArray &ba)
|
|||||||
parseResultOrValue(from, to);
|
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
|
GdbMi GdbMi::findChild(const char *name) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_children.size(); ++i)
|
for (int i = 0; i < m_children.size(); ++i)
|
||||||
|
@@ -91,7 +91,6 @@ class GdbMi
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GdbMi() : m_type(Invalid) {}
|
GdbMi() : m_type(Invalid) {}
|
||||||
explicit GdbMi(const QByteArray &str) { fromString(str); }
|
|
||||||
|
|
||||||
QByteArray m_name;
|
QByteArray m_name;
|
||||||
QByteArray m_data;
|
QByteArray m_data;
|
||||||
@@ -126,6 +125,7 @@ public:
|
|||||||
|
|
||||||
QByteArray toString(bool multiline = false, int indent = 0) const;
|
QByteArray toString(bool multiline = false, int indent = 0) const;
|
||||||
void fromString(const QByteArray &str);
|
void fromString(const QByteArray &str);
|
||||||
|
void fromStringMultiple(const QByteArray &str);
|
||||||
void setStreamOutput(const QByteArray &name, const QByteArray &content);
|
void setStreamOutput(const QByteArray &name, const QByteArray &content);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -975,11 +975,8 @@ bool QtDumperHelper::parseQuery(const GdbMi &contents, Debugger debugger)
|
|||||||
// parse a query
|
// parse a query
|
||||||
bool QtDumperHelper::parseQuery(const char *data, Debugger debugger)
|
bool QtDumperHelper::parseQuery(const char *data, Debugger debugger)
|
||||||
{
|
{
|
||||||
QByteArray fullData = data;
|
GdbMi root;
|
||||||
fullData.insert(0, '{');
|
root.fromStringMultiple(QByteArray(data));
|
||||||
fullData.append(data);
|
|
||||||
fullData.append('}');
|
|
||||||
GdbMi root(fullData);
|
|
||||||
if (!root.isValid())
|
if (!root.isValid())
|
||||||
return false;
|
return false;
|
||||||
return parseQuery(root, debugger);
|
return parseQuery(root, debugger);
|
||||||
@@ -1475,11 +1472,8 @@ bool QtDumperHelper::parseValue(const char *data,
|
|||||||
QList<WatchData> *l)
|
QList<WatchData> *l)
|
||||||
{
|
{
|
||||||
l->clear();
|
l->clear();
|
||||||
QByteArray fullData = data;
|
GdbMi root;
|
||||||
fullData.insert(0, '{');
|
root.fromStringMultiple(QByteArray(data));
|
||||||
fullData.append(data);
|
|
||||||
fullData.append('}');
|
|
||||||
GdbMi root(fullData);
|
|
||||||
if (!root.isValid())
|
if (!root.isValid())
|
||||||
return false;
|
return false;
|
||||||
gbdMiToWatchData(root, GdbMiRecursionContext(), l);
|
gbdMiToWatchData(root, GdbMiRecursionContext(), l);
|
||||||
|
Reference in New Issue
Block a user