Debugger: always hex encode the value of assignments in cdbext

Fixes assigning negative values to locals

Change-Id: Ief6e7f47e8e6f0a5d38458396164dfcd24e408a5
Fixes: QTCREATORBUG-17269
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2019-10-21 09:22:36 +02:00
parent 1a2bac60ed
commit 6e3de85b33
9 changed files with 53 additions and 171 deletions

View File

@@ -33,6 +33,7 @@
#include <cstring>
#include <iostream>
#include <sstream>
#include <codecvt>
#include <iomanip>
static const char whiteSpace[] = " \t\r\n";
@@ -149,6 +150,11 @@ std::string wStringToString(const std::wstring &w)
return rc;
}
std::wstring utf8ToUtf16(const std::string &s)
{
return std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>().from_bytes(s.data());
}
// Convert an ASCII hex digit to its value 'A'->10
static inline unsigned hexDigit(char c)
{
@@ -210,6 +216,11 @@ std::string stringFromHex(const char *p, const char *end)
return rc;
}
std::string stringFromHex(const std::string &hexEncoded)
{
return stringFromHex(hexEncoded.c_str(), hexEncoded.c_str() + hexEncoded.size());
}
// Helper for dumping memory
std::string dumpMemory(const unsigned char *p, size_t size,
bool wantQuotes)