diff options
| -rw-r--r-- | lldb/test/tools/lldb-mi/variable/TestMiVar.py | 2 | ||||
| -rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdVar.cpp | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lldb/test/tools/lldb-mi/variable/TestMiVar.py b/lldb/test/tools/lldb-mi/variable/TestMiVar.py index 6d9972d4bc6..f1bb6e82e00 100644 --- a/lldb/test/tools/lldb-mi/variable/TestMiVar.py +++ b/lldb/test/tools/lldb-mi/variable/TestMiVar.py @@ -32,7 +32,7 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Print non-existant variable self.runCmd("-var-create var1 * undef") - self.expect("\^error,msg=\"Failed to create variable object for 'undef'\"") + self.expect("\^error,msg=\"error: error: use of undeclared identifier \'undef\'\s+error: 1 errors parsing expression\"") self.runCmd("-data-evaluate-expression undef") self.expect("\^error,msg=\"Could not evaluate expression\"") diff --git a/lldb/tools/lldb-mi/MICmdCmdVar.cpp b/lldb/tools/lldb-mi/MICmdCmdVar.cpp index 99c0906a844..37e5eb060d8 100644 --- a/lldb/tools/lldb-mi/MICmdCmdVar.cpp +++ b/lldb/tools/lldb-mi/MICmdCmdVar.cpp @@ -208,6 +208,12 @@ CMICmdCmdVarCreate::Execute(void) CMICmnLLDBDebugSessionInfoVarObj varObj(rStrExpression, m_strVarName, value); m_strValue = varObj.GetValueFormatted(); } + else + { + lldb::SBStream err; + if (value.GetError().GetDescription(err)) + m_strValue = err.GetData(); + } return MIstatus::success; } @@ -248,7 +254,10 @@ CMICmdCmdVarCreate::Acknowledge(void) return MIstatus::success; } - const CMICmnMIValueConst miValueConst(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_CREATION_FAILED), m_strExpression.c_str())); + 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); CMICmnMIValueResult miValueResult("msg", miValueConst); const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); m_miResultRecord = miRecordResult; |

