debugger: enable latin1 or utf8 char[] display

This commit is contained in:
hjk
2011-04-18 16:15:39 +02:00
parent 25ecf5b9c5
commit fea6bcd944
2 changed files with 21 additions and 6 deletions

View File

@@ -1643,11 +1643,19 @@ class Dumper:
return
if value.type.code == gdb.TYPE_CODE_ARRAY:
self.putType(realtype)
self.putAddress(value.address)
self.putNumChild(1)
baseptr = value.cast(realtype.pointer())
self.putValue("%s" % baseptr)
if format == 0 or format == 1:
# Explicityly requested Latin1 or UTF-8 formatting.
f = select(format == 0, Hex2EncodedLatin1, Hex2EncodedUtf8)
self.putAddress(value.address)
self.putType(realtype)
self.putValue(encodeCharArray(value, 100), f)
self.putNumChild(1)
else:
self.putType(realtype)
self.putAddress(value.address)
self.putValue("%s" % baseptr)
self.putNumChild(1)
if self.isExpanded(item):
charptr = lookupType("unsigned char").pointer()
addr1 = (baseptr+1).cast(charptr)

View File

@@ -702,9 +702,16 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
<< tr("UTF8 string")
<< tr("UTF16 string")
<< tr("UCS4 string");
if (data.type.contains("char[") || data.type.contains("char ["))
return QStringList()
<< tr("Latin1 string")
<< tr("UTF8 string");
if (isIntType(data.type) && data.type != "bool")
return QStringList() << tr("decimal") << tr("hexadecimal")
<< tr("binary") << tr("octal");
return QStringList()
<< tr("decimal")
<< tr("hexadecimal")
<< tr("binary")
<< tr("octal");
// Hack: Compensate for namespaces.
QString type = data.type;
int pos = type.indexOf("::Q");