forked from qt-creator/qt-creator
Debugger: Consolidate special type lookups in *bridge.py
Change-Id: If5f255a32f1cfde925345f4a33e6fa4de01d10d2 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -467,6 +467,21 @@ class DumperBase:
|
||||
self.cachedFormats[typeName] = stripped
|
||||
return stripped
|
||||
|
||||
def intType(self):
|
||||
result = self.lookupType('int')
|
||||
self.intType = lambda: result
|
||||
return result
|
||||
|
||||
def charType(self):
|
||||
result = self.lookupType('char')
|
||||
self.intType = lambda: result
|
||||
return result
|
||||
|
||||
def ptrSize(self):
|
||||
result = self.lookupType('void*').size()
|
||||
self.ptrSize = lambda: result
|
||||
return result
|
||||
|
||||
# Hex decoding operating on str, return str.
|
||||
def hexdecode(self, s):
|
||||
if sys.version_info[0] == 2:
|
||||
@@ -626,15 +641,6 @@ class DumperBase:
|
||||
def stringData(self, value):
|
||||
return self.byteArrayDataHelper(self.extractPointer(value))
|
||||
|
||||
def encodeStdString(self, value, limit = 0):
|
||||
data = value["_M_dataplus"]["_M_p"]
|
||||
sizePtr = data.cast(self.sizetType().pointer())
|
||||
size = int(sizePtr[-3])
|
||||
alloc = int(sizePtr[-2])
|
||||
self.check(0 <= size and size <= alloc and alloc <= 100*1000*1000)
|
||||
elided, shown = self.computeLimit(size, limit)
|
||||
return self.readMemory(data, shown)
|
||||
|
||||
def extractTemplateArgument(self, typename, position):
|
||||
level = 0
|
||||
skipSpace = False
|
||||
|
||||
@@ -614,28 +614,6 @@ class Dumper(DumperBase):
|
||||
return int(str(arg))
|
||||
return self.fromNativeType(arg)
|
||||
|
||||
def intType(self):
|
||||
self.cachedIntType = self.lookupType('int')
|
||||
self.intType = lambda: self.cachedIntType
|
||||
return self.cachedIntType
|
||||
|
||||
def charType(self):
|
||||
return self.lookupType('char')
|
||||
|
||||
def sizetType(self):
|
||||
return self.lookupType('size_t')
|
||||
|
||||
def charPtrType(self):
|
||||
return self.lookupType('char*')
|
||||
|
||||
def voidPtrType(self):
|
||||
return self.lookupType('void*')
|
||||
|
||||
def ptrSize(self):
|
||||
self.cachedPtrSize = self.lookupNativeType('void*').sizeof
|
||||
self.ptrSize = lambda: self.cachedPtrSize
|
||||
return self.cachedPtrSize
|
||||
|
||||
def pokeValue(self, value):
|
||||
# Allocates inferior memory and copies the contents of value.
|
||||
# Returns a pointer to the copy.
|
||||
|
||||
@@ -124,11 +124,6 @@ class Dumper(DumperBase):
|
||||
self.dyldLibraryPath = None
|
||||
self.dyldFrameworkPath = None
|
||||
|
||||
self.charType_ = None
|
||||
self.intType_ = None
|
||||
self.sizetType_ = None
|
||||
self.charPtrType_ = None
|
||||
self.voidPtrType_ = None
|
||||
self.isShuttingDown_ = False
|
||||
self.isInterrupting_ = False
|
||||
self.interpreterBreakpointResolvers = []
|
||||
@@ -525,26 +520,6 @@ class Dumper(DumperBase):
|
||||
self.qtVersionAndNamespace()
|
||||
return self.qtVersionAndNamespace()[1]
|
||||
|
||||
def ptrSize(self):
|
||||
return self.target.GetAddressByteSize()
|
||||
|
||||
def intType(self):
|
||||
return self.fromNativeType(self.target.GetBasicType(lldb.eBasicTypeInt))
|
||||
|
||||
def charType(self):
|
||||
return self.fromNativeType(self.target.GetBasicType(lldb.eBasicTypeChar))
|
||||
|
||||
def charPtrType(self):
|
||||
return self.fromNativeType(self.target.GetBasicType(lldb.eBasicTypeChar).GetPointerType())
|
||||
|
||||
def voidPtrType(self):
|
||||
return self.fromNativeType(self.target.GetBasicType(lldb.eBasicVoid).GetPointerType())
|
||||
|
||||
def sizetType(self):
|
||||
if self.sizetType_ is None:
|
||||
self.sizetType_ = self.lookupType('size_t')
|
||||
return self.fromNativeType(self.sizetType)
|
||||
|
||||
def handleCommand(self, command):
|
||||
result = lldb.SBCommandReturnObject()
|
||||
self.debugger.GetCommandInterpreter().HandleCommand(command, result)
|
||||
|
||||
@@ -242,7 +242,7 @@ if False:
|
||||
def qdump__tree(d, value):
|
||||
count = value["count"]
|
||||
entries = value["entries"]
|
||||
base = value["base"].cast(d.charPtrType())
|
||||
base = value["base"].pointer()
|
||||
d.putItemCount(count)
|
||||
d.putNumChild(count)
|
||||
if d.isExpanded():
|
||||
@@ -366,7 +366,7 @@ def qdump__WTF__String(d, value):
|
||||
|
||||
# WTF::StringImpl* -> WTF::StringImpl -> sizeof(WTF::StringImpl)
|
||||
offsetToData = data.type.target().size()
|
||||
bufferPtr = data.cast(d.charPtrType()) + offsetToData
|
||||
bufferPtr = data.pointer() + offsetToData
|
||||
|
||||
is8Bit = data['m_is8Bit']
|
||||
charSize = 1
|
||||
|
||||
Reference in New Issue
Block a user