forked from qt-creator/qt-creator
Debugger: Move some common bridge code to dumper base
Change-Id: I9fd988c84bff5e02bc45478994f27a7bddb3358b Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -714,6 +714,19 @@ class DumperBase:
|
|||||||
warn("CANNOT CONVERT TYPE: %s" % type(addr))
|
warn("CANNOT CONVERT TYPE: %s" % type(addr))
|
||||||
return str(addr)
|
return str(addr)
|
||||||
|
|
||||||
|
def tryPutArrayContents(self, typeobj, base, n):
|
||||||
|
enc = self.simpleEncoding(typeobj)
|
||||||
|
if not enc:
|
||||||
|
return False
|
||||||
|
size = n * typeobj.sizeof;
|
||||||
|
self.put('childtype="%s",' % typeobj)
|
||||||
|
self.put('addrbase="0x%x",' % toInteger(base))
|
||||||
|
self.put('addrstep="0x%x",' % toInteger(typeobj.sizeof))
|
||||||
|
self.put('arrayencoding="%s",' % enc)
|
||||||
|
self.put('arraydata="')
|
||||||
|
self.put(self.readMemory(base, size))
|
||||||
|
self.put('",')
|
||||||
|
return True
|
||||||
|
|
||||||
def putFormattedPointer(self, value):
|
def putFormattedPointer(self, value):
|
||||||
#warn("POINTER: %s" % value)
|
#warn("POINTER: %s" % value)
|
||||||
|
@@ -1044,20 +1044,6 @@ class Dumper(DumperBase):
|
|||||||
return Hex2EncodedFloat8
|
return Hex2EncodedFloat8
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def tryPutArrayContents(self, typeobj, base, n):
|
|
||||||
enc = self.simpleEncoding(typeobj)
|
|
||||||
if not enc:
|
|
||||||
return False
|
|
||||||
size = n * typeobj.sizeof;
|
|
||||||
self.put('childtype="%s",' % typeobj)
|
|
||||||
self.put('addrbase="0x%x",' % toInteger(base))
|
|
||||||
self.put('addrstep="0x%x",' % toInteger(typeobj.sizeof))
|
|
||||||
self.put('arrayencoding="%s",' % enc)
|
|
||||||
self.put('arraydata="')
|
|
||||||
self.put(self.readMemory(base, size))
|
|
||||||
self.put('",')
|
|
||||||
return True
|
|
||||||
|
|
||||||
def isReferenceType(self, typeobj):
|
def isReferenceType(self, typeobj):
|
||||||
return typeobj.code == gdb.TYPE_CODE_REF
|
return typeobj.code == gdb.TYPE_CODE_REF
|
||||||
|
|
||||||
|
@@ -221,35 +221,6 @@ lldb.SBType.strip_typedefs = \
|
|||||||
lldb.SBType.__orig__str__ = lldb.SBType.__str__
|
lldb.SBType.__orig__str__ = lldb.SBType.__str__
|
||||||
lldb.SBType.__str__ = lldb.SBType.GetName
|
lldb.SBType.__str__ = lldb.SBType.GetName
|
||||||
|
|
||||||
def simpleEncoding(typeobj):
|
|
||||||
code = typeobj.GetTypeClass()
|
|
||||||
size = typeobj.sizeof
|
|
||||||
if code == lldb.eTypeClassBuiltin:
|
|
||||||
name = str(typeobj)
|
|
||||||
if name == "float":
|
|
||||||
return Hex2EncodedFloat4
|
|
||||||
if name == "double":
|
|
||||||
return Hex2EncodedFloat8
|
|
||||||
if name.find("unsigned") >= 0:
|
|
||||||
if size == 1:
|
|
||||||
return Hex2EncodedUInt1
|
|
||||||
if size == 2:
|
|
||||||
return Hex2EncodedUInt2
|
|
||||||
if size == 4:
|
|
||||||
return Hex2EncodedUInt4
|
|
||||||
if size == 8:
|
|
||||||
return Hex2EncodedUInt8
|
|
||||||
else:
|
|
||||||
if size == 1:
|
|
||||||
return Hex2EncodedInt1
|
|
||||||
if size == 2:
|
|
||||||
return Hex2EncodedInt2
|
|
||||||
if size == 4:
|
|
||||||
return Hex2EncodedInt4
|
|
||||||
if size == 8:
|
|
||||||
return Hex2EncodedInt8
|
|
||||||
return None
|
|
||||||
|
|
||||||
class Dumper(DumperBase):
|
class Dumper(DumperBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
DumperBase.__init__(self)
|
DumperBase.__init__(self)
|
||||||
@@ -588,18 +559,34 @@ class Dumper(DumperBase):
|
|||||||
def putSimpleValue(self, value, encoding = None, priority = 0):
|
def putSimpleValue(self, value, encoding = None, priority = 0):
|
||||||
self.putValue(value.GetValue(), encoding, priority)
|
self.putValue(value.GetValue(), encoding, priority)
|
||||||
|
|
||||||
def tryPutArrayContents(self, typeobj, base, n):
|
def simpleEncoding(self, typeobj):
|
||||||
if not self.isSimpleType(typeobj):
|
code = typeobj.GetTypeClass()
|
||||||
return False
|
size = typeobj.sizeof
|
||||||
size = n * typeobj.sizeof
|
if code == lldb.eTypeClassBuiltin:
|
||||||
self.put('childtype="%s",' % typeobj)
|
name = str(typeobj)
|
||||||
self.put('addrbase="0x%x",' % int(base))
|
if name == "float":
|
||||||
self.put('addrstep="%d",' % typeobj.sizeof)
|
return Hex2EncodedFloat4
|
||||||
self.put('arrayencoding="%s",' % simpleEncoding(typeobj))
|
if name == "double":
|
||||||
self.put('arraydata="')
|
return Hex2EncodedFloat8
|
||||||
self.put(self.readMemory(base, size))
|
if name.find("unsigned") >= 0:
|
||||||
self.put('",')
|
if size == 1:
|
||||||
return True
|
return Hex2EncodedUInt1
|
||||||
|
if size == 2:
|
||||||
|
return Hex2EncodedUInt2
|
||||||
|
if size == 4:
|
||||||
|
return Hex2EncodedUInt4
|
||||||
|
if size == 8:
|
||||||
|
return Hex2EncodedUInt8
|
||||||
|
else:
|
||||||
|
if size == 1:
|
||||||
|
return Hex2EncodedInt1
|
||||||
|
if size == 2:
|
||||||
|
return Hex2EncodedInt2
|
||||||
|
if size == 4:
|
||||||
|
return Hex2EncodedInt4
|
||||||
|
if size == 8:
|
||||||
|
return Hex2EncodedInt8
|
||||||
|
return None
|
||||||
|
|
||||||
def putArrayData(self, type, base, n,
|
def putArrayData(self, type, base, n,
|
||||||
childNumChild = None, maxNumChild = 10000):
|
childNumChild = None, maxNumChild = 10000):
|
||||||
|
Reference in New Issue
Block a user