From d72cb777ec010b856876cd0f584a16406435b6da Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 14 Dec 2015 11:39:36 +0100 Subject: [PATCH] Debugger: Use hex instead of base64 encoding for CDB debuggee output Simplifies code. Change-Id: Iaabb4b32f7b351d04b512cc132f990a1061da3b5 Reviewed-by: David Schulz --- src/libs/qtcreatorcdbext/outputcallback.cpp | 2 +- src/plugins/debugger/cdb/cdbengine.cpp | 4 +++- src/plugins/debugger/cdb/cdbparsehelpers.cpp | 8 -------- src/plugins/debugger/cdb/cdbparsehelpers.h | 1 - 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/libs/qtcreatorcdbext/outputcallback.cpp b/src/libs/qtcreatorcdbext/outputcallback.cpp index 128b7af59bd..14dbec5f96d 100644 --- a/src/libs/qtcreatorcdbext/outputcallback.cpp +++ b/src/libs/qtcreatorcdbext/outputcallback.cpp @@ -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(text), sizeof(wchar_t) * std::wcslen(text)); + hexEncode(str, reinterpret_cast(text), sizeof(wchar_t) * std::wcslen(text)); ExtensionContext::instance().reportLong('E', 0, "debuggee_output", str.str().c_str()); return S_OK; } diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 736cb963ff0..5d1a4b71d33 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -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(decoded.data()), decoded.size() / 2), + AppOutput); return; } diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp index 363b54e2a30..8513799f5ab 100644 --- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp +++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp @@ -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(utf16.constData())); -} - WinException::WinException() : exceptionCode(0), exceptionFlags(0), exceptionAddress(0), info1(0),info2(0), firstChance(false), lineNumber(0) diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.h b/src/plugins/debugger/cdb/cdbparsehelpers.h index 7cc35e4170b..0a353d01dcf 100644 --- a/src/plugins/debugger/cdb/cdbparsehelpers.h +++ b/src/plugins/debugger/cdb/cdbparsehelpers.h @@ -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);