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))
|
||||
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):
|
||||
#warn("POINTER: %s" % value)
|
||||
|
@@ -1044,20 +1044,6 @@ class Dumper(DumperBase):
|
||||
return Hex2EncodedFloat8
|
||||
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):
|
||||
return typeobj.code == gdb.TYPE_CODE_REF
|
||||
|
||||
|
@@ -221,35 +221,6 @@ lldb.SBType.strip_typedefs = \
|
||||
lldb.SBType.__orig__str__ = lldb.SBType.__str__
|
||||
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):
|
||||
def __init__(self):
|
||||
DumperBase.__init__(self)
|
||||
@@ -588,18 +559,34 @@ class Dumper(DumperBase):
|
||||
def putSimpleValue(self, value, encoding = None, priority = 0):
|
||||
self.putValue(value.GetValue(), encoding, priority)
|
||||
|
||||
def tryPutArrayContents(self, typeobj, base, n):
|
||||
if not self.isSimpleType(typeobj):
|
||||
return False
|
||||
size = n * typeobj.sizeof
|
||||
self.put('childtype="%s",' % typeobj)
|
||||
self.put('addrbase="0x%x",' % int(base))
|
||||
self.put('addrstep="%d",' % typeobj.sizeof)
|
||||
self.put('arrayencoding="%s",' % simpleEncoding(typeobj))
|
||||
self.put('arraydata="')
|
||||
self.put(self.readMemory(base, size))
|
||||
self.put('",')
|
||||
return True
|
||||
def simpleEncoding(self, 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
|
||||
|
||||
def putArrayData(self, type, base, n,
|
||||
childNumChild = None, maxNumChild = 10000):
|
||||
|
Reference in New Issue
Block a user