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