Commit 0cd06f55 authored by hjk's avatar hjk

debugger: don't hard code typeformats except for ints and strings

parent 8ebe4e90
......@@ -575,14 +575,13 @@ class FrameCommand(gdb.Command):
module = sys.modules[__name__]
self.dumpers = {}
if useFancy == -1:
output = "dumpers=["
if False:
dumpers = ""
typeformats = ""
for key, value in module.__dict__.items():
if key.startswith("qdump__"):
if output != "dumpers=[":
output += ","
output += '"' + key[7:] + '"'
output += "],"
dumpers += '"' + key[7:] + '",'
output = "dumpers=[%s]," % dumpers
#output += "qtversion=[%d,%d,%d]"
#output += "qtversion=[4,6,0],"
output += "namespace=\"%s\"," % qtNamespace()
......
......@@ -392,6 +392,7 @@ def qdump__QImage(d, item):
d.putValue("(%dx%d)" % (d_ptr["width"], d_ptr["height"]))
bits = d_ptr["data"]
nbytes = d_ptr["nbytes"]
d.putField("typeformats", "Normal,Displayed");
d.putNumChild(0)
#d.putNumChild(1)
if d.isExpanded(item):
......@@ -401,12 +402,12 @@ def qdump__QImage(d, item):
d.putType(" ");
d.putNumChild(0)
d.putValue("size: %s bytes" % nbytes);
#d.putField("valuetooltipencoded", "6")
#d.putField("valuetooltip", encodeCharArray(bits, nbytes))
d.endHash()
d.endChildren()
format = d.itemFormat(item)
if format == 1:
if format == 0:
d.putField("editformat", 0) # Magic marker for "delete widget"
elif format == 1:
if False:
# 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.
......@@ -429,10 +430,8 @@ def qdump__QImage(d, item):
(filename, cleanAddress(p), cleanAddress(p + nbytes)))
d.putField("editformat", 3) # Magic marker for external "QImage" data.
d.beginItem("editvalue")
d.put(" %d" % int(d_ptr["width"]))
d.put(" %d" % int(d_ptr["height"]))
d.put(" %d" % int(d_ptr["format"]))
d.put(" %s" % filename)
d.put(" %d %d %d %s" % (d_ptr["width"], d_ptr["height"],
d_ptr["format"], filename))
d.endItem()
......
......@@ -3369,14 +3369,15 @@ void GdbEngine::handleChildren(const WatchData &data0, const GdbMi &item,
mi = item.findChild("editformat");
if (mi.isValid())
data.editformat = mi.data().toInt();
mi = item.findChild("typeformats");
if (mi.isValid())
data.typeFormats = QString::fromUtf8(mi.data());
setWatchDataValue(data, item.findChild("value"),
item.findChild("valueencoded").data().toInt());
setWatchDataAddress(data, item.findChild("addr"));
setWatchDataExpression(data, item.findChild("exp"));
setWatchDataSAddress(data, item.findChild("saddr"));
setWatchDataValueToolTip(data, item.findChild("valuetooltip"),
item.findChild("valuetooltipencoded").data().toInt());
setWatchDataValueEnabled(data, item.findChild("valueenabled"));
setWatchDataValueEditable(data, item.findChild("valueeditable"));
setWatchDataChildCount(data, item.findChild("numchild"));
......
......@@ -108,6 +108,7 @@ public:
////////////////////////////////////////////////////////////////////
WatchData::WatchData() :
editformat(0),
hasChildren(false),
generation(-1),
valueEnabled(true),
......@@ -818,6 +819,8 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
return m_handler->m_expandedINames.contains(data.iname);
case TypeFormatListRole:
if (!data.typeFormats.isEmpty())
return data.typeFormats.split(',');
if (isIntType(data.type))
return QStringList() << tr("decimal") << tr("hexadecimal")
<< tr("binary") << tr("octal");
......@@ -828,10 +831,6 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
<< tr("UTF8 string")
<< tr("UTF16 string")
<< tr("UCS4 string");
if (data.type.endsWith(QLatin1String("QImage")))
return QStringList()
<< tr("normal")
<< tr("displayed");
break;
case TypeFormatRole:
......@@ -1255,9 +1254,7 @@ void WatchHandler::insertData(const WatchData &data)
QTC_ASSERT(model, return);
MODEL_DEBUG("NOTHING NEEDED: " << data.toString());
model->insertData(data);
if (!data.editvalue.isEmpty())
showEditValue(data);
showEditValue(data);
}
}
......@@ -1352,8 +1349,10 @@ static void swapEndian(char *d, int nchar)
void WatchHandler::showEditValue(const WatchData &data)
{
QWidget *w = m_editWindows.value(data.iname);
if (data.editformat == 0x1 || data.editformat == 0x3) {
if (data.editformat == 0x0) {
m_editWindows.remove(data.iname);
delete w;
} else if (data.editformat == 0x1 || data.editformat == 0x3) {
// QImage
if (!w) {
w = new QLabel;
......
......@@ -127,6 +127,7 @@ public:
QByteArray editvalue; // Displayed value
int editformat; // Format of displayed value
QString valuetooltip; // Tooltip in value column
QString typeFormats; // Selection of formats of displayed value
QString type; // Type for further processing
QString displayedType;// Displayed type (optional)
QByteArray variable; // Name of internal Gdb variable if created
......
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