forked from qt-creator/qt-creator
debugger: use symbolic constants for "Display in Seperate Window" modes
Change-Id: Iab2b918e94abddb1fb4132c27e0b5f29810d4598 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -49,7 +49,7 @@ verbosity = 1
|
|||||||
|
|
||||||
# Some "Enums"
|
# Some "Enums"
|
||||||
|
|
||||||
# Encodings
|
# Encodings. Keep that synchronized with DebuggerEncoding in watchutils.h
|
||||||
Unencoded8Bit, \
|
Unencoded8Bit, \
|
||||||
Base64Encoded8BitWithQuotes, \
|
Base64Encoded8BitWithQuotes, \
|
||||||
Base64Encoded16BitWithQuotes, \
|
Base64Encoded16BitWithQuotes, \
|
||||||
@@ -79,13 +79,15 @@ Hex2EncodedFloat4, \
|
|||||||
Hex2EncodedFloat8 \
|
Hex2EncodedFloat8 \
|
||||||
= range(27)
|
= range(27)
|
||||||
|
|
||||||
# Display modes
|
# Display modes. Keep that synchronized with DebuggerDisplay in watchutils.h
|
||||||
StopDisplay, \
|
StopDisplay, \
|
||||||
DisplayImage1, \
|
DisplayImageData, \
|
||||||
DisplayString, \
|
DisplayUtf16String, \
|
||||||
DisplayImage, \
|
DisplayImageFile, \
|
||||||
DisplayProcess \
|
DisplayProcess, \
|
||||||
= range(5)
|
DisplayLatin1String, \
|
||||||
|
DisplayUtf8String \
|
||||||
|
= range(7)
|
||||||
|
|
||||||
|
|
||||||
qqStringCutOff = 1000
|
qqStringCutOff = 1000
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ def qdump__QByteArray(d, value):
|
|||||||
if format == 1:
|
if format == 1:
|
||||||
d.putDisplay(StopDisplay)
|
d.putDisplay(StopDisplay)
|
||||||
elif format == 2:
|
elif format == 2:
|
||||||
d.putField("editformat", 5)
|
d.putField("editformat", DisplayLatin1String)
|
||||||
d.putField("editvalue", encodeByteArray(value))
|
d.putField("editvalue", encodeByteArray(value))
|
||||||
elif format == 3:
|
elif format == 3:
|
||||||
d.putField("editformat", 6)
|
d.putField("editformat", DisplayUtf8String)
|
||||||
d.putField("editvalue", encodeByteArray(value))
|
d.putField("editvalue", encodeByteArray(value))
|
||||||
if d.isExpanded():
|
if d.isExpanded():
|
||||||
d.putArrayData(lookupType("char"), data, size)
|
d.putArrayData(lookupType("char"), data, size)
|
||||||
@@ -576,7 +576,7 @@ def qdump__QImage(d, value):
|
|||||||
if False:
|
if False:
|
||||||
# Take four bytes at a time, this is critical for performance.
|
# Take four bytes at a time, this is critical for performance.
|
||||||
# In fact, even four at a time is too slow beyond 100x100 or so.
|
# In fact, even four at a time is too slow beyond 100x100 or so.
|
||||||
d.putField("editformat", 1) # Magic marker for direct "QImage" data.
|
d.putField("editformat", DisplayImageData)
|
||||||
d.put('%s="' % name)
|
d.put('%s="' % name)
|
||||||
d.put("%08x" % int(d_ptr["width"]))
|
d.put("%08x" % int(d_ptr["width"]))
|
||||||
d.put("%08x" % int(d_ptr["height"]))
|
d.put("%08x" % int(d_ptr["height"]))
|
||||||
@@ -593,7 +593,7 @@ def qdump__QImage(d, value):
|
|||||||
p = bits.cast(lookupType("unsigned char").pointer())
|
p = bits.cast(lookupType("unsigned char").pointer())
|
||||||
gdb.execute("dump binary memory %s %s %s" %
|
gdb.execute("dump binary memory %s %s %s" %
|
||||||
(filename, cleanAddress(p), cleanAddress(p + nbytes)))
|
(filename, cleanAddress(p), cleanAddress(p + nbytes)))
|
||||||
d.putDisplay(DisplayImage, " %d %d %d %s"
|
d.putDisplay(DisplayImageFile, " %d %d %d %s"
|
||||||
% (d_ptr["width"], d_ptr["height"], d_ptr["format"], filename))
|
% (d_ptr["width"], d_ptr["height"], d_ptr["format"], filename))
|
||||||
|
|
||||||
|
|
||||||
@@ -1398,7 +1398,7 @@ def qdump__QString(d, value):
|
|||||||
if format == 1:
|
if format == 1:
|
||||||
d.putDisplay(StopDisplay)
|
d.putDisplay(StopDisplay)
|
||||||
elif format == 2:
|
elif format == 2:
|
||||||
d.putField("editformat", 2)
|
d.putField("editformat", DisplayUtf16String)
|
||||||
d.putField("editvalue", encodeString(value))
|
d.putField("editvalue", encodeString(value))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1605,7 +1605,8 @@ void WatchHandler::showEditValue(const WatchData &data)
|
|||||||
if (data.editformat == 0x0) {
|
if (data.editformat == 0x0) {
|
||||||
m_model->m_editHandlers.remove(data.iname);
|
m_model->m_editHandlers.remove(data.iname);
|
||||||
delete w;
|
delete w;
|
||||||
} else if (data.editformat == 1 || data.editformat == 3) {
|
} else if (data.editformat == DisplayImageData
|
||||||
|
|| data.editformat == DisplayImageFile) {
|
||||||
// QImage
|
// QImage
|
||||||
QLabel *l = qobject_cast<QLabel *>(w);
|
QLabel *l = qobject_cast<QLabel *>(w);
|
||||||
if (!l) {
|
if (!l) {
|
||||||
@@ -1621,7 +1622,7 @@ void WatchHandler::showEditValue(const WatchData &data)
|
|||||||
int width, height, format;
|
int width, height, format;
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
uchar *bits;
|
uchar *bits;
|
||||||
if (data.editformat == 1) {
|
if (data.editformat == DisplayImageData) {
|
||||||
ba = QByteArray::fromHex(data.editvalue);
|
ba = QByteArray::fromHex(data.editvalue);
|
||||||
const int *header = (int *)(ba.data());
|
const int *header = (int *)(ba.data());
|
||||||
swapEndian(ba.data(), ba.size());
|
swapEndian(ba.data(), ba.size());
|
||||||
@@ -1629,7 +1630,7 @@ void WatchHandler::showEditValue(const WatchData &data)
|
|||||||
width = header[0];
|
width = header[0];
|
||||||
height = header[1];
|
height = header[1];
|
||||||
format = header[2];
|
format = header[2];
|
||||||
} else { // data.editformat == 3
|
} else if (data.editformat == DisplayImageFile) {
|
||||||
QTextStream ts(data.editvalue);
|
QTextStream ts(data.editvalue);
|
||||||
QString fileName;
|
QString fileName;
|
||||||
ts >> width >> height >> format >> fileName;
|
ts >> width >> height >> format >> fileName;
|
||||||
@@ -1639,20 +1640,13 @@ void WatchHandler::showEditValue(const WatchData &data)
|
|||||||
bits = (uchar*)ba.data();
|
bits = (uchar*)ba.data();
|
||||||
}
|
}
|
||||||
QImage im(bits, width, height, QImage::Format(format));
|
QImage im(bits, width, height, QImage::Format(format));
|
||||||
|
|
||||||
#if 1
|
|
||||||
// Qt bug. Enforce copy of image data.
|
|
||||||
QImage im2(im);
|
|
||||||
im.detach();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
l->setPixmap(QPixmap::fromImage(im));
|
l->setPixmap(QPixmap::fromImage(im));
|
||||||
l->resize(width, height);
|
l->resize(width, height);
|
||||||
l->show();
|
l->show();
|
||||||
} else if (data.editformat == 2
|
} else if (data.editformat == DisplayUtf16String
|
||||||
|| data.editformat == 5
|
|| data.editformat == DisplayLatin1String
|
||||||
|| data.editformat == 6) {
|
|| data.editformat == DisplayUtf16String) {
|
||||||
// Display QString in a separate widget.
|
// String data.
|
||||||
QTextEdit *t = qobject_cast<QTextEdit *>(w);
|
QTextEdit *t = qobject_cast<QTextEdit *>(w);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
delete w;
|
delete w;
|
||||||
@@ -1661,11 +1655,11 @@ void WatchHandler::showEditValue(const WatchData &data)
|
|||||||
}
|
}
|
||||||
QByteArray ba = QByteArray::fromHex(data.editvalue);
|
QByteArray ba = QByteArray::fromHex(data.editvalue);
|
||||||
QString str;
|
QString str;
|
||||||
if (data.editformat == 2) // UTF-16
|
if (data.editformat == DisplayUtf16String)
|
||||||
str = QString::fromUtf16((ushort *)ba.constData(), ba.size()/2);
|
str = QString::fromUtf16((ushort *)ba.constData(), ba.size()/2);
|
||||||
else if (data.editformat == 5) // Latin1
|
else if (data.editformat == DisplayLatin1String)
|
||||||
str = QString::fromLatin1(ba.constData(), ba.size());
|
str = QString::fromLatin1(ba.constData(), ba.size());
|
||||||
else if (data.editformat == 6) // UTF-8
|
else if (data.editformat == DisplayUtf8String)
|
||||||
str = QString::fromUtf8(ba.constData(), ba.size());
|
str = QString::fromUtf8(ba.constData(), ba.size());
|
||||||
t->setText(str);
|
t->setText(str);
|
||||||
t->resize(400, 200);
|
t->resize(400, 200);
|
||||||
|
|||||||
@@ -83,6 +83,17 @@ enum DebuggerEncoding
|
|||||||
Hex2EncodedFloat8 = 26
|
Hex2EncodedFloat8 = 26
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Keep in sync with dumper.py
|
||||||
|
enum DebuggerDisplay {
|
||||||
|
StopDisplay = 0,
|
||||||
|
DisplayImageData = 1,
|
||||||
|
DisplayUtf16String = 2,
|
||||||
|
DisplayImageFile = 3,
|
||||||
|
DisplayProcess = 4,
|
||||||
|
DisplayLatin1String = 5,
|
||||||
|
DisplayUtf8String = 6
|
||||||
|
};
|
||||||
|
|
||||||
bool isEditorDebuggable(Core::IEditor *editor);
|
bool isEditorDebuggable(Core::IEditor *editor);
|
||||||
QByteArray dotEscape(QByteArray str);
|
QByteArray dotEscape(QByteArray str);
|
||||||
QString currentTime();
|
QString currentTime();
|
||||||
|
|||||||
Reference in New Issue
Block a user