paulmaybee created this revision.
paulmaybee added reviewers: abidh, ki.stfu, ChuckR.
paulmaybee added subscribers: lldb-commits, greggm.

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

http://reviews.llvm.org/D11570

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

Index: tools/lldb-mi/MICmdCmdVar.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdVar.cpp
+++ tools/lldb-mi/MICmdCmdVar.cpp
@@ -255,7 +255,7 @@
     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());
     CMICmnMIValueResult miValueResult("msg", miValueConst);
     const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, 
CMICmnMIResultRecord::eResultClass_Error, miValueResult);
     m_miResultRecord = miRecordResult;
Index: test/tools/lldb-mi/variable/TestMiVar.py
===================================================================
--- test/tools/lldb-mi/variable/TestMiVar.py
+++ test/tools/lldb-mi/variable/TestMiVar.py
@@ -33,7 +33,7 @@
 
         # 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\"")
 


Index: tools/lldb-mi/MICmdCmdVar.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdVar.cpp
+++ tools/lldb-mi/MICmdCmdVar.cpp
@@ -255,7 +255,7 @@
     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());
     CMICmnMIValueResult miValueResult("msg", miValueConst);
     const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult);
     m_miResultRecord = miRecordResult;
Index: test/tools/lldb-mi/variable/TestMiVar.py
===================================================================
--- test/tools/lldb-mi/variable/TestMiVar.py
+++ test/tools/lldb-mi/variable/TestMiVar.py
@@ -33,7 +33,7 @@
 
         # 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\"")
 
_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to