forked from qt-creator/qt-creator
cdbext: Generate values for QDate, QTime, QDateTime
... in the watchdata via flags. Change-Id: I4664807713cc7747216de5abaabf30011921ab4c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
@@ -364,7 +364,10 @@ enum DumpEncoding // WatchData encoding of GDBMI values
|
|||||||
DumpEncodingHex_Ucs4_LittleEndian_WithQuotes = 3,
|
DumpEncodingHex_Ucs4_LittleEndian_WithQuotes = 3,
|
||||||
DumpEncodingBase64_Utf16 = 4,
|
DumpEncodingBase64_Utf16 = 4,
|
||||||
DumpEncodingHex_Latin1_WithQuotes = 6,
|
DumpEncodingHex_Latin1_WithQuotes = 6,
|
||||||
DumpEncodingHex_Utf8_LittleEndian_WithQuotes = 9
|
DumpEncodingHex_Utf8_LittleEndian_WithQuotes = 9,
|
||||||
|
DumpEncodingJulianDate = 14,
|
||||||
|
DumpEncodingMillisecondsSinceMidnight = 15,
|
||||||
|
DumpEncodingJulianDateAndMillisecondsSinceMidnight = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Recode arrays/pointers of char*, wchar_t according to users
|
/* Recode arrays/pointers of char*, wchar_t according to users
|
||||||
@@ -1110,7 +1113,20 @@ int SymbolGroupNode::dumpNode(std::ostream &str,
|
|||||||
|
|
||||||
// Shall it be recoded?
|
// Shall it be recoded?
|
||||||
int encoding = 0;
|
int encoding = 0;
|
||||||
if (dumpParameters.recode(t, aFullIName, ctx, addr, &value, &encoding)) {
|
switch (knownType(t, 0)) {
|
||||||
|
case KT_QDate:
|
||||||
|
encoding = DumpEncodingJulianDate;
|
||||||
|
break;
|
||||||
|
case KT_QTime:
|
||||||
|
encoding = DumpEncodingMillisecondsSinceMidnight;
|
||||||
|
break;
|
||||||
|
case KT_QDateTime:
|
||||||
|
encoding = DumpEncodingJulianDateAndMillisecondsSinceMidnight;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (encoding) {
|
||||||
|
str << ",valueencoded=\"" << encoding << "\",value=\"" << gdbmiWStringFormat(value) <<'"';
|
||||||
|
} else if (dumpParameters.recode(t, aFullIName, ctx, addr, &value, &encoding)) {
|
||||||
str << ",valueencoded=\"" << encoding
|
str << ",valueencoded=\"" << encoding
|
||||||
<< "\",value=\"" << gdbmiWStringFormat(value) <<'"';
|
<< "\",value=\"" << gdbmiWStringFormat(value) <<'"';
|
||||||
} else { // As is: ASCII or base64?
|
} else { // As is: ASCII or base64?
|
||||||
|
|||||||
@@ -972,31 +972,6 @@ static inline void getDateFromJulianDay(unsigned julianDay, int *year, int *mont
|
|||||||
*day = d;
|
*day = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert and format Julian Date as used in QDate
|
|
||||||
static inline void formatJulianDate(std::wostream &str, unsigned julianDate)
|
|
||||||
{
|
|
||||||
int y, m, d;
|
|
||||||
getDateFromJulianDay(julianDate, &y, &m, &d);
|
|
||||||
str << d << '.' << m << '.' << y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format time in milliseconds as "hh:dd:ss:mmm"
|
|
||||||
static inline void formatMilliSeconds(std::wostream &str, int milliSecs)
|
|
||||||
{
|
|
||||||
const int hourFactor = 1000 * 3600;
|
|
||||||
const int hours = milliSecs / hourFactor;
|
|
||||||
milliSecs = milliSecs % hourFactor;
|
|
||||||
const int minFactor = 1000 * 60;
|
|
||||||
const int minutes = milliSecs / minFactor;
|
|
||||||
milliSecs = milliSecs % minFactor;
|
|
||||||
const int secs = milliSecs / 1000;
|
|
||||||
milliSecs = milliSecs % 1000;
|
|
||||||
str.fill('0');
|
|
||||||
str << std::setw(2) << hours << ':' << std::setw(2)
|
|
||||||
<< minutes << ':' << std::setw(2) << secs
|
|
||||||
<< '.' << std::setw(3) << milliSecs;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *stdStringTypeC = "std::basic_string<char,std::char_traits<char>,std::allocator<char> >";
|
const char *stdStringTypeC = "std::basic_string<char,std::char_traits<char>,std::allocator<char> >";
|
||||||
const char *stdWStringTypeC = "std::basic_string<unsigned short,std::char_traits<unsigned short>,std::allocator<unsigned short> >";
|
const char *stdWStringTypeC = "std::basic_string<unsigned short,std::char_traits<unsigned short>,std::allocator<unsigned short> >";
|
||||||
// Compiler option: -Zc:wchar_t-:
|
// Compiler option: -Zc:wchar_t-:
|
||||||
@@ -2042,21 +2017,13 @@ static inline bool dumpQFlags(const SymbolGroupValue &v, std::wostream &str)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dumpJulianDate(int julianDay, std::wostream &str)
|
|
||||||
{
|
|
||||||
if (julianDay < 0)
|
|
||||||
return false;
|
|
||||||
else if (!julianDay)
|
|
||||||
str << L"<null>";
|
|
||||||
else
|
|
||||||
formatJulianDate(str, julianDay);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool dumpQDate(const SymbolGroupValue &v, std::wostream &str)
|
static bool dumpQDate(const SymbolGroupValue &v, std::wostream &str)
|
||||||
{
|
{
|
||||||
if (const SymbolGroupValue julianDayV = v["jd"])
|
if (const SymbolGroupValue julianDayV = v["jd"]) {
|
||||||
return dumpJulianDate(julianDayV.intValue(), str);
|
if (julianDayV.intValue() > 0)
|
||||||
|
str << julianDayV.intValue();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2064,11 +2031,9 @@ static bool dumpQTime(const SymbolGroupValue &v, std::wostream &str)
|
|||||||
{
|
{
|
||||||
if (const SymbolGroupValue milliSecsV = v["mds"]) {
|
if (const SymbolGroupValue milliSecsV = v["mds"]) {
|
||||||
const int milliSecs = milliSecsV.intValue();
|
const int milliSecs = milliSecsV.intValue();
|
||||||
if (milliSecs >= 0) {
|
str << milliSecs;
|
||||||
formatMilliSeconds(str, milliSecs);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2090,14 +2055,11 @@ static bool dumpQDateTime(const SymbolGroupValue &v, std::wostream &str)
|
|||||||
str << L"<null>";
|
str << L"<null>";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!dumpJulianDate(date, str))
|
|
||||||
return false;
|
|
||||||
const ULONG64 timeAddr = dateAddr + (qtVersion < 5 ? SymbolGroupValue::intSize() : 8);
|
const ULONG64 timeAddr = dateAddr + (qtVersion < 5 ? SymbolGroupValue::intSize() : 8);
|
||||||
const int time =
|
const int time =
|
||||||
SymbolGroupValue::readIntValue(v.context().dataspaces,
|
SymbolGroupValue::readIntValue(v.context().dataspaces,
|
||||||
timeAddr, SymbolGroupValue::intSize(), 0);
|
timeAddr, SymbolGroupValue::intSize(), 0);
|
||||||
str << L' ';
|
str << date << '/' << time;
|
||||||
formatMilliSeconds(str, time);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user