Commit 749beeeb authored by hjk's avatar hjk

debugger: gracefully handle optimized out values

parent 3a3b289f
...@@ -359,7 +359,8 @@ class FrameCommand(gdb.Command): ...@@ -359,7 +359,8 @@ class FrameCommand(gdb.Command):
# Locals # Locals
# #
for item in listOfLocals(): for item in listOfLocals():
#warn("ITEM %s: " % item.value) #warn("ITEM NAME %s: " % item.name)
#warn("ITEM VALUE %s: " % item.value)
type = item.value.type type = item.value.type
if type.code == gdb.TYPE_CODE_PTR \ if type.code == gdb.TYPE_CODE_PTR \
...@@ -391,11 +392,24 @@ class FrameCommand(gdb.Command): ...@@ -391,11 +392,24 @@ class FrameCommand(gdb.Command):
else: else:
# A "normal" local variable or parameter # A "normal" local variable or parameter
d.beginHash() try:
d.put('iname="%s",' % item.iname) addr = cleanAddress(item.value.address)
d.put('addr="%s",' % cleanAddress(item.value.address)) d.beginHash()
d.safePutItemHelper(item) d.put('iname="%s",' % item.iname)
d.endHash() d.put('addr="%s",' % addr)
d.safePutItemHelper(item)
d.endHash()
except AttributeError:
# thrown by cleanAddreas with message
# "'NoneType' object has no attribute 'cast'"
# for optimized-out values
d.beginHash()
d.put('iname="%s",' % item.iname)
d.put('name="%s",' % item.name)
d.put('addr="<optimized out>",')
d.put('value="<optimized out>",')
d.put('type="%s"' % item.value.type)
d.endHash()
d.pushOutput() d.pushOutput()
locals = d.safeoutput locals = d.safeoutput
......
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