//++ ------------------------------------------------------------------------------------ // Details: Form MI partial response by appending more MI value type objects to the // tuple type object past in. // Type: Method. // Args: vrFrame - (R) LLDB thread object. // vMaskVarTypes - (R) 0x1000 = arguments, // 0x0100 = locals, // 0x0010 = statics, // 0x0001 = in scope only. // vwrMIValueList - (W) MI value list object. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. // Throws: None. //-- bool CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo( const lldb::SBFrame & vrFrame, const MIuint vMaskVarTypes, CMICmnMIValueList & vwrMiValueList ) { bool bOk = MIstatus::success; lldb::SBFrame & rFrame = const_cast< lldb::SBFrame & >( vrFrame ); const bool bArg = (vMaskVarTypes & 0x1000); const bool bLocals = (vMaskVarTypes & 0x0100); const bool bStatics = (vMaskVarTypes & 0x0010); const bool bInScopeOnly = (vMaskVarTypes & 0x0001); const MIchar * pUnkwn = "??"; lldb::SBValueList listArg = rFrame.GetVariables( bArg, bLocals, bStatics, bInScopeOnly ); const MIuint nArgs = listArg.GetSize(); for( MIuint i = 0; bOk && (i < nArgs); i++ ) { lldb::SBValue val = listArg.GetValueAtIndex( i ); const char * pValue = val.GetValue(); pValue = (pValue != nullptr) ? pValue : pUnkwn; const char * pName = val.GetName(); pName = (pName != nullptr) ? pName : pUnkwn; const CMICmnMIValueConst miValueConst( pName ); const CMICmnMIValueResult miValueResult( "name", miValueConst ); CMICmnMIValueTuple miValueTuple( miValueResult ); const CMICmnMIValueConst miValueConst2( pValue ); const CMICmnMIValueResult miValueResult2( "value", miValueConst2 ); miValueTuple.Add( miValueResult2 ); bOk = vwrMiValueList.Add( miValueTuple ); } return bOk; }
bool CMICmnLLDBDebugSessionInfo::MIResponseForVariableInfoInternal(const VariableInfoFormat_e veVarInfoFormat, CMICmnMIValueList &vwrMiValueList, const lldb::SBValueList &vwrSBValueList, const MIuint vnMaxDepth, const bool vbIsArgs, const bool vbMarkArgs) { const MIuint nArgs = vwrSBValueList.GetSize(); for (MIuint i = 0; i < nArgs; i++) { CMICmnMIValueTuple miValueTuple; lldb::SBValue value = vwrSBValueList.GetValueAtIndex(i); const CMICmnMIValueConst miValueConst(value.GetName()); const CMICmnMIValueResult miValueResultName("name", miValueConst); if (vbMarkArgs && vbIsArgs) { const CMICmnMIValueConst miValueConstArg("1"); const CMICmnMIValueResult miValueResultArg("arg", miValueConstArg); miValueTuple.Add(miValueResultArg); } if (veVarInfoFormat != eVariableInfoFormat_NoValues) { miValueTuple.Add(miValueResultName); // name if (veVarInfoFormat == eVariableInfoFormat_SimpleValues) { const CMICmnMIValueConst miValueConst3(value.GetTypeName()); const CMICmnMIValueResult miValueResult3("type", miValueConst3); miValueTuple.Add(miValueResult3); } const MIuint nChildren = value.GetNumChildren(); const bool bIsPointerType = value.GetType().IsPointerType(); if (nChildren == 0 || // no children (bIsPointerType && nChildren == 1) || // pointers veVarInfoFormat == eVariableInfoFormat_AllValues) // show all values { CMIUtilString strValue; if (GetVariableInfo(value, vnMaxDepth == 0, strValue)) { const CMICmnMIValueConst miValueConst2(strValue.Escape().AddSlashes()); const CMICmnMIValueResult miValueResult2("value", miValueConst2); miValueTuple.Add(miValueResult2); } } vwrMiValueList.Add(miValueTuple); continue; } if (vbMarkArgs) { // If we are printing names only with vbMarkArgs, we still need to add the name to the value tuple miValueTuple.Add(miValueResultName); // name vwrMiValueList.Add(miValueTuple); } else { // If we are printing name only then no need to put it in the tuple. vwrMiValueList.Add(miValueResultName); } } return MIstatus::success; }