Dumper: Fix offsets for QFile members

Change-Id: I890b3f387505cf5acc8783e3dc7088515d6934cc
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2022-05-05 09:04:18 +02:00
parent 59161e22f2
commit 1346ffc159
2 changed files with 25 additions and 7 deletions

View File

@@ -656,17 +656,25 @@ def qdump__QFile(d, value):
# 9fc0965 and a373ffcd change the layout of the private structure
qtVersion = d.qtVersion()
is32bit = d.ptrSize() == 4
if qtVersion >= 0x060000:
# FIXME: values 0 are wrong. As the file name is the
# only direct member of QFilePrivate, the offsets are
# equal to sizeof(QFileDevicePrivate), the base class.
# FIXME: values 0 are wrong. As the file name is the
# only direct member of QFilePrivate, the offsets are
# equal to sizeof(QFileDevicePrivate), the base class.
if qtVersion >= 0x060300 and d.qtTypeInfoVersion() >= 22:
if d.isWindowsTarget():
if d.isMsvcTarget():
offset = 0 if is32bit else 424
else:
offset = 0 if is32bit else 424
else:
offset = 300 if is32bit else 424
elif qtVersion >= 0x060000 and d.qtTypeInfoVersion() >= 20:
if d.isWindowsTarget():
if d.isMsvcTarget():
offset = 0 if is32bit else 304
else:
offset = 0 if is32bit else 304
else:
offset = 0 if is32bit else 304
offset = 196 if is32bit else 304
elif qtVersion >= 0x050600 and d.qtTypeInfoVersion() >= 17:
# Some QRingBuffer member got removed in 8f92baf5c9
if d.isWindowsTarget():

View File

@@ -157,7 +157,17 @@ void tst_offsets::offsets_data()
const int qtVersion = QT_VERSION;
const quintptr qtTypeVersion = qtHookData[6];
if (qtTypeVersion >= 20)
if (qtTypeVersion >= 22)
#ifdef Q_OS_WIN
# ifdef Q_CC_MSVC
OFFSET_TEST(QFilePrivate, fileName) << 0 << 424;
# else // MinGW
OFFSET_TEST(QFilePrivate, fileName) << 0 << 424;
# endif
#else
OFFSET_TEST(QFilePrivate, fileName) << 300 << 424;
#endif
else if (qtTypeVersion >= 20)
#ifdef Q_OS_WIN
# ifdef Q_CC_MSVC
OFFSET_TEST(QFilePrivate, fileName) << 0 << 304;
@@ -165,7 +175,7 @@ void tst_offsets::offsets_data()
OFFSET_TEST(QFilePrivate, fileName) << 0 << 304;
# endif
#else
OFFSET_TEST(QFilePrivate, fileName) << 0 << 304;
OFFSET_TEST(QFilePrivate, fileName) << 196 << 304;
#endif
else if (qtVersion > 0x50600 && qtTypeVersion >= 17)
#ifdef Q_OS_WIN