Debugger: Use hex instead of base64 encoding for CDB debuggee output

Simplifies code.

Change-Id: Iaabb4b32f7b351d04b512cc132f990a1061da3b5
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
hjk
2015-12-14 11:39:36 +01:00
committed by David Schulz
parent 44bb3cb4c3
commit d72cb777ec
4 changed files with 4 additions and 11 deletions

View File

@@ -104,7 +104,7 @@ STDMETHODIMP OutputCallback::Output(
}
// Base encode as GDBMI is not really made for wide chars
std::ostringstream str;
base64Encode(str, reinterpret_cast<const unsigned char *>(text), sizeof(wchar_t) * std::wcslen(text));
hexEncode(str, reinterpret_cast<const unsigned char *>(text), sizeof(wchar_t) * std::wcslen(text));
ExtensionContext::instance().reportLong('E', 0, "debuggee_output", str.str().c_str());
return S_OK;
}

View File

@@ -2237,7 +2237,9 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what
}
if (what == "debuggee_output") {
showMessage(StringFromBase64EncodedUtf16(message), AppOutput);
const QByteArray decoded = QByteArray::fromHex(message);
showMessage(QString::fromUtf16(reinterpret_cast<const ushort *>(decoded.data()), decoded.size() / 2),
AppOutput);
return;
}

View File

@@ -352,14 +352,6 @@ QString debugByteArray(const QByteArray &a)
return rc;
}
QString StringFromBase64EncodedUtf16(const QByteArray &a)
{
QByteArray utf16 = QByteArray::fromBase64(a);
utf16.append('\0');
utf16.append('\0');
return QString::fromUtf16(reinterpret_cast<const unsigned short *>(utf16.constData()));
}
WinException::WinException() :
exceptionCode(0), exceptionFlags(0), exceptionAddress(0),
info1(0),info2(0), firstChance(false), lineNumber(0)

View File

@@ -78,7 +78,6 @@ void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, QString *express
QByteArray cdbWriteMemoryCommand(quint64 addr, const QByteArray &data);
QString debugByteArray(const QByteArray &a);
QString StringFromBase64EncodedUtf16(const QByteArray &a);
DisassemblerLines parseCdbDisassembler(const QByteArray &a);