Commit b9834e40 authored by hjk's avatar hjk
Browse files

Debugger: Move special argv display to DumperBase and use for LLDB, too



Change-Id: Ie1913f5a5062d230e02a4f1738ca14bd6cebc55c
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 0eae6967
......@@ -1024,6 +1024,33 @@ class DumperBase:
base += 1
f.write("e\n")
def putSpecialArgv(self, value):
"""
Special handling for char** argv.
"""
n = 0
p = value
# p is 0 for "optimized out" cases. Or contains rubbish.
try:
if not self.isNull(p):
while not self.isNull(p.dereference()) and n <= 100:
p += 1
n += 1
except:
pass
with TopLevelItem(self, 'local.argv'):
self.put('iname="local.argv",name="argv",')
self.putItemCount(n, 100)
self.putType('char **')
self.putNumChild(n)
if self.currentIName in self.expandedINames:
p = value
with Children(self, n):
for i in xrange(n):
self.putSubItem(i, p.dereference())
p += 1
def extractPointer(self, thing, offset = 0):
if isinstance(thing, int):
bytes = self.extractBlob(thing, self.ptrSize()).toBytes()
......
......@@ -565,37 +565,8 @@ class Dumper(DumperBase):
with OutputSafer(self):
self.anonNumber = -1
typeobj = value.type.unqualified()
typeName = str(typeobj)
# Special handling for char** argv.
if typeobj.code == PointerCode \
and item.iname == "local.argv" \
and typeName == "char **":
n = 0
p = value
# p is 0 for "optimized out" cases. Or contains rubbish.
try:
if not self.isNull(p):
while not self.isNull(p.dereference()) and n <= 100:
p += 1
n += 1
except:
pass
with TopLevelItem(self, item.iname):
self.put('iname="local.argv",name="argv",')
self.putItemCount(n, 100)
self.putType(typeName)
self.putNumChild(n)
if self.currentIName in self.expandedINames:
p = value
with Children(self, n):
for i in xrange(n):
self.putSubItem(i, p.dereference())
p += 1
continue
if item.iname == "local.argv" and str(value.type) == "char **":
self.putSpecialArgv(value)
else:
# A "normal" local variable or parameter.
with TopLevelItem(self, item.iname):
......
......@@ -1129,9 +1129,13 @@ class Dumper(DumperBase):
name += "@%s" % level
else:
shadowed[name] = 1
with SubItem(self, name):
self.put('iname="%s",' % self.currentIName)
self.putItem(value)
if name == "argv" and value.GetType().GetName() == "char **":
self.putSpecialArgv(value)
else:
with SubItem(self, name):
self.put('iname="%s",' % self.currentIName)
self.putItem(value)
# 'watchers':[{'id':'watch.0','exp':'23'},...]
#if not self.dummyValue is None:
......
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