Index: test/tools/lldb-mi/TestMiStack.py =================================================================== --- test/tools/lldb-mi/TestMiStack.py +++ test/tools/lldb-mi/TestMiStack.py @@ -10,7 +10,6 @@ @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") - @unittest2.skip("-stack-list-locals doesn't work properly") def test_lldbmi_stackargs(self): """Test that 'lldb-mi --interpreter' can shows arguments.""" @@ -35,7 +34,6 @@ @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") - @unittest2.skip("-stack-list-locals doesn't work properly") def test_lldbmi_locals(self): """Test that 'lldb-mi --interpreter' can shows local variables.""" Index: tools/lldb-mi/MICmdCmdStack.cpp =================================================================== --- tools/lldb-mi/MICmdCmdStack.cpp +++ tools/lldb-mi/MICmdCmdStack.cpp @@ -413,6 +413,14 @@ } } + const MIuint nPrintValues = pArgPrintValues->GetValue(); + if (nPrintValues >= CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats) + { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES), m_cmdData.strMiCmd.c_str())); + return MIstatus::failure; + } + const CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat = static_cast(nPrintValues); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); lldb::SBProcess sbProcess = rSessionInfo.GetProcess(); lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread(); @@ -433,7 +441,7 @@ lldb::SBFrame frame = thread.GetFrameAtIndex(i); CMICmnMIValueList miValueList(true); const MIuint maskVarTypes = CMICmnLLDBDebugSessionInfo::eVariableType_Arguments; - if (!rSessionInfo.MIResponseFormVariableInfo3(frame, maskVarTypes, miValueList)) + if (!rSessionInfo.MIResponseFormVariableInfo3(frame, maskVarTypes, eVarInfoFormat, miValueList)) return MIstatus::failure; const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%d", i)); const CMICmnMIValueResult miValueResult("level", miValueConst); @@ -561,6 +569,7 @@ { CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread); CMICMDBASE_GETOPTION(pArgFrame, OptionLong, m_constStrArgFrame); + CMICMDBASE_GETOPTION(pArgPrintValues, Number, m_constStrArgPrintValues); // Retrieve the --thread option's thread ID (only 1) MIuint64 nThreadId = UINT64_MAX; @@ -572,6 +581,7 @@ return MIstatus::failure; } } + MIuint64 nFrame = UINT64_MAX; if (pArgFrame->GetFound()) { @@ -582,6 +592,14 @@ } } + const MIuint nPrintValues = pArgPrintValues->GetValue(); + if (nPrintValues >= CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats) + { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES), m_cmdData.strMiCmd.c_str())); + return MIstatus::failure; + } + const CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat = static_cast(nPrintValues); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); lldb::SBProcess sbProcess = rSessionInfo.GetProcess(); lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread(); @@ -596,12 +614,11 @@ return MIstatus::success; } - const MIuint nFrames = thread.GetNumFrames(); - MIunused(nFrames); lldb::SBFrame frame = (nFrame != UINT64_MAX) ? thread.GetFrameAtIndex(nFrame) : thread.GetSelectedFrame(); + CMICmnMIValueList miValueList(true); const MIuint maskVarTypes = CMICmnLLDBDebugSessionInfo::eVariableType_Locals; - if (!rSessionInfo.MIResponseFormVariableInfo(frame, maskVarTypes, miValueList)) + if (!rSessionInfo.MIResponseFormVariableInfo(frame, maskVarTypes, eVarInfoFormat, miValueList)) return MIstatus::failure; m_miValueList = miValueList; Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.h =================================================================== --- tools/lldb-mi/MICmnLLDBDebugSessionInfo.h +++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.h @@ -117,6 +117,17 @@ eVariableType_Arguments = (1u << 3) // Arguments. }; + //++ =================================================================== + // Details: Determine the information that should be shown by using MIResponseFormVariableInfo family functions. + //-- + enum VariableInfoFormat_e + { + eVariableInfoFormat_NoValues, + eVariableInfoFormat_AllValues, + eVariableInfoFormat_SimpleValues, + kNumVariableInfoFormats + }; + // Typedefs: public: typedef std::vector VecActiveThreadId_t; @@ -148,9 +159,12 @@ bool MIResponseFormThreadInfo(const SMICmdData &vCmdData, const lldb::SBThread &vrThread, CMICmnMIValueTuple &vwrMIValueTuple); bool MIResponseFormThreadInfo2(const SMICmdData &vCmdData, const lldb::SBThread &vrThread, CMICmnMIValueTuple &vwrMIValueTuple); bool MIResponseFormThreadInfo3(const SMICmdData &vCmdData, const lldb::SBThread &vrThread, CMICmnMIValueTuple &vwrMIValueTuple); - bool MIResponseFormVariableInfo(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, CMICmnMIValueList &vwrMiValueList); - bool MIResponseFormVariableInfo2(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, CMICmnMIValueList &vwrMiValueList); - bool MIResponseFormVariableInfo3(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, CMICmnMIValueList &vwrMiValueList); + bool MIResponseFormVariableInfo(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList); + bool MIResponseFormVariableInfo2(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList); + bool MIResponseFormVariableInfo3(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList); bool MIResponseFormBrkPtFrameInfo(const SBrkPtInfo &vrBrkPtInfo, CMICmnMIValueTuple &vwrMiValueTuple); bool MIResponseFormBrkPtInfo(const SBrkPtInfo &vrBrkPtInfo, CMICmnMIValueTuple &vwrMiValueTuple); bool GetBrkPtInfo(const lldb::SBBreakpoint &vBrkPt, SBrkPtInfo &vrwBrkPtInfo) const; @@ -188,9 +202,9 @@ void operator=(const CMICmnLLDBDebugSessionInfo &); // bool GetVariableInfo(const MIuint vnMaxDepth, const lldb::SBValue &vrValue, const bool vbIsChildValue, - CMICmnMIValueList &vwrMiValueList, MIuint &vrwnDepth); + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList, MIuint &vrwnDepth); bool GetVariableInfo2(const MIuint vnMaxDepth, const lldb::SBValue &vrValue, const bool vbIsChildValue, - CMICmnMIValueList &vwrMiValueList, MIuint &vrwnDepth); + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList, MIuint &vrwnDepth); // Overridden: private: Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp =================================================================== --- tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -253,7 +253,7 @@ // Function args CMICmnMIValueList miValueList(true); const MIuint maskVarTypes = eVariableType_Arguments; - if (!MIResponseFormVariableInfo(frame, maskVarTypes, miValueList)) + if (!MIResponseFormVariableInfo(frame, maskVarTypes, eVariableInfoFormat_AllValues, miValueList)) return MIstatus::failure; const MIchar *pUnknown = "??"; @@ -326,7 +326,7 @@ // Function args CMICmnMIValueList miValueList(true); const MIuint maskVarTypes = eVariableType_Arguments; - if (!MIResponseFormVariableInfo2(frame, maskVarTypes, miValueList)) + if (!MIResponseFormVariableInfo2(frame, maskVarTypes, eVariableInfoFormat_AllValues, miValueList)) return MIstatus::failure; const MIchar *pUnknown = "??"; @@ -646,6 +646,7 @@ // Type: Method. // Args: vrFrame - (R) LLDB thread object. // vMaskVarTypes - (R) Construed according to VariableType_e. +// veVarInfoFormat - (R) The type of variable info that should be shown. // vwrMIValueList - (W) MI value list object. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. @@ -653,7 +654,7 @@ //-- bool CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo2(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, - CMICmnMIValueList &vwrMiValueList) + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList) { bool bOk = MIstatus::success; lldb::SBFrame &rFrame = const_cast(vrFrame); @@ -686,6 +687,7 @@ // Type: Method. // Args: vrFrame - (R) LLDB thread object. // vMaskVarTypes - (R) Construed according to VariableType_e. +// veVarInfoFormat - (R) The type of variable info that should be shown. // vwrMIValueList - (W) MI value list object. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. @@ -693,7 +695,7 @@ //-- bool CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, - CMICmnMIValueList &vwrMiValueList) + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList) { bool bOk = MIstatus::success; lldb::SBFrame &rFrame = const_cast(vrFrame); @@ -709,7 +711,7 @@ for (MIuint i = 0; bOk && (i < nArgs); i++) { lldb::SBValue value = listArg.GetValueAtIndex(i); - bOk = GetVariableInfo(nMaxRecusiveDepth, value, false, vwrMiValueList, nCurrentRecursiveDepth); + bOk = GetVariableInfo(nMaxRecusiveDepth, value, false, veVarInfoFormat, vwrMiValueList, nCurrentRecursiveDepth); } return bOk; @@ -723,6 +725,7 @@ // Type: Method. // Args: vrFrame - (R) LLDB thread object. // vMaskVarTypes - (R) Construed according to VariableType_e. +// veVarInfoFormat - (R) The type of variable info that should be shown. // vwrMIValueList - (W) MI value list object. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. @@ -730,7 +733,7 @@ //-- bool CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo3(const lldb::SBFrame &vrFrame, const MIuint vMaskVarTypes, - CMICmnMIValueList &vwrMiValueList) + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList) { bool bOk = MIstatus::success; lldb::SBFrame &rFrame = const_cast(vrFrame); @@ -746,7 +749,7 @@ for (MIuint i = 0; bOk && (i < nArgs); i++) { lldb::SBValue value = listArg.GetValueAtIndex(i); - bOk = GetVariableInfo2(nMaxRecusiveDepth, value, false, vwrMiValueList, nCurrentRecursiveDepth); + bOk = GetVariableInfo2(nMaxRecusiveDepth, value, false, veVarInfoFormat, vwrMiValueList, nCurrentRecursiveDepth); } return bOk; @@ -761,15 +764,17 @@ // vrValue - (R) LLDB value object. // vbIsChildValue - (R) True = Value object is a child of a higher Value object, // - False = Value object not a child. +// veVarInfoFormat - (R) The type of variable info that should be shown. // vwrMIValueList - (W) MI value list object. // vnDepth - (RW) The current recursive depth of this function. -// // Return: MIstatus::success - Functional succeeded. +// Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. // Throws: None. //-- bool CMICmnLLDBDebugSessionInfo::GetVariableInfo(const MIuint vnMaxDepth, const lldb::SBValue &vrValue, const bool vbIsChildValue, - CMICmnMIValueList &vwrMiValueList, MIuint &vrwnDepth) + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList, + MIuint &vrwnDepth) { // *** Update GetVariableInfo2() with any code changes here *** @@ -807,46 +812,78 @@ else { // Basic types - const CMICmnMIValueConst miValueConst(utilValue.GetName()); - const CMICmnMIValueResult miValueResult("name", miValueConst); - miValueTuple.Add(miValueResult); - const CMICmnMIValueConst miValueConst2(utilValue.GetValue()); - const CMICmnMIValueResult miValueResult2("value", miValueConst2); - miValueTuple.Add(miValueResult2); + switch (veVarInfoFormat) + { + case eVariableInfoFormat_NoValues: + { + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + return vwrMiValueList.Add(miValueResult); + } + case eVariableInfoFormat_AllValues: + case eVariableInfoFormat_SimpleValues: + { + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + miValueTuple.Add(miValueResult); + const CMICmnMIValueConst miValueConst2(utilValue.GetValue()); + const CMICmnMIValueResult miValueResult2("value", miValueConst2); + miValueTuple.Add(miValueResult2); + break; + } + default: + break; + } return vwrMiValueList.Add(miValueTuple); } } else if (bIsPointerType && utilValue.IsChildCharType()) { - // Append string text to the parent value information - const CMICmnMIValueConst miValueConst(utilValue.GetName()); - const CMICmnMIValueResult miValueResult("name", miValueConst); - miValueTuple.Add(miValueResult); - - const CMIUtilString &rText(utilValue.GetChildValueCString()); - if (rText.empty()) - { - const CMICmnMIValueConst miValueConst(utilValue.GetValue()); - const CMICmnMIValueResult miValueResult("value", miValueConst); - miValueTuple.Add(miValueResult); - } - else + switch (veVarInfoFormat) { - if (utilValue.IsValueUnknown()) + case eVariableInfoFormat_NoValues: { - const CMICmnMIValueConst miValueConst(rText); - const CMICmnMIValueResult miValueResult("value", miValueConst); - miValueTuple.Add(miValueResult); + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + return vwrMiValueList.Add(miValueResult); } - else + case eVariableInfoFormat_AllValues: + case eVariableInfoFormat_SimpleValues: { - // Note code that has const in will not show the text suffix to the string pointer - // i.e. const char * pMyStr = "blah"; ==> "0x00007000"" <-- Eclipse shows this - // but char * pMyStr = "blah"; ==> "0x00007000" "blah"" <-- Eclipse shows this - const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%s %s", utilValue.GetValue().c_str(), rText.c_str())); - const CMICmnMIValueResult miValueResult("value", miValueConst); + // Append string text to the parent value information + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); miValueTuple.Add(miValueResult); + + const CMIUtilString &rText(utilValue.GetChildValueCString()); + if (rText.empty()) + { + const CMICmnMIValueConst miValueConst(utilValue.GetValue()); + const CMICmnMIValueResult miValueResult("value", miValueConst); + miValueTuple.Add(miValueResult); + } + else + { + if (utilValue.IsValueUnknown()) + { + const CMICmnMIValueConst miValueConst(rText); + const CMICmnMIValueResult miValueResult("value", miValueConst); + miValueTuple.Add(miValueResult); + } + else + { + // Note code that has const in will not show the text suffix to the string pointer + // i.e. const char * pMyStr = "blah"; ==> "0x00007000"" <-- Eclipse shows this + // but char * pMyStr = "blah"; ==> "0x00007000" "blah"" <-- Eclipse shows this + const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%s %s", utilValue.GetValue().c_str(), rText.c_str())); + const CMICmnMIValueResult miValueResult("value", miValueConst); + miValueTuple.Add(miValueResult); + } + } + break; } + default: + break; } return vwrMiValueList.Add(miValueTuple); } @@ -863,30 +900,62 @@ else { // Basic types - const CMICmnMIValueConst miValueConst(utilValue.GetName()); - const CMICmnMIValueResult miValueResult("name", miValueConst); - miValueTuple.Add(miValueResult); - const CMICmnMIValueConst miValueConst2(utilValue.GetValue()); - const CMICmnMIValueResult miValueResult2("value", miValueConst2); - miValueTuple.Add(miValueResult2); + switch (veVarInfoFormat) + { + case eVariableInfoFormat_NoValues: + { + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + return vwrMiValueList.Add(miValueResult); + } + case eVariableInfoFormat_AllValues: + case eVariableInfoFormat_SimpleValues: + { + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + miValueTuple.Add(miValueResult); + const CMICmnMIValueConst miValueConst2(utilValue.GetValue()); + const CMICmnMIValueResult miValueResult2("value", miValueConst2); + miValueTuple.Add(miValueResult2); + break; + } + default: + break; + } return vwrMiValueList.Add(miValueTuple); } } else { - // Build parent child composite types - CMICmnMIValueList miValueList(true); - for (MIuint i = 0; bOk && (i < nChildren); i++) + switch (veVarInfoFormat) { - lldb::SBValue member = rValue.GetChildAtIndex(i); - bOk = GetVariableInfo(vnMaxDepth, member, true, miValueList, ++vrwnDepth); + case eVariableInfoFormat_NoValues: + { + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + return vwrMiValueList.Add(miValueResult); + } + case eVariableInfoFormat_AllValues: + case eVariableInfoFormat_SimpleValues: + { + // Build parent child composite types + CMICmnMIValueList miValueList(true); + for (MIuint i = 0; bOk && (i < nChildren); i++) + { + lldb::SBValue member = rValue.GetChildAtIndex(i); + bOk = GetVariableInfo(vnMaxDepth, member, true, veVarInfoFormat, miValueList, ++vrwnDepth); + } + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + miValueTuple.Add(miValueResult); + const CMICmnMIValueConst miValueConst2(CMIUtilString::Format("{%s}", miValueList.ExtractContentNoBrackets().c_str())); + const CMICmnMIValueResult miValueResult2("value", miValueConst2); + miValueTuple.Add(miValueResult2); + break; + } + default: + break; } - const CMICmnMIValueConst miValueConst(utilValue.GetName()); - const CMICmnMIValueResult miValueResult("name", miValueConst); - miValueTuple.Add(miValueResult); - const CMICmnMIValueConst miValueConst2(CMIUtilString::Format("{%s}", miValueList.ExtractContentNoBrackets().c_str())); - const CMICmnMIValueResult miValueResult2("value", miValueConst2); - miValueTuple.Add(miValueResult2); return vwrMiValueList.Add(miValueTuple); } } @@ -900,6 +969,7 @@ // vrValue - (R) LLDB value object. // vbIsChildValue - (R) True = Value object is a child of a higher Value object, // - False = Value object not a child. +// veVarInfoFormat - (R) The type of variable info that should be shown. // vwrMIValueList - (W) MI value list object. // vnDepth - (RW) The current recursive depth of this function. // // Return: MIstatus::success - Functional succeeded. @@ -908,7 +978,8 @@ //-- bool CMICmnLLDBDebugSessionInfo::GetVariableInfo2(const MIuint vnMaxDepth, const lldb::SBValue &vrValue, const bool vbIsChildValue, - CMICmnMIValueList &vwrMiValueList, MIuint &vrwnDepth) + const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList, + MIuint &vrwnDepth) { // *** Update GetVariableInfo() with any code changes here *** @@ -935,64 +1006,112 @@ else { // Basic types - const CMICmnMIValueConst miValueConst(utilValue.GetName()); - const CMICmnMIValueResult miValueResult("name", miValueConst); - miValueTuple.Add(miValueResult); - const CMICmnMIValueConst miValueConst2(utilValue.GetValue()); - const CMICmnMIValueResult miValueResult2("value", miValueConst2); - miValueTuple.Add(miValueResult2); + switch (veVarInfoFormat) + { + case eVariableInfoFormat_NoValues: + { + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + return vwrMiValueList.Add(miValueResult); + } + case eVariableInfoFormat_AllValues: + case eVariableInfoFormat_SimpleValues: + { + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + miValueTuple.Add(miValueResult); + const CMICmnMIValueConst miValueConst2(utilValue.GetValue()); + const CMICmnMIValueResult miValueResult2("value", miValueConst2); + miValueTuple.Add(miValueResult2); + break; + } + default: + break; + } return vwrMiValueList.Add(miValueTuple); } } else if (utilValue.IsChildCharType()) { - // Append string text to the parent value information - const CMICmnMIValueConst miValueConst(utilValue.GetName()); - const CMICmnMIValueResult miValueResult("name", miValueConst); - miValueTuple.Add(miValueResult); - - const CMIUtilString &rText(utilValue.GetChildValueCString()); - if (rText.empty()) - { - const CMICmnMIValueConst miValueConst(utilValue.GetValue()); - const CMICmnMIValueResult miValueResult("value", miValueConst); - miValueTuple.Add(miValueResult); - } - else + switch (veVarInfoFormat) { - if (utilValue.IsValueUnknown()) + case eVariableInfoFormat_NoValues: { - const CMICmnMIValueConst miValueConst(rText); - const CMICmnMIValueResult miValueResult("value", miValueConst); - miValueTuple.Add(miValueResult); + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + return vwrMiValueList.Add(miValueResult); } - else + case eVariableInfoFormat_AllValues: + case eVariableInfoFormat_SimpleValues: { - // Note code that has const in will not show the text suffix to the string pointer - // i.e. const char * pMyStr = "blah"; ==> "0x00007000"" <-- Eclipse shows this - // but char * pMyStr = "blah"; ==> "0x00007000" "blah"" <-- Eclipse shows this - const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%s %s", utilValue.GetValue().c_str(), rText.c_str())); - const CMICmnMIValueResult miValueResult("value", miValueConst); + // Append string text to the parent value information + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); miValueTuple.Add(miValueResult); + + const CMIUtilString &rText(utilValue.GetChildValueCString()); + if (rText.empty()) + { + const CMICmnMIValueConst miValueConst(utilValue.GetValue()); + const CMICmnMIValueResult miValueResult("value", miValueConst); + miValueTuple.Add(miValueResult); + } + else + { + if (utilValue.IsValueUnknown()) + { + const CMICmnMIValueConst miValueConst(rText); + const CMICmnMIValueResult miValueResult("value", miValueConst); + miValueTuple.Add(miValueResult); + } + else + { + // Note code that has const in will not show the text suffix to the string pointer + // i.e. const char * pMyStr = "blah"; ==> "0x00007000"" <-- Eclipse shows this + // but char * pMyStr = "blah"; ==> "0x00007000" "blah"" <-- Eclipse shows this + const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%s %s", utilValue.GetValue().c_str(), rText.c_str())); + const CMICmnMIValueResult miValueResult("value", miValueConst); + miValueTuple.Add(miValueResult); + } + } + break; } + default: + break; } return vwrMiValueList.Add(miValueTuple); } else { - // Build parent child composite types - CMICmnMIValueList miValueList(true); - for (MIuint i = 0; bOk && (i < nChildren); i++) + switch (veVarInfoFormat) { - lldb::SBValue member = rValue.GetChildAtIndex(i); - bOk = GetVariableInfo(vnMaxDepth, member, true, miValueList, ++vrwnDepth); + case eVariableInfoFormat_NoValues: + { + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + return vwrMiValueList.Add(miValueResult); + } + case eVariableInfoFormat_AllValues: + case eVariableInfoFormat_SimpleValues: + { + // Build parent child composite types + CMICmnMIValueList miValueList(true); + for (MIuint i = 0; bOk && (i < nChildren); i++) + { + lldb::SBValue member = rValue.GetChildAtIndex(i); + bOk = GetVariableInfo(vnMaxDepth, member, true, veVarInfoFormat, miValueList, ++vrwnDepth); + } + const CMICmnMIValueConst miValueConst(utilValue.GetName()); + const CMICmnMIValueResult miValueResult("name", miValueConst); + miValueTuple.Add(miValueResult); + const CMICmnMIValueConst miValueConst2(CMIUtilString::Format("{%s}", miValueList.ExtractContentNoBrackets().c_str())); + const CMICmnMIValueResult miValueResult2("value", miValueConst2); + miValueTuple.Add(miValueResult2); + break; + } + default: + break; } - const CMICmnMIValueConst miValueConst(utilValue.GetName()); - const CMICmnMIValueResult miValueResult("name", miValueConst); - miValueTuple.Add(miValueResult); - const CMICmnMIValueConst miValueConst2(CMIUtilString::Format("{%s}", miValueList.ExtractContentNoBrackets().c_str())); - const CMICmnMIValueResult miValueResult2("value", miValueConst2); - miValueTuple.Add(miValueResult2); return vwrMiValueList.Add(miValueTuple); } } Index: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp =================================================================== --- tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp +++ tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp @@ -1081,7 +1081,7 @@ { CMICmnMIValueList miValueList(true); const MIuint maskVarTypes = CMICmnLLDBDebugSessionInfo::eVariableType_Arguments; - bOk = rSession.MIResponseFormVariableInfo2(frame, maskVarTypes, miValueList); + bOk = rSession.MIResponseFormVariableInfo2(frame, maskVarTypes, CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues, miValueList); CMICmnMIValueTuple miValueTuple; bOk = bOk && rSession.MIResponseFormFrameInfo2(pc, miValueList.GetString(), fnName, fileName, path, nLine, miValueTuple); @@ -1157,7 +1157,7 @@ // Function args CMICmnMIValueList miValueList(true); const MIuint maskVarTypes = CMICmnLLDBDebugSessionInfo::eVariableType_Arguments; - if (!rSession.MIResponseFormVariableInfo2(frame, maskVarTypes, miValueList)) + if (!rSession.MIResponseFormVariableInfo2(frame, maskVarTypes, CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues, miValueList)) return MIstatus::failure; CMICmnMIValueTuple miValueTuple; if (!rSession.MIResponseFormFrameInfo2(pc, miValueList.GetString(), fnName, fileName, path, nLine, miValueTuple)) Index: tools/lldb-mi/MICmnResources.h =================================================================== --- tools/lldb-mi/MICmnResources.h +++ tools/lldb-mi/MICmnResources.h @@ -270,6 +270,7 @@ IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK, IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, IDS_CMD_ERR_INVALID_PROCESS, + IDS_CMD_ERR_INVALID_PRINT_VALUES, IDS_CMD_ERR_INVALID_FORMAT_TYPE, IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND, IDS_CMD_ERR_LLDB_ERR_WRITE_MEM_BYTES, Index: tools/lldb-mi/MICmnResources.cpp =================================================================== --- tools/lldb-mi/MICmnResources.cpp +++ tools/lldb-mi/MICmnResources.cpp @@ -254,6 +254,7 @@ {IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK, "Command '%s'. LLDB unable to read entire memory block of %u bytes at address 0x%08x"}, {IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to read memory block of %u bytes at address 0x%08x: %s "}, {IDS_CMD_ERR_INVALID_PROCESS, "Command '%s'. Invalid process during debug session"}, + {IDS_CMD_ERR_INVALID_PRINT_VALUES, "Command '%s'. Unknown value for PRINT_VALUES: must be: 0 for no-values, 1 for all-values, 2 for simple-values"}, {IDS_CMD_ERR_INVALID_FORMAT_TYPE, "Command '%s'. Invalid var format type '%s'"}, {IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND, "Command '%s'. Breakpoint information for breakpoint ID %d not found"}, {IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to write memory block of %u bytes at address 0x%08x: %s "},