forked from qt-creator/qt-creator
Debugger: Paddle back on the (non-)auto detection of Qt versions
It looks like there are Qt-using scenarios without easy way to have the right Qt version in the kit, Among the frequent cases where we need to distinguish Qt versions in the dumpers are the Qt5/6 container layout differences which can in some cases be detected from the currently dumped value. Use that now as the primary distinction and fall back to the previous expensive peeking only if that is needed. This also postpones any Qt version related activity until a real Qt type is encountered, i.e. does not impact non-Qt scenarios. Task-number: QTCREATORBUG-31033 Change-Id: I67b6e34c42994ad9f6e8ec8698b430b55327cf0c Reviewed-by: hjk <hjk@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -783,6 +783,54 @@ class Dumper(DumperBase):
|
||||
|
||||
self.fetchInternalFunctions = lambda: None
|
||||
|
||||
def extractQtVersion(self):
|
||||
for func in self.target.FindFunctions('qVersion'):
|
||||
name = func.GetSymbol().GetName()
|
||||
if name == None:
|
||||
continue
|
||||
if name.endswith('()'):
|
||||
name = name[:-2]
|
||||
if name.count(':') > 2:
|
||||
continue
|
||||
|
||||
#qtNamespace = name[:name.find('qVersion')]
|
||||
#self.qtNamespace = lambda: qtNamespace
|
||||
|
||||
options = lldb.SBExpressionOptions()
|
||||
res = self.target.EvaluateExpression(name + '()', options)
|
||||
|
||||
if not res.IsValid() or not res.GetType().IsPointerType():
|
||||
exp = '((const char*())%s)()' % name
|
||||
res = self.target.EvaluateExpression(exp, options)
|
||||
|
||||
if not res.IsValid() or not res.GetType().IsPointerType():
|
||||
exp = '((const char*())_Z8qVersionv)()'
|
||||
res = self.target.EvaluateExpression(exp, options)
|
||||
|
||||
if not res.IsValid() or not res.GetType().IsPointerType():
|
||||
continue
|
||||
|
||||
version = str(res)
|
||||
if version.count('.') != 2:
|
||||
continue
|
||||
|
||||
version.replace("'", '"') # Both seem possible
|
||||
version = version[version.find('"') + 1:version.rfind('"')]
|
||||
|
||||
(major, minor, patch) = version.split('.')
|
||||
qtVersion = 0x10000 * int(major) + 0x100 * int(minor) + int(patch)
|
||||
return qtVersion
|
||||
|
||||
try:
|
||||
versionValue = self.target.EvaluateExpression('qtHookData[2]').GetNonSyntheticValue()
|
||||
if versionValue.IsValid():
|
||||
return versionValue.unsigned
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def handleCommand(self, command):
|
||||
result = lldb.SBCommandReturnObject()
|
||||
self.debugger.GetCommandInterpreter().HandleCommand(command, result)
|
||||
|
||||
Reference in New Issue
Block a user