Debugger: Make C array data plottable

Change-Id: Ib4519f0e64504ec0e3dccd89978acca5134b2932
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-04-01 08:32:50 +02:00
parent be24c441f5
commit d66e063165
2 changed files with 21 additions and 2 deletions

View File

@@ -948,16 +948,28 @@ class DumperBase:
else: else:
self.putValue(blob, Hex8EncodedLittleEndian) self.putValue(blob, Hex8EncodedLittleEndian)
if self.currentIName in self.expandedINames: if self.isExpanded():
try: try:
# May fail on artificial items like xmm register data. # May fail on artificial items like xmm register data.
if not self.tryPutArrayContents(p, n, innerType): #if not self.tryPutArrayContents(p, n, innerType):
with Children(self, childType=innerType, addrBase=p, addrStep=ts): with Children(self, childType=innerType, addrBase=p, addrStep=ts):
self.putFields(value) self.putFields(value)
except: except:
with Children(self, childType=innerType): with Children(self, childType=innerType):
self.putFields(value) self.putFields(value)
if hasPlot and self.isSimpleType(innerType):
show = displayFormat == ArrayPlotFormat
iname = self.currentIName
data = []
if show:
base = self.createPointerValue(p, innerType)
data = [str(base[i]) for i in range(0, n)]
matplotSend(iname, show, data)
else:
#self.putValue(self.currentValue.value + " (not plottable)")
self.putField("plottable", "0")
def cleanAddress(self, addr): def cleanAddress(self, addr):
if addr is None: if addr is None:
return "<no address>" return "<no address>"
@@ -1745,6 +1757,10 @@ class DumperBase:
self.qqEditable = {} self.qqEditable = {}
self.typeCache = {} self.typeCache = {}
if hasPlot: # Hack for generic array type. [] is used as "type" name.
self.qqDumpers['[]'] = ""
self.qqFormats['[]'] = arrayForms()
for mod in self.dumpermodules: for mod in self.dumpermodules:
m = importlib.import_module(mod) m = importlib.import_module(mod)
dic = m.__dict__ dic = m.__dict__

View File

@@ -1007,6 +1007,9 @@ DisplayFormats WatchItem::typeFormatList() const
t.replace(QLatin1Char(':'), QLatin1Char('_')); t.replace(QLatin1Char(':'), QLatin1Char('_'));
formats << watchModel()->m_reportedTypeFormats.value(t); formats << watchModel()->m_reportedTypeFormats.value(t);
if (t.contains(QLatin1Char(']')))
formats << watchModel()->m_reportedTypeFormats.value(QLatin1String("[]"));
// Fixed artificial string and pointer types. // Fixed artificial string and pointer types.
if (origaddr || isPointerType(type)) { if (origaddr || isPointerType(type)) {
formats.append(RawFormat); formats.append(RawFormat);