Commit ee5fb31f authored by hjk's avatar hjk

debugger: re-start work on image dumper

parent 82f6061a
......@@ -219,7 +219,7 @@ QT_END_NAMESPACE
Q_DECL_EXPORT char qDumpInBuffer[10000];
// The output buffer.
Q_DECL_EXPORT char qDumpOutBuffer[100000];
Q_DECL_EXPORT char qDumpOutBuffer[1000000];
namespace {
......@@ -1206,7 +1206,37 @@ static void qDumpQImage(QDumper &d)
const QImage &im = *reinterpret_cast<const QImage *>(d.data);
P(d, "value", "(" << im.width() << "x" << im.height() << ")");
P(d, "type", NS"QImage");
P(d, "numchild", "1");
if (d.dumpChildren) {
d << ",children=[";
d.beginHash();
P(d, "name", "key");
P(d, "type", NS "QImageData");
P(d, "addr", d.data);
d.endHash();
}
d.disarm();
#else
Q_UNUSED(d);
#endif
}
static void qDumpQImageData(QDumper &d)
{
#ifdef QT_GUI_LIB
const QImage &im = *reinterpret_cast<const QImage *>(d.data);
const QByteArray ba(QByteArray::fromRawData((const char*)im.bits(), im.numBytes()));
P(d, "type", NS"QImageData");
P(d, "numchild", "0");
#if 1
P(d, "value", "<hover here>");
P(d, "valuetooltipencoded", "1");
P(d, "valuetooltipsize", ba.size());
P(d, "valuetooltip", ba);
#else
P(d, "valueencoded", "1");
P(d, "value", ba);
#endif
d.disarm();
#else
Q_UNUSED(d);
......@@ -2560,6 +2590,8 @@ static void handleProtocolVersion2and3(QDumper & d)
case 'I':
if (isEqual(type, "QImage"))
qDumpQImage(d);
else if (isEqual(type, "QImageData"))
qDumpQImageData(d);
break;
case 'L':
if (isEqual(type, "QList"))
......@@ -2691,6 +2723,7 @@ void *qDumpObjectData440(
"\""NS"QHash\","
"\""NS"QHashNode\","
"\""NS"QImage\","
"\""NS"QImageData\","
"\""NS"QLinkedList\","
"\""NS"QList\","
"\""NS"QLocale\","
......
......@@ -252,8 +252,8 @@ void DebuggerOutputWindow::showOutput(const QString &prefix, const QString &outp
foreach (QString line, output.split("\n")) {
// FIXME: QTextEdit asserts on really long lines...
const int n = 3000;
if (line.size() > n)
line = line.left(n) + " [...] <cut off>";
//if (line.size() > n)
// line = line.left(n) + " [...] <cut off>";
m_combinedText->appendPlainText(prefix + line);
}
QTextCursor cursor = m_combinedText->textCursor();
......
......@@ -2776,10 +2776,12 @@ static void setWatchDataEditValue(WatchData &data, const GdbMi &mi)
data.editvalue = mi.data();
}
static void setWatchDataValueToolTip(WatchData &data, const GdbMi &mi)
static void setWatchDataValueToolTip(WatchData &data, const GdbMi &mi,
int encoding = 0)
{
qDebug() << "TOOLTIP: " << mi.data().size() << "ENC:" << encoding;
if (mi.isValid())
data.setValueToolTip(_(mi.data()));
data.setValueToolTip(decodeData(mi.data(), encoding));
}
static void setWatchDataChildCount(WatchData &data, const GdbMi &mi)
......@@ -3375,7 +3377,8 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
setWatchDataAddress(data, contents.findChild("addr"));
setWatchDataSAddress(data, contents.findChild("saddr"));
setWatchDataChildCount(data, contents.findChild("numchild"));
setWatchDataValueToolTip(data, contents.findChild("valuetooltip"));
setWatchDataValueToolTip(data, contents.findChild("valuetooltip"),
contents.findChild("valuetooltipencoded").data().toInt());
setWatchDataValueDisabled(data, contents.findChild("valuedisabled"));
setWatchDataEditValue(data, contents.findChild("editvalue"));
if (qq->watchHandler()->isDisplayedIName(data.iname)) {
......@@ -3422,7 +3425,8 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
item.findChild("valueencoded").data().toInt());
setWatchDataAddress(data1, item.findChild("addr"));
setWatchDataSAddress(data1, item.findChild("saddr"));
setWatchDataValueToolTip(data1, item.findChild("valuetooltip"));
setWatchDataValueToolTip(data1, item.findChild("valuetooltip"),
contents.findChild("valuetooltipencoded").data().toInt());
setWatchDataValueDisabled(data1, item.findChild("valuedisabled"));
if (!qq->watchHandler()->isExpandedIName(data1.iname))
data1.setChildrenUnneeded();
......@@ -3722,7 +3726,7 @@ void GdbEngine::handleVarListChildrenHelper(const GdbMi &item,
} else if (exp == "staticMetaObject") {
// && item.findChild("type").data() == "const QMetaObject")
// FIXME: Namespaces?
// { do nothing } FIXME: make coinfigurable?
// { do nothing } FIXME: make configurable?
// special "clever" hack to avoid clutter in the GUI.
// I am not sure this is a good idea...
} else {
......
......@@ -247,6 +247,8 @@ template <class Streamable>
QString WatchData::toToolTip() const
{
if (!valuetooltip.isEmpty())
return QString::number(valuetooltip.size());
QString res;
QTextStream str(&res);
str << "<html><body><table>";
......
......@@ -1090,6 +1090,7 @@ int main(int argc, char *argv[])
QStringList list;
list << "aaa" << "bbb" << "cc";
testQImage();
testNoArgumentName(1, 2, 3);
testIO();
testHidden();
......
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