debugger: signal incomplete responses

This commit is contained in:
hjk
2009-01-21 11:57:14 +01:00
parent f58e1c108b
commit f93bd26a3a
2 changed files with 18 additions and 40 deletions

View File

@@ -386,7 +386,6 @@ struct QDumper
{ {
explicit QDumper(); explicit QDumper();
~QDumper(); ~QDumper();
void flush();
void checkFill(); void checkFill();
QDumper &operator<<(long c); QDumper &operator<<(long c);
QDumper &operator<<(int i); QDumper &operator<<(int i);
@@ -408,8 +407,6 @@ struct QDumper
void beginHash(); // start of data hash output void beginHash(); // start of data hash output
void endHash(); // 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 // the dumper arguments
int protocolVersion; // dumper protocol version int protocolVersion; // dumper protocol version
int token; // some token to show on success int token; // some token to show on success
@@ -428,6 +425,7 @@ struct QDumper
// internal state // internal state
bool success; // are we finished? bool success; // are we finished?
bool full;
int pos; int pos;
int extraInt[4]; int extraInt[4];
@@ -437,35 +435,16 @@ struct QDumper
QDumper::QDumper() QDumper::QDumper()
{ {
success = false; success = false;
pos = 0; full = false;
qDumpOutBuffer[0] = 'f'; // marks output as 'wrong'
pos = 1;
} }
QDumper::~QDumper() QDumper::~QDumper()
{ {
flush(); qDumpOutBuffer[pos++] = '\0';
if (success)
//char buf[30]; qDumpOutBuffer[0] = (full ? '+' : 't');
//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;
// }
} }
void QDumper::setupTemplateParameters() void QDumper::setupTemplateParameters()
@@ -558,13 +537,14 @@ QDumper &QDumper::operator<<(const void *p)
void QDumper::checkFill() void QDumper::checkFill()
{ {
if (pos >= int(sizeof(qDumpOutBuffer)) - 100) if (pos >= int(sizeof(qDumpOutBuffer)) - 100)
flush(); full = true;
} }
void QDumper::put(char c) void QDumper::put(char c)
{ {
checkFill(); checkFill();
qDumpOutBuffer[pos++] = c; if (!full)
qDumpOutBuffer[pos++] = c;
} }
void QDumper::addCommaIfNeeded() void QDumper::addCommaIfNeeded()
@@ -634,7 +614,6 @@ QDumper &QDumper::operator<<(const QString &str)
void QDumper::disarm() void QDumper::disarm()
{ {
flush();
success = true; success = true;
} }

View File

@@ -3319,11 +3319,11 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
//qDebug() << "DATA DUMPER TRIAL:" << record.toString(); //qDebug() << "DATA DUMPER TRIAL:" << record.toString();
GdbMi output = record.data.findChild("consolestreamoutput"); GdbMi output = record.data.findChild("consolestreamoutput");
QByteArray out = output.data(); 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.replace('\\', "");
out = out.left(out.lastIndexOf('"')); out = out.left(out.lastIndexOf('"'));
out = "result={" + out + "}"; out = "result={" + out + "}";
qDebug() << "OUTPUT: " << out; //qDebug() << "OUTPUT: " << out;
GdbMi contents; GdbMi contents;
contents.fromString(out); contents.fromString(out);
@@ -3339,9 +3339,8 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
m_qtVersion = 0; m_qtVersion = 0;
} }
qDebug() << "OUTPUT: " << out; //qDebug() << "CONTENTS: " << contents.toString();
qDebug() << "CONTENTS: " << contents.toString(); //qDebug() << "SIMPLE DUMPERS: " << simple.toString();
qDebug() << "SIMPLE DUMPERS: " << simple.toString();
m_availableSimpleDumpers.clear(); m_availableSimpleDumpers.clear();
foreach (const GdbMi &item, simple.children()) foreach (const GdbMi &item, simple.children())
m_availableSimpleDumpers.append(item.data()); m_availableSimpleDumpers.append(item.data());
@@ -3358,7 +3357,7 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
} else { } else {
m_dataDumperState = DataDumperAvailable; m_dataDumperState = DataDumperAvailable;
} }
qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDumpers; //qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDumpers;
} }
void GdbEngine::sendWatchParameters(const QByteArray &params0) void GdbEngine::sendWatchParameters(const QByteArray &params0)
@@ -3512,15 +3511,15 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
GdbMi output = record.data.findChild("consolestreamoutput"); GdbMi output = record.data.findChild("consolestreamoutput");
QByteArray out = output.data(); 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.replace('\\', "");
out = out.left(out.lastIndexOf('"')); out = out.left(out.lastIndexOf('"'));
out = "result={" + out + "}"; out = "result={" + out + "}";
qDebug() << "OUTPUT: " << out; //qDebug() << "OUTPUT: " << out;
GdbMi contents; GdbMi contents;
contents.fromString(out); contents.fromString(out);
qDebug() << "CONTENTS" << contents.toString(true); //qDebug() << "CONTENTS" << contents.toString(true);
if (!contents.isValid()) { if (!contents.isValid()) {
qDebug() << "INVALID"; qDebug() << "INVALID";