Commit bb05b5ff authored by David Schulz's avatar David Schulz

Debugger: Pass Qt type info version to the debugger protocol

Fixes Qt 5.8 QDateTime python dumper.

Change-Id: If6fab7bf3ea63372ef01942bcaa2121eb9c2b6db
Reviewed-by: default avatarhjk <hjk@qt.io>
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 2276845e
......@@ -317,7 +317,7 @@ def qdump__QDateTime(d, value):
spec = (status & 0x30) >> 4
isValid = True
d.putValue('%s/%s/%s/%s/%s' % (msecs, spec, offsetFromUtc, timeZone, status),
d.putValue('%s/%s/%s/%s/%s/%s' % (msecs, spec, offsetFromUtc, timeZone, status, tiVersion),
'datetimeinternal')
else:
if d.isWindowsTarget():
......@@ -344,7 +344,7 @@ def qdump__QDateTime(d, value):
else:
idBase = tzp + 2 * d.ptrSize() # [QSharedData] + [vptr]
elided, tz = d.encodeByteArrayHelper(d.extractPointer(idBase), limit=100)
d.putValue('%s/%s/%s/%s/%s' % (msecs, spec, offset, tz, status),
d.putValue('%s/%s/%s/%s/%s/%s' % (msecs, spec, offset, tz, status, 0),
'datetimeinternal')
else:
# This relies on the Qt4/Qt5 internal structure layout:
......
......@@ -512,7 +512,7 @@ static QTime timeFromData(int ms)
}
// Stolen and adapted from qdatetime.cpp
static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time)
static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time, int tiVersion)
{
enum {
SECS_PER_DAY = 86400,
......@@ -554,8 +554,8 @@ static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time)
ds = msecs;
}
*date = (status & NullDate) ? QDate() : QDate::fromJulianDay(jd);
*time = (status & NullTime) ? QTime() : QTime::fromMSecsSinceStartOfDay(ds);
*date = ((status & NullDate) && tiVersion < 14) ? QDate() : QDate::fromJulianDay(jd);
*time = ((status & NullTime) && tiVersion < 14) ? QTime() : QTime::fromMSecsSinceStartOfDay(ds);
}
QString decodeData(const QString &ba, const QString &encoding)
......@@ -671,6 +671,7 @@ QString decodeData(const QString &ba, const QString &encoding)
int p1 = ba.indexOf('/', p0 + 1);
int p2 = ba.indexOf('/', p1 + 1);
int p3 = ba.indexOf('/', p2 + 1);
int p4 = ba.indexOf('/', p3 + 1);
qint64 msecs = ba.left(p0).toLongLong();
++p0;
......@@ -680,11 +681,13 @@ QString decodeData(const QString &ba, const QString &encoding)
++p2;
QByteArray timeZoneId = QByteArray::fromHex(ba.mid(p2, p3 - p2).toUtf8());
++p3;
int status = ba.mid(p3).toInt();
int status = ba.mid(p3, p4 - p3).toInt();
++p4;
int tiVersion = ba.mid(p4).toInt();
QDate date;
QTime time;
getDateTime(msecs, status, &date, &time);
getDateTime(msecs, status, &date, &time, tiVersion);
QDateTime dateTime;
if (spec == Qt::OffsetFromUTC) {
......
......@@ -1831,8 +1831,8 @@ void tst_Dumpers::dumper_data()
+ CheckType("t1.(SystemLocale)", "@QString") % Optional()
+ Check("dt0", "(invalid)", "@QDateTime")
//+ Check("dt1", Value4("Tue Jan 1 13:15:32 1980"), "@QDateTime")
//+ Check("dt1", Value5("Tue Jan 1 13:15:32 1980 GMT"), "@QDateTime")
+ Check("dt1", Value4("Tue Jan 1 13:15:32 1980"), "@QDateTime")
+ Check("dt1", Value5("Tue Jan 1 13:15:32 1980 GMT"), "@QDateTime")
+ Check("dt1.(ISO)",
"\"1980-01-01T13:15:32Z\"", "@QString") % Optional()
+ CheckType("dt1.(Locale)", "@QString") % Optional()
......
Markdown is supported
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