diff options
author | David Schulz <david.schulz@qt.io> | 2019-10-21 09:22:36 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2019-10-22 11:46:04 +0000 |
commit | 6e3de85b337eb8a6a107abcef932ee21deabc3d5 (patch) | |
tree | 390b1d9ae41495e120f7f5223e7414422da574eb /src/plugins/debugger | |
parent | 1a2bac60ed09f3d349b85afddf3504a7417722ac (diff) | |
download | qt-creator-6e3de85b337eb8a6a107abcef932ee21deabc3d5.tar.gz |
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>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r-- | src/plugins/debugger/cdb/cdbengine.cpp | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index a5554a3aa8..4e04a02fc4 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -917,15 +917,6 @@ void CdbEngine::handleJumpToLineAddressResolution(const DebuggerResponse &respon } } -static inline bool isAsciiWord(const QString &s) -{ - for (const QChar &c : s) { - if (!c.isLetterOrNumber() || c.toLatin1() == 0) - return false; - } - return true; -} - void CdbEngine::assignValueInDebugger(WatchItem *w, const QString &expr, const QVariant &value) { if (debug) @@ -935,28 +926,8 @@ void CdbEngine::assignValueInDebugger(WatchItem *w, const QString &expr, const Q qWarning("Internal error: assignValueInDebugger: Invalid state or no stack frame."); return; } - QString cmd; - StringInputStream str(cmd); - switch (value.type()) { - case QVariant::String: { - // Convert qstring to Utf16 data not considering endianness for Windows. - const QString s = value.toString(); - if (isAsciiWord(s)) { - str << m_extensionCommandPrefix << "assign \"" << w->iname << '=' << s << '"'; - } else { - const QByteArray utf16(reinterpret_cast<const char *>(s.utf16()), 2 * s.size()); - str << m_extensionCommandPrefix << "assign -u " << w->iname << '=' - << QString::fromLatin1(utf16.toHex()); - } - } - break; - default: - str << m_extensionCommandPrefix << "assign " << w->iname << '=' - << value.toString(); - break; - } - - runCommand({cmd, NoFlags}); + runCommand({m_extensionCommandPrefix + "assign -h " + w->iname + '=' + toHex(value.toString()), + NoFlags}); // Update all locals in case we change a union or something pointed to // that affects other variables, too. updateLocals(); |