forked from qt-creator/qt-creator
Debugger[CDB]: Output std::[w]string correctly.
_Ptr is used for large values instead of _Buf. Reviewed-by: hjk
This commit is contained in:
@@ -1505,17 +1505,25 @@ static inline bool dumpQObject(const SymbolGroupValue &v, std::wostream &str, vo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dump a std::string.
|
// Dump a std::string.
|
||||||
static bool dumpStd_W_String(const SymbolGroupValue &v, std::wostream &str)
|
static bool dumpStd_W_String(const SymbolGroupValue &v, int type, std::wostream &str)
|
||||||
{
|
{
|
||||||
// MSVC 2010: Access Bx/_Buf in base class
|
SymbolGroupValue bx = v[unsigned(0)]["_Bx"];
|
||||||
SymbolGroupValue buf = v[unsigned(0)]["_Bx"]["_Buf"];
|
int reserved = 0;
|
||||||
if (!buf) // MSVC2008: Bx/Buf are members
|
if (bx) { // MSVC 2010
|
||||||
buf = v["_Bx"]["_Buf"];
|
reserved = v[unsigned(0)]["_Myres"].intValue();
|
||||||
if (buf) {
|
} else { // MSVC2008
|
||||||
str << buf.value();
|
bx = v["_Bx"];
|
||||||
return true;
|
reserved = v["_Myres"].intValue();
|
||||||
}
|
}
|
||||||
|
if (!bx || reserved < 0)
|
||||||
return false;
|
return false;
|
||||||
|
// 'Buf' array for small strings, else pointer 'Ptr'.
|
||||||
|
const int bufSize = type == KT_StdString ? 16 : 8; // see basic_string.
|
||||||
|
const SymbolGroupValue string = bufSize <= reserved ? bx["_Ptr"] : bx["_Buf"];
|
||||||
|
if (!string)
|
||||||
|
return false;
|
||||||
|
str << string.value();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// QVariant employs a template for storage where anything bigger than the data union
|
// QVariant employs a template for storage where anything bigger than the data union
|
||||||
@@ -1818,7 +1826,7 @@ unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx,
|
|||||||
break;
|
break;
|
||||||
case KT_StdString:
|
case KT_StdString:
|
||||||
case KT_StdWString:
|
case KT_StdWString:
|
||||||
rc = dumpStd_W_String(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
|
rc = dumpStd_W_String(v, kt, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user