forked from qt-creator/qt-creator
Debugger: Use hex instead of base64 encoding
... for transport of memory contents in CDB machinery. Change-Id: Id29aa2a3008ec7e4fc9494ca9e26c4057f895663 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -580,12 +580,12 @@ std::string gdbmiRegisters(CIDebugRegisters *regs,
|
|||||||
return str.str();
|
return str.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string memoryToBase64(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
std::string memoryToHex(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
||||||
std::string *errorMessage /* = 0 */)
|
std::string *errorMessage /* = 0 */)
|
||||||
{
|
{
|
||||||
if (const unsigned char *buffer = SymbolGroupValue::readMemory(ds, address, length, errorMessage)) {
|
if (const unsigned char *buffer = SymbolGroupValue::readMemory(ds, address, length, errorMessage)) {
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
base64Encode(str, buffer, length);
|
hexEncode(str, buffer, length);
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
return str.str();
|
return str.str();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ std::string gdbmiRegisters(CIDebugRegisters *regs,
|
|||||||
unsigned flags,
|
unsigned flags,
|
||||||
std::string *errorMessage);
|
std::string *errorMessage);
|
||||||
|
|
||||||
std::string memoryToBase64(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
std::string memoryToHex(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
||||||
std::string *errorMessage = 0);
|
std::string *errorMessage = 0);
|
||||||
std::wstring memoryToHexW(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
std::wstring memoryToHexW(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
||||||
std::string *errorMessage = 0);
|
std::string *errorMessage = 0);
|
||||||
// Stack helpers
|
// Stack helpers
|
||||||
|
|||||||
@@ -959,7 +959,7 @@ extern "C" HRESULT CALLBACK help(CIDebugClient *, PCSTR)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extension command 'memory':
|
// Extension command 'memory':
|
||||||
// Display memory as base64
|
// Display memory as hex
|
||||||
|
|
||||||
extern "C" HRESULT CALLBACK memory(CIDebugClient *Client, PCSTR argsIn)
|
extern "C" HRESULT CALLBACK memory(CIDebugClient *Client, PCSTR argsIn)
|
||||||
{
|
{
|
||||||
@@ -975,7 +975,7 @@ extern "C" HRESULT CALLBACK memory(CIDebugClient *Client, PCSTR argsIn)
|
|||||||
if (tokens.size() == 2
|
if (tokens.size() == 2
|
||||||
&& integerFromString(tokens.front(), &address)
|
&& integerFromString(tokens.front(), &address)
|
||||||
&& integerFromString(tokens.at(1), &length)) {
|
&& integerFromString(tokens.at(1), &length)) {
|
||||||
memory = memoryToBase64(exc.dataSpaces(), address, length, &errorMessage);
|
memory = memoryToHex(exc.dataSpaces(), address, length, &errorMessage);
|
||||||
} else {
|
} else {
|
||||||
errorMessage = singleLineUsage(commandDescriptions[CmdMemory]);
|
errorMessage = singleLineUsage(commandDescriptions[CmdMemory]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1541,7 +1541,7 @@ void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie)
|
|||||||
cmd.args = QLatin1String(args);
|
cmd.args = QLatin1String(args);
|
||||||
cmd.callback = [this, cookie](const DebuggerResponse &response) {
|
cmd.callback = [this, cookie](const DebuggerResponse &response) {
|
||||||
if (response.resultClass == ResultDone && cookie.agent) {
|
if (response.resultClass == ResultDone && cookie.agent) {
|
||||||
const QByteArray data = QByteArray::fromBase64(response.data.data());
|
const QByteArray data = QByteArray::fromHex(response.data.data());
|
||||||
if (unsigned(data.size()) == cookie.length)
|
if (unsigned(data.size()) == cookie.length)
|
||||||
cookie.agent->addLazyData(cookie.editorToken, cookie.address, data);
|
cookie.agent->addLazyData(cookie.editorToken, cookie.address, data);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user