forked from qt-creator/qt-creator
Debugger: Make char * displayable in separate windows
Task-number: QTCREATORBUG-7313 Change-Id: I8d475dd94a48e7a1d5efe4c2c0d90cb6bdf9b3e2 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -53,8 +53,10 @@ Ucs4StringFormat, \
|
||||
Array10Format, \
|
||||
Array100Format, \
|
||||
Array1000Format, \
|
||||
Array10000Format \
|
||||
= range(100, 110)
|
||||
Array10000Format, \
|
||||
SeparateLatin1StringFormat, \
|
||||
SeparateUtf8StringFormat \
|
||||
= range(100, 112)
|
||||
|
||||
def hasPlot():
|
||||
fileName = "/usr/bin/gnuplot"
|
||||
@@ -781,6 +783,14 @@ class DumperBase:
|
||||
self.put('",')
|
||||
return True
|
||||
|
||||
def putDisplay(self, format, value = None, cmd = None):
|
||||
self.put('editformat="%s",' % format)
|
||||
if cmd is None:
|
||||
if not value is None:
|
||||
self.put('editvalue="%s",' % value)
|
||||
else:
|
||||
self.put('editvalue="%s|%s",' % (cmd, value))
|
||||
|
||||
def putFormattedPointer(self, value):
|
||||
#warn("POINTER: %s" % value)
|
||||
if self.isNull(value):
|
||||
@@ -832,20 +842,24 @@ class DumperBase:
|
||||
self.putItem(value.dereference())
|
||||
return
|
||||
|
||||
if format == Latin1StringFormat:
|
||||
if format == Latin1StringFormat or format == SeparateLatin1StringFormat:
|
||||
# Explicitly requested Latin1 formatting.
|
||||
limit = self.displayStringLimit if format == Latin1StringFormat else 1000000
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(value, "unsigned char", self.displayStringLimit)
|
||||
(elided, data) = self.encodeCArray(value, "unsigned char", limit)
|
||||
self.putValue(data, Hex2EncodedLatin1, elided=elided)
|
||||
self.putNumChild(0)
|
||||
self.putDisplay((StopDisplay if format == Latin1StringFormat else DisplayLatin1String), data)
|
||||
return
|
||||
|
||||
if format == Utf8StringFormat:
|
||||
if format == Utf8StringFormat or format == SeparateUtf8StringFormat:
|
||||
# Explicitly requested UTF-8 formatting.
|
||||
limit = self.displayStringLimit if format == Utf8StringFormat else 1000000
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(value, "unsigned char", self.displayStringLimit)
|
||||
(elided, data) = self.encodeCArray(value, "unsigned char", limit)
|
||||
self.putValue(data, Hex2EncodedUtf8, elided=elided)
|
||||
self.putNumChild(0)
|
||||
self.putDisplay((StopDisplay if format == Utf8StringFormat else DisplayUtf8String), data)
|
||||
return
|
||||
|
||||
if format == Local8BitStringFormat:
|
||||
|
||||
@@ -904,14 +904,6 @@ class Dumper(DumperBase):
|
||||
self.putValue("0x%x" % value.cast(
|
||||
self.lookupType("unsigned long")), None, -1)
|
||||
|
||||
def putDisplay(self, format, value = None, cmd = None):
|
||||
self.put('editformat="%s",' % format)
|
||||
if cmd is None:
|
||||
if not value is None:
|
||||
self.put('editvalue="%s",' % value)
|
||||
else:
|
||||
self.put('editvalue="%s|%s",' % (cmd, value))
|
||||
|
||||
def isExpandedSubItem(self, component):
|
||||
iname = "%s.%s" % (self.currentIName, component)
|
||||
#warn("IS EXPANDED: %s in %s" % (iname, self.expandedINames))
|
||||
|
||||
@@ -1551,6 +1551,17 @@ class Dumper(DumperBase):
|
||||
self.passExceptions = int(args['passexceptions'])
|
||||
if 'watchers' in args:
|
||||
self.currentWatchers = args['watchers']
|
||||
if 'typeformats' in args:
|
||||
for f in args['typeformats'].split(','):
|
||||
pos = f.find("=")
|
||||
if pos != -1:
|
||||
typeName = self.hexdecode(f[0:pos])
|
||||
self.typeformats[typeName] = int(f[pos+1:])
|
||||
if 'formats' in args:
|
||||
for f in args['formats'].split(','):
|
||||
pos = f.find("=")
|
||||
if pos != -1:
|
||||
self.formats[f[0:pos]] = int(f[pos+1:])
|
||||
self.reportVariables(args)
|
||||
|
||||
def disassemble(self, args):
|
||||
|
||||
@@ -619,8 +619,7 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||
data.editvalue = mi.data();
|
||||
|
||||
mi = item["editformat"];
|
||||
if (mi.isValid())
|
||||
data.editformat = mi.toInt();
|
||||
data.editformat = mi.toInt();
|
||||
|
||||
mi = item["typeformats"];
|
||||
if (mi.isValid())
|
||||
|
||||
@@ -1262,6 +1262,8 @@ QString WatchModel::nameForFormat(int format)
|
||||
case Array100Format: return msgArrayFormat(100);
|
||||
case Array1000Format: return msgArrayFormat(1000);
|
||||
case Array10000Format: return msgArrayFormat(10000);
|
||||
case SeparateLatin1StringFormat: return tr("Latin1 String in Separate Window");
|
||||
case SeparateUtf8StringFormat: return tr("UTF-8 String in Separate Window");
|
||||
case DecimalIntegerFormat: return tr("Decimal Integer");
|
||||
case HexadecimalIntegerFormat: return tr("Hexadecimal Integer");
|
||||
case BinaryIntegerFormat: return tr("Binary Integer");
|
||||
@@ -1296,7 +1298,9 @@ TypeFormatList WatchModel::typeFormatList(const WatchData &data) const
|
||||
if (data.origaddr || isPointerType(data.type)) {
|
||||
formats.append(RawFormat);
|
||||
formats.append(Latin1StringFormat);
|
||||
formats.append(SeparateLatin1StringFormat);
|
||||
formats.append(Utf8StringFormat);
|
||||
formats.append(SeparateUtf8StringFormat);
|
||||
formats.append(Local8BitStringFormat);
|
||||
formats.append(Utf16StringFormat);
|
||||
formats.append(Ucs4StringFormat);
|
||||
|
||||
@@ -62,6 +62,9 @@ enum DisplayFormat
|
||||
Array1000Format,
|
||||
Array10000Format,
|
||||
|
||||
SeparateLatin1StringFormat,
|
||||
SeparateUtf8StringFormat,
|
||||
|
||||
|
||||
// Values above 200 refer to format solely handled in the WatchHandler code
|
||||
ArtificialFormatBase = 200,
|
||||
|
||||
Reference in New Issue
Block a user