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