diff options
author | David Schulz <david.schulz@qt.io> | 2017-02-21 12:18:24 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2017-02-23 05:55:46 +0000 |
commit | bb05b5ff11af1d29a21b3c930be84a65bae63568 (patch) | |
tree | e409f5841ee6abd264a778ac59715847458ae4ae | |
parent | 2276845ed83a9a0425655246f9713efc9061f290 (diff) | |
download | qt-creator-bb05b5ff11af1d29a21b3c930be84a65bae63568.tar.gz |
Debugger: Pass Qt type info version to the debugger protocol
Fixes Qt 5.8 QDateTime python dumper.
Change-Id: If6fab7bf3ea63372ef01942bcaa2121eb9c2b6db
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | share/qtcreator/debugger/qttypes.py | 4 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerprotocol.cpp | 13 | ||||
-rw-r--r-- | tests/auto/debugger/tst_dumpers.cpp | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index 8e32a19c81..d1c5582a08 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -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: diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index 45288cb83c..c5c4105a81 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -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) { diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 68822dbc09..919a58ce0e 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -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() |