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:
@@ -874,6 +874,36 @@ class Dumper(DumperBase):
|
||||
except:
|
||||
return '0x%x' % address
|
||||
|
||||
def qtVersionString(self):
|
||||
try:
|
||||
return str(gdb.lookup_symbol('qVersion')[0].value()())
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
ns = self.qtNamespace()
|
||||
return str(gdb.parse_and_eval("((const char*(*)())'%sqVersion')()" % ns))
|
||||
except:
|
||||
pass
|
||||
return None
|
||||
|
||||
def extractQtVersion(self):
|
||||
try:
|
||||
# Only available with Qt 5.3+
|
||||
return int(str(gdb.parse_and_eval('((void**)&qtHookData)[2]')), 16)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
version = self.qtVersionString()
|
||||
(major, minor, patch) = version[version.find('"') + 1:version.rfind('"')].split('.')
|
||||
qtversion = 0x10000 * int(major) + 0x100 * int(minor) + int(patch)
|
||||
self.qtVersion = lambda: qtversion
|
||||
return qtversion
|
||||
except:
|
||||
# Use fallback until we have a better answer.
|
||||
return None
|
||||
|
||||
|
||||
def createSpecialBreakpoints(self, args):
|
||||
self.specialBreakpoints = []
|
||||
|
||||
|
Reference in New Issue
Block a user