Commit 769c5d41 authored by David Schulz's avatar David Schulz
Browse files

CdbExt: Fix dump of QDateTime after latest 5.2 changes.



Change-Id: I0a64539405792b0c839230400b80699c3470dee0
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent 4fdf2fa0
......@@ -371,7 +371,8 @@ enum DumpEncoding // WatchData encoding of GDBMI values
DumpEncodingHex_Utf8_LittleEndian_WithQuotes = 9,
DumpEncodingJulianDate = 14,
DumpEncodingMillisecondsSinceMidnight = 15,
DumpEncodingJulianDateAndMillisecondsSinceMidnight = 16
DumpEncodingJulianDateAndMillisecondsSinceMidnight = 16,
DumpEncodingMillisecondsSinceEpoch = 29
};
/* Recode arrays/pointers of char*, wchar_t according to users
......@@ -1127,7 +1128,9 @@ int SymbolGroupNode::dumpNode(std::ostream &str,
encoding = DumpEncodingMillisecondsSinceMidnight;
break;
case KT_QDateTime:
encoding = DumpEncodingJulianDateAndMillisecondsSinceMidnight;
encoding = QtInfo::get(ctx).version < 5
? DumpEncodingJulianDateAndMillisecondsSinceMidnight
: DumpEncodingMillisecondsSinceEpoch;
break;
}
if (encoding) {
......
......@@ -276,6 +276,14 @@ ULONG64 SymbolGroupValue::readUnsignedValue(CIDebugDataSpaces *ds,
return readPODFromMemory<ULONG64>(ds, address, debuggeeTypeSize, defaultValue, errorMessage);
}
LONG64 SymbolGroupValue::readSignedValue(CIDebugDataSpaces *ds,
ULONG64 address, ULONG debuggeeTypeSize,
LONG64 defaultValue,
std::string *errorMessage /* = 0 */)
{
return readPODFromMemory<LONG64>(ds, address, debuggeeTypeSize, defaultValue, errorMessage);
}
// Note: sizeof(int) should always be 4 on Win32/Win64, no need to
// differentiate between host and debuggee int types. When implementing
// something like 'long', different size on host/debuggee must be taken
......@@ -2097,10 +2105,33 @@ static bool dumpQTime(const SymbolGroupValue &v, std::wostream &str)
static bool dumpQDateTime(const SymbolGroupValue &v, std::wostream &str)
{
// QDate is 64bit starting from Qt 5 which is always aligned 64bit.
const int qtVersion = QtInfo::get(v.context()).version;
const ULONG64 dateAddr = qtVersion < 5 ?
addressOfQPrivateMember(v, QPDM_qSharedData, 0) :
addressOfQPrivateMember(v, QPDM_None, 8);
if (QtInfo::get(v.context()).version == 5) {
int additionalOffset = 8 /*int64*/ + SymbolGroupValue::sizeOf("Qt::TimeSpec")
+ SymbolGroupValue::intSize() + SymbolGroupValue::sizeOf("QTimeZone");
const ULONG64 statusAddr = addressOfQPrivateMember(v, QPDM_qSharedDataPadded,
additionalOffset);
if (!statusAddr)
return false;
enum StatusFlag {
ValidDate = 0x04,
ValidTime = 0x08,
ValidDateTime = 0x10
};
const int status = SymbolGroupValue::readIntValue(v.context().dataspaces, statusAddr);
if (!(status & ValidDateTime || ((status & ValidDate) && (status & ValidTime))))
return true;
const ULONG64 msecsAddr = addressOfQPrivateMember(v, QPDM_qSharedDataPadded, 0);
if (!msecsAddr)
return false;
const LONG64 msecs = SymbolGroupValue::readSignedValue(
v.context().dataspaces, msecsAddr, 8, 0);
if (msecs)
str << msecs;
return true;
}
const ULONG64 dateAddr = addressOfQPrivateMember(v, QPDM_qSharedData, 0);
if (!dateAddr)
return false;
const int date =
......@@ -2110,7 +2141,7 @@ static bool dumpQDateTime(const SymbolGroupValue &v, std::wostream &str)
str << L"<null>";
return true;
}
const ULONG64 timeAddr = dateAddr + (qtVersion < 5 ? SymbolGroupValue::intSize() : 8);
const ULONG64 timeAddr = dateAddr + SymbolGroupValue::intSize();
const int time =
SymbolGroupValue::readIntValue(v.context().dataspaces,
timeAddr, SymbolGroupValue::intSize(), 0);
......
......@@ -145,6 +145,9 @@ public:
static ULONG64 readUnsignedValue(CIDebugDataSpaces *ds,
ULONG64 address, ULONG debuggeeTypeSize, ULONG64 defaultValue = 0,
std::string *errorMessage = 0);
static LONG64 readSignedValue(CIDebugDataSpaces *ds,
ULONG64 address, ULONG debuggeeTypeSize, LONG64 defaultValue = 0,
std::string *errorMessage = 0);
static int readIntValue(CIDebugDataSpaces *ds,
ULONG64 address, int defaultValue = 0,
std::string *errorMessage = 0);
......
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