[Lldb-commits] [lldb] r243741 - Escape new line and tabs in the result of variable evaluation.

Hafiz Abid Qadeer hafiz_abid at mentor.com
Fri Jul 31 02:24:40 PDT 2015


Author: abidh
Date: Fri Jul 31 04:24:39 2015
New Revision: 243741

URL: http://llvm.org/viewvc/llvm-project?rev=243741&view=rev
Log:
Escape new line and tabs in the result of variable evaluation.

Expression evaluation error messages may have embedded new lines
and tabs. These should be escaped in the result string.

Patch by paulmaybee. Reviewed in http://reviews.llvm.org/D11570.


Modified:
    lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
    lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp

Modified: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py?rev=243741&r1=243740&r2=243741&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py Fri Jul 31 04:24:39 2015
@@ -33,7 +33,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 
         # Print non-existant variable
         self.runCmd("-var-create var1 * undef")
-        self.expect("\^error,msg=\"error: error: use of undeclared identifier \'undef\'\s+error: 1 errors parsing expression\"")
+        self.expect("\^error,msg=\"error: error: use of undeclared identifier \'undef\'\\\\nerror: 1 errors parsing expression\\\\n\"")
         self.runCmd("-data-evaluate-expression undef")
         self.expect("\^error,msg=\"Could not evaluate expression\"")
 

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp?rev=243741&r1=243740&r2=243741&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp Fri Jul 31 04:24:39 2015
@@ -255,7 +255,7 @@ CMICmdCmdVarCreate::Acknowledge(void)
     CMIUtilString strErrMsg(m_strValue);
     if (m_strValue.empty())
         strErrMsg = CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_CREATION_FAILED), m_strExpression.c_str());
-    const CMICmnMIValueConst miValueConst(strErrMsg);
+    const CMICmnMIValueConst miValueConst(strErrMsg.Escape(true /* vbEscapeQuotes */));
     CMICmnMIValueResult miValueResult("msg", miValueConst);
     const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult);
     m_miResultRecord = miRecordResult;





More information about the lldb-commits mailing list