Exemplo n.º 1
0
//++ ------------------------------------------------------------------------------------
// Details: Extract the value's name and value or recurse into child value object.
// Type:    Method.
// Args:    vrValue         - (R)  LLDB value object.
//          vbInSimpleForm  - (R)  True = Get variable info in simple form (i.e. don't expand aggregates).
//                          -      False = Get variable info (and expand aggregates if any).
//          vwrStrValue  t  - (W)  The string representation of this value.
// Return:  MIstatus::success - Functional succeeded.
//          MIstatus::failure - Functional failed.
// Throws:  None.
//--
bool
CMICmnLLDBDebugSessionInfo::GetVariableInfo(const lldb::SBValue &vrValue, const bool vbInSimpleForm, CMIUtilString &vwrStrValue)
{
    const CMICmnLLDBUtilSBValue utilValue(vrValue, true, false);
    const bool bExpandAggregates = vbInSimpleForm ? false : true;
    vwrStrValue = utilValue.GetValue(bExpandAggregates);
    return MIstatus::success;
}
//++ ------------------------------------------------------------------------------------
// Details: Return the equivalent var value formatted string for the given value type,
//          which was prepared for printing (i.e. value was escaped and now it's ready
//          for wrapping into quotes).
//          The SBValue vrValue parameter is checked by LLDB private code for valid
//          scalar type via MI Driver proxy function as the valued returned can also be
//          an error condition. The proxy function determines if the check was valid
//          otherwise return an error condition state by other means saying so.
// Type:    Static method.
// Args:    vrValue     - (R) The var value object.
//          veVarFormat - (R) Var format enumeration.
// Returns: CMIUtilString   - Value formatted string.
// Throws:  None.
//--
CMIUtilString
CMICmnLLDBDebugSessionInfoVarObj::GetValueStringFormatted(const lldb::SBValue &vrValue,
                                                          const CMICmnLLDBDebugSessionInfoVarObj::varFormat_e veVarFormat)
{
    const CMICmnLLDBUtilSBValue utilValue(vrValue, true);
    if (utilValue.IsIntegerType())
    {
        MIuint64 nValue = 0;
        if (CMICmnLLDBProxySBValue::GetValueAsUnsigned(vrValue, nValue))
        {
            lldb::SBValue &rValue = const_cast<lldb::SBValue &>(vrValue);
            return GetStringFormatted(nValue, rValue.GetValue(), veVarFormat);
        }
    }

    return utilValue.GetValue().AddSlashes();
}