Debugger[New CDB]: Add SymbolGroupValue for simple dumping.

This commit is contained in:
Friedemann Kleint
2010-11-25 17:17:06 +01:00
parent 1b6d99661f
commit 78fe22f4a3
9 changed files with 346 additions and 11 deletions

View File

@@ -97,6 +97,15 @@ void replace(std::wstring &s, wchar_t before, wchar_t after)
s[i] = after;
}
bool endsWith(const std::string &haystack, const char *needle)
{
const size_t needleLen = strlen(needle);
const size_t haystackLen = haystack.size();
if (needleLen > haystackLen)
return false;
return haystack.compare(haystackLen - needleLen, needleLen, needle) == 0;
}
static inline void formatGdbmiChar(std::ostream &str, wchar_t c)
{
switch (c) {
@@ -164,6 +173,18 @@ std::string wStringToString(const std::wstring &w)
return rc;
}
std::wstring stringToWString(const std::string &w)
{
if (w.empty())
return std::wstring();
const std::wstring::size_type size = w.size();
std::wstring rc;
rc.reserve(size);
for (std::wstring::size_type i = 0; i < size; i++)
rc.push_back(w.at(i));
return rc;
}
// Format a map as a GDBMI hash {key="value",..}
void formatGdbmiHash(std::ostream &os, const std::map<std::string, std::string> &m)
{