forked from qt-creator/qt-creator
CDB: Use maxStringLength parameter from settings.
Change-Id: I0969bbbc39863e0981b5af81feced10d0fbbecac Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -209,26 +209,30 @@ inline char toHexDigit(unsigned v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Strings from raw data.
|
// Strings from raw data.
|
||||||
std::wstring quotedWStringFromCharData(const unsigned char *data, size_t size)
|
std::wstring quotedWStringFromCharData(const unsigned char *data, size_t size, bool truncated)
|
||||||
{
|
{
|
||||||
std::wstring rc;
|
std::wstring rc;
|
||||||
rc.reserve(size + 2);
|
rc.reserve(size + (truncated ? 5 : 2));
|
||||||
rc.push_back(L'"');
|
rc.push_back(L'"');
|
||||||
const unsigned char *end = data + size;
|
const unsigned char *end = data + size;
|
||||||
for ( ; data < end; data++)
|
for ( ; data < end; data++)
|
||||||
rc.push_back(wchar_t(*data));
|
rc.push_back(wchar_t(*data));
|
||||||
|
if (truncated)
|
||||||
|
rc.append(L"...");
|
||||||
rc.push_back(L'"');
|
rc.push_back(L'"');
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring quotedWStringFromWCharData(const unsigned char *dataIn, size_t sizeIn)
|
std::wstring quotedWStringFromWCharData(const unsigned char *dataIn, size_t sizeIn, bool truncated)
|
||||||
{
|
{
|
||||||
std::wstring rc;
|
std::wstring rc;
|
||||||
const wchar_t *data = reinterpret_cast<const wchar_t *>(dataIn);
|
const wchar_t *data = reinterpret_cast<const wchar_t *>(dataIn);
|
||||||
const size_t size = sizeIn / sizeof(wchar_t);
|
const size_t size = sizeIn / sizeof(wchar_t);
|
||||||
rc.reserve(size + 2);
|
rc.reserve(size + (truncated ? 5 : 2));
|
||||||
rc.push_back(L'"');
|
rc.push_back(L'"');
|
||||||
rc.append(data, data + size);
|
rc.append(data, data + size);
|
||||||
|
if (truncated)
|
||||||
|
rc.append(L"...");
|
||||||
rc.push_back(L'"');
|
rc.push_back(L'"');
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,8 +176,8 @@ std::string wStringToString(const std::wstring &w);
|
|||||||
std::wstring stringToWString(const std::string &w);
|
std::wstring stringToWString(const std::string &w);
|
||||||
|
|
||||||
// Strings from raw data.
|
// Strings from raw data.
|
||||||
std::wstring quotedWStringFromCharData(const unsigned char *data, size_t size);
|
std::wstring quotedWStringFromCharData(const unsigned char *data, size_t size, bool truncated = false);
|
||||||
std::wstring quotedWStringFromWCharData(const unsigned char *data, size_t size);
|
std::wstring quotedWStringFromWCharData(const unsigned char *data, size_t size, bool truncated = false);
|
||||||
|
|
||||||
// Helper for dumping memory
|
// Helper for dumping memory
|
||||||
std::string dumpMemory(const unsigned char *data, size_t size, bool wantQuotes = true);
|
std::string dumpMemory(const unsigned char *data, size_t size, bool wantQuotes = true);
|
||||||
|
|||||||
@@ -1590,7 +1590,7 @@ static inline bool dumpQString(const SymbolGroupValue &v, std::wostream &str,
|
|||||||
if (!typeArrayV)
|
if (!typeArrayV)
|
||||||
return false;
|
return false;
|
||||||
if (!readQt5StringData(typeArrayV, qtInfo.version, true, position,
|
if (!readQt5StringData(typeArrayV, qtInfo.version, true, position,
|
||||||
std::min(length, unsigned(10240)),
|
std::min(length, ExtensionContext::instance().parameters().maxStringLength),
|
||||||
&fullSize, &size, &memory))
|
&fullSize, &size, &memory))
|
||||||
return false;
|
return false;
|
||||||
if (size) {
|
if (size) {
|
||||||
@@ -2302,9 +2302,12 @@ static bool dumpStd_W_String(const SymbolGroupValue &v, int type, std::wostream
|
|||||||
// and MSVC2008 none
|
// and MSVC2008 none
|
||||||
const SymbolGroupValue bx = SymbolGroupValue::findMember(v, "_Bx");
|
const SymbolGroupValue bx = SymbolGroupValue::findMember(v, "_Bx");
|
||||||
const int reserved = bx.parent()["_Myres"].intValue();
|
const int reserved = bx.parent()["_Myres"].intValue();
|
||||||
const int size = bx.parent()["_Mysize"].intValue();
|
int size = bx.parent()["_Mysize"].intValue();
|
||||||
if (!bx || reserved < 0 || size < 0)
|
if (!bx || reserved < 0 || size < 0)
|
||||||
return false;
|
return false;
|
||||||
|
const bool truncated = unsigned(size) > ExtensionContext::instance().parameters().maxStringLength;
|
||||||
|
if (truncated)
|
||||||
|
size = ExtensionContext::instance().parameters().maxStringLength;
|
||||||
// 'Buf' array for small strings, else pointer 'Ptr'.
|
// 'Buf' array for small strings, else pointer 'Ptr'.
|
||||||
const int bufSize = type == KT_StdString ? 16 : 8; // see basic_string.
|
const int bufSize = type == KT_StdString ? 16 : 8; // see basic_string.
|
||||||
const unsigned long memSize = type == KT_StdString ? size : 2 * size;
|
const unsigned long memSize = type == KT_StdString ? size : 2 * size;
|
||||||
@@ -2315,8 +2318,8 @@ static bool dumpStd_W_String(const SymbolGroupValue &v, int type, std::wostream
|
|||||||
if (!memory)
|
if (!memory)
|
||||||
return false;
|
return false;
|
||||||
str << (type == KT_StdString ?
|
str << (type == KT_StdString ?
|
||||||
quotedWStringFromCharData(memory, memSize) :
|
quotedWStringFromCharData(memory, memSize, truncated) :
|
||||||
quotedWStringFromWCharData(memory, memSize));
|
quotedWStringFromWCharData(memory, memSize, truncated));
|
||||||
if (memoryHandle)
|
if (memoryHandle)
|
||||||
*memoryHandle = new MemoryHandle(memory, memSize);
|
*memoryHandle = new MemoryHandle(memory, memSize);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user