Commit c5dd58fc authored by hjk's avatar hjk
Browse files

Debugger: Use tested offsets in QDateTime dumper



Task-number: QTCREATORBUG-11164
Change-Id: I9184e2f14baa3d3d649839f25088dbd0a01a3496
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent ba2ee4a5
......@@ -27,6 +27,7 @@
#
#############################################################################
import platform
from dumper import *
......@@ -246,20 +247,27 @@ def qdump__QDateTime(d, value):
# This relies on the Qt4/Qt5 internal structure layout:
# {sharedref(4), ...
base = d.extractPointer(value)
is32bit = d.is32bit()
if qtVersion >= 0x050200:
dateBase = base + d.ptrSize() # Only QAtomicInt, but will be padded.
# qint64 m_msecs
# Qt::TimeSpec m_spec
# int m_offsetFromUtc
# QTimeZone m_timeZone // only #ifndef QT_BOOTSTRAPPED
# StatusFlags m_status
status = d.extractInt(dateBase + 16 + d.ptrSize())
if platform.system() in ("Microsoft", "Windows"):
msecsOffset = 8
specOffset = 16
offsetFromUtcOffset = 20
timeZoneOffset = 24
statusOffset = 28 if is32bit else 32
else:
msecsOffset = 4 if is32bit else 8
specOffset = 12 if is32bit else 16
offsetFromUtcOffset = 16 if is32bit else 20
timeZoneOffset = 20 if is32bit else 24
statusOffset = 24 if is32bit else 32
status = d.extractInt(base + statusOffset)
if int(status & 0x0c == 0x0c): # ValidDate and ValidTime
isValid = True
msecs = d.extractInt64(dateBase)
spec = d.extractInt(dateBase + 8)
offset = d.extractInt(dateBase + 12)
tzp = d.extractPointer(dateBase + 16)
msecs = d.extractInt64(base + msecsOffset)
spec = d.extractInt(base + specOffset)
offset = d.extractInt(base + offsetFromUtcOffset)
tzp = d.extractPointer(base + timeZoneOffset)
if tzp == 0:
tz = ""
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment