diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-05-16 16:07:22 +0200 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2011-05-16 16:12:29 +0200 |
commit | 5ded3e2f62c8d81669b8fc298648ca5cd81547f8 (patch) | |
tree | e1826bd46ff70c294c039adcefa8587cee618104 | |
parent | 8da2c548f3b463fed3f1a80fb5b624c9acf6c1cf (diff) | |
download | qt-creator-5ded3e2f62c8d81669b8fc298648ca5cd81547f8.tar.gz |
Debugger[CDB]: Output std::[w]string correctly.
_Ptr is used for large values instead of _Buf.
Reviewed-by: hjk
-rw-r--r-- | src/libs/qtcreatorcdbext/symbolgroupvalue.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp index 09ac1e1611..ceae1b8ca1 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp @@ -1505,17 +1505,25 @@ static inline bool dumpQObject(const SymbolGroupValue &v, std::wostream &str, vo } // Dump a std::string. -static bool dumpStd_W_String(const SymbolGroupValue &v, std::wostream &str) -{ - // MSVC 2010: Access Bx/_Buf in base class - SymbolGroupValue buf = v[unsigned(0)]["_Bx"]["_Buf"]; - if (!buf) // MSVC2008: Bx/Buf are members - buf = v["_Bx"]["_Buf"]; - if (buf) { - str << buf.value(); - return true; +static bool dumpStd_W_String(const SymbolGroupValue &v, int type, std::wostream &str) +{ + SymbolGroupValue bx = v[unsigned(0)]["_Bx"]; + int reserved = 0; + if (bx) { // MSVC 2010 + reserved = v[unsigned(0)]["_Myres"].intValue(); + } else { // MSVC2008 + bx = v["_Bx"]; + reserved = v["_Myres"].intValue(); } - return false; + if (!bx || reserved < 0) + 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 @@ -1818,7 +1826,7 @@ unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx, break; case KT_StdString: 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; default: break; |