Index: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py =================================================================== --- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py +++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py @@ -32,7 +32,7 @@ # 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\"") Index: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp =================================================================== --- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp +++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp @@ -208,6 +208,12 @@ 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 @@ 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;