debugger: improve robustness in the presence of outdated debug information

This commit is contained in:
hjk
2010-07-07 10:55:49 +02:00
parent e077d2609c
commit 7eedfb72bc

View File

@@ -600,7 +600,11 @@ def isNull(p):
# for invalid char *, as their "contents" is being examined
#s = str(p)
#return s == "0x0" or s.startswith("0x0 ")
return p.cast(lookupType("void").pointer()) == 0
try:
# Can fail with: "RuntimeError: Cannot access memory at address 0x5"
return p.cast(lookupType("void").pointer()) == 0
except:
return False
movableTypes = set([
"QBrush", "QBitArray", "QByteArray",
@@ -981,11 +985,14 @@ class FrameCommand(gdb.Command):
# Special handling for char** argv.
n = 0
p = item.value
# p is 0 for "optimized out" cases.
if not isNull(p):
while not isNull(p.dereference()) and n <= 100:
p += 1
n += 1
# p is 0 for "optimized out" cases. Or contains rubbish.
try:
if not isNull(p):
while not isNull(p.dereference()) and n <= 100:
p += 1
n += 1
except:
pass
with SubItem(d):
d.put('iname="%s",' % item.iname)