diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp index 0a94e527b816012409cc692209235855534b5f3c..7f8f4cc8ef9fa06311233dd5b90044a466f354cd 100644 --- a/bin/gdbmacros/gdbmacros.cpp +++ b/bin/gdbmacros/gdbmacros.cpp @@ -386,7 +386,6 @@ struct QDumper { explicit QDumper(); ~QDumper(); - void flush(); void checkFill(); QDumper &operator<<(long c); QDumper &operator<<(int i); @@ -408,8 +407,6 @@ struct QDumper void beginHash(); // start of data hash output void endHash(); // start of data hash output - void write(const void *buf, int len); // raw write to stdout - // the dumper arguments int protocolVersion; // dumper protocol version int token; // some token to show on success @@ -428,6 +425,7 @@ struct QDumper // internal state bool success; // are we finished? + bool full; int pos; int extraInt[4]; @@ -437,35 +435,16 @@ struct QDumper QDumper::QDumper() { success = false; - pos = 0; + full = false; + qDumpOutBuffer[0] = 'f'; // marks output as 'wrong' + pos = 1; } QDumper::~QDumper() { - flush(); - - //char buf[30]; - //int len = qsnprintf(buf, sizeof(buf) - 1, "%d^done\n", token); - //write(buf, len); -} - -void QDumper::write(const void *buf, int len) -{ - //::fwrite(buf, len, 1, stdout); - //::fflush(stdout); -} - -void QDumper::flush() -{ - put(0); - //if (pos != 0) { - // char buf[30]; - // int len = qsnprintf(buf, sizeof(buf) - 1, "%d#%d,", token, pos); - // write(buf, len); - // write(qDumpOutBuffer, pos); - // write("\n", 1); - // pos = 0; - // } + qDumpOutBuffer[pos++] = '\0'; + if (success) + qDumpOutBuffer[0] = (full ? '+' : 't'); } void QDumper::setupTemplateParameters() @@ -558,13 +537,14 @@ QDumper &QDumper::operator<<(const void *p) void QDumper::checkFill() { if (pos >= int(sizeof(qDumpOutBuffer)) - 100) - flush(); + full = true; } void QDumper::put(char c) { checkFill(); - qDumpOutBuffer[pos++] = c; + if (!full) + qDumpOutBuffer[pos++] = c; } void QDumper::addCommaIfNeeded() @@ -634,7 +614,6 @@ QDumper &QDumper::operator<<(const QString &str) void QDumper::disarm() { - flush(); success = true; } diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index ae883d89230922d0f64642258b1abc937d6f84b2..36711c0325aaeb0919f779352b1cffca633b9bf9 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -3319,11 +3319,11 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record) //qDebug() << "DATA DUMPER TRIAL:" << record.toString(); GdbMi output = record.data.findChild("consolestreamoutput"); QByteArray out = output.data(); - out = out.mid(out.indexOf('"') + 1); + out = out.mid(out.indexOf('"') + 2); // + 1 is success marker out = out.replace('\\', ""); out = out.left(out.lastIndexOf('"')); out = "result={" + out + "}"; - qDebug() << "OUTPUT: " << out; + //qDebug() << "OUTPUT: " << out; GdbMi contents; contents.fromString(out); @@ -3339,9 +3339,8 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record) m_qtVersion = 0; } - qDebug() << "OUTPUT: " << out; - qDebug() << "CONTENTS: " << contents.toString(); - qDebug() << "SIMPLE DUMPERS: " << simple.toString(); + //qDebug() << "CONTENTS: " << contents.toString(); + //qDebug() << "SIMPLE DUMPERS: " << simple.toString(); m_availableSimpleDumpers.clear(); foreach (const GdbMi &item, simple.children()) m_availableSimpleDumpers.append(item.data()); @@ -3358,7 +3357,7 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record) } else { m_dataDumperState = DataDumperAvailable; } - qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDumpers; + //qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDumpers; } void GdbEngine::sendWatchParameters(const QByteArray ¶ms0) @@ -3512,15 +3511,15 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, GdbMi output = record.data.findChild("consolestreamoutput"); QByteArray out = output.data(); - out = out.mid(out.indexOf('"') + 1); + out = out.mid(out.indexOf('"') + 2); // +1 is the 'success marker' out = out.replace('\\', ""); out = out.left(out.lastIndexOf('"')); out = "result={" + out + "}"; - qDebug() << "OUTPUT: " << out; + //qDebug() << "OUTPUT: " << out; GdbMi contents; contents.fromString(out); - qDebug() << "CONTENTS" << contents.toString(true); + //qDebug() << "CONTENTS" << contents.toString(true); if (!contents.isValid()) { qDebug() << "INVALID";