From ad8eec7ecd9d27b49ea5ac020c394773a60a1090 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Mon, 6 Apr 2009 14:47:15 +0200 Subject: [PATCH] debugger: escape '"' in GdbMi::toString() Fixes an autotest failure. --- src/plugins/debugger/gdbmi.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/debugger/gdbmi.cpp b/src/plugins/debugger/gdbmi.cpp index 5f9597a6563..82fdaf4fd13 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()) -- GitLab