diff --git a/src/plugins/debugger/gdbmi.cpp b/src/plugins/debugger/gdbmi.cpp index 5f9597a65632c32c94d7e976b31230e6fef34f13..82fdaf4fd13487684dd92c9de56e55de12008a26 100644 --- a/src/plugins/debugger/gdbmi.cpp +++ b/src/plugins/debugger/gdbmi.cpp @@ -211,6 +211,12 @@ void GdbMi::dumpChildren(QByteArray * str, bool multiline, int indent) const } } +static QByteArray escaped(QByteArray ba) +{ + ba.replace("\"", "\\\""); + return ba; +} + QByteArray GdbMi::toString(bool multiline, int indent) const { QByteArray result; @@ -221,13 +227,10 @@ QByteArray GdbMi::toString(bool multiline, int indent) const else result += "Invalid"; break; - case Const: + case Const: if (!m_name.isEmpty()) result += m_name + "="; - if (multiline) - result += "\"" + m_data + "\""; - else - result += "\"" + m_data + "\""; + result += "\"" + escaped(m_data) + "\""; break; case Tuple: if (!m_name.isEmpty())