Commit 3c379418 authored by hjk's avatar hjk

Debugger: Make accessing value of invalid pointers more robust

LLDB on Linux did not like a plain toInteger() in some cases.

Change-Id: I4fb640df52218a3df04f3ce5092eb5fbc8b5acd5
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 6fb131de
......@@ -1107,10 +1107,11 @@ class DumperBase:
typeName = str(value.type)
if self.isBadPointer(value):
(dereferencable, pointerValue) = self.pointerInfo(value)
if not dereferencable:
# Failure to dereference a pointer should at least
# show the value of a pointer.
self.putValue(self.cleanAddress(value))
self.putValue(self.cleanAddress(pointerValue))
self.putType(typeName)
self.putNumChild(0)
return
......
......@@ -536,13 +536,13 @@ class Dumper(DumperBase):
except:
return None
def isBadPointer(self, value):
def pointerInfo(self, value):
try:
target = value.dereference()
target.is_optimized_out # Access test.
return False
return (True, toInteger(value))
except:
return True
return (False, toInteger(value))
def makeValue(self, typeobj, init):
typename = "::" + self.stripClassTag(str(typeobj));
......
......@@ -364,9 +364,10 @@ class Dumper(DumperBase):
#self.warn(" -> %s" % result)
return result
def isBadPointer(self, value):
def pointerInfo(self, value):
# -> (dereferencable, address)
target = value.dereference()
return target.GetError().Fail()
return (target.GetError().Success(), value.GetValueAsUnsigned())
def makeValue(self, type, *args):
thread = self.currentThread()
......
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