Пример #1
0
//++ ------------------------------------------------------------------------------------
// Details: Retrieve the specified thread's frame information.
// Type:    Method.
// Args:    vCmdData        - (R) A command's information.
//          vThreadIdx      - (R) Thread index.
//          vwrThreadFrames - (W) Frame data.
// Return:  MIstatus::success - Functional succeeded.
//          MIstatus::failure - Functional failed.
// Throws:  None.
//--
bool
CMICmnLLDBDebugSessionInfo::GetThreadFrames(const SMICmdData &vCmdData, const MIuint vThreadIdx, const FrameInfoFormat_e veFrameInfoFormat,
                                            CMIUtilString &vwrThreadFrames)
{
    lldb::SBThread thread = GetProcess().GetThreadByIndexID(vThreadIdx);
    const uint32_t nFrames = thread.GetNumFrames();
    if (nFrames == 0)
    {
        // MI print "frame={}"
        CMICmnMIValueTuple miValueTuple;
        CMICmnMIValueResult miValueResult("frame", miValueTuple);
        vwrThreadFrames = miValueResult.GetString();
        return MIstatus::success;
    }

    // MI print
    // "frame={level=\"%d\",addr=\"0x%016" PRIx64 "\",func=\"%s\",args=[%s],file=\"%s\",fullname=\"%s\",line=\"%d\"},frame={level=\"%d\",addr=\"0x%016" PRIx64 "\",func=\"%s\",args=[%s],file=\"%s\",fullname=\"%s\",line=\"%d\"},
    // ..."
    CMIUtilString strListCommaSeparated;
    for (MIuint nLevel = 0; nLevel < nFrames; nLevel++)
    {
        CMICmnMIValueTuple miValueTuple;
        if (!MIResponseFormFrameInfo(thread, nLevel, veFrameInfoFormat, miValueTuple))
            return MIstatus::failure;

        const CMICmnMIValueResult miValueResult2("frame", miValueTuple);
        if (nLevel != 0)
            strListCommaSeparated += ",";
        strListCommaSeparated += miValueResult2.GetString();
    }

    vwrThreadFrames = strListCommaSeparated;

    return MIstatus::success;
}
//++ ------------------------------------------------------------------------------------
// Details: Add another MI result object to the value's list of tuples.
// Type:    Method.
// Args:    vResult - (R) The MI result object.
// Return:  MIstatus::success - Functional succeeded.
//          MIstatus::failure - Functional failed.
// Throws:  None.
//--
bool
CMICmnMIValueTuple::BuildTuple(const CMICmnMIValueResult &vResult)
{
    // Clear out the default "<Invalid>" text
    if (m_bJustConstructed)
    {
        m_bJustConstructed = false;
        m_strValue = vResult.GetString();
        return BuildTuple();
    }

    if (m_strValue[0] == '{')
    {
        m_strValue = m_strValue.substr(1, m_strValue.size() - 1);
    }
    if (m_strValue[m_strValue.size() - 1] == '}')
    {
        m_strValue = m_strValue.substr(0, m_strValue.size() - 1);
    }

    const MIchar *pFormat = m_bSpaceAfterComma ? "{%s, %s}" : "{%s,%s}";
    m_strValue = CMIUtilString::Format(pFormat, m_strValue.c_str(), vResult.GetString().c_str());

    return MIstatus::success;
}
Пример #3
0
//++
//------------------------------------------------------------------------------------
// Details: Add another MI result object to  the value list's of list is
// results.
//          Only result objects can be added to a list of result otherwise this
//          function
//          will return MIstatus::failure.
// Type:    Method.
// Args:    vResult - (R) The MI result object.
// Return:  None.
// Throws:  None.
//--
void CMICmnMIValueList::BuildList(const CMICmnMIValueResult &vResult) {
  // Clear out the default "<Invalid>" text
  if (m_bJustConstructed) {
    m_bJustConstructed = false;
    m_strValue = vResult.GetString();
    BuildList();
    return;
  }

  const CMIUtilString data(ExtractContentNoBrackets());
  const char *pFormat = "[%s,%s]";
  m_strValue =
      CMIUtilString::Format(pFormat, data.c_str(), vResult.GetString().c_str());
}
//++ ------------------------------------------------------------------------------------
// Details: CMICmnMIValueTuple constructor.
// Type:    Method.
// Args:    vResult         - (R) MI result object.
//          vbUseSpacing    - (R) True = put space seperators into the string, false = no spaces used.
// Return:  None.
// Throws:  None.
//--
CMICmnMIValueTuple::CMICmnMIValueTuple(const CMICmnMIValueResult &vResult, const bool vbUseSpacing)
    : m_bSpaceAfterComma(vbUseSpacing)
{
    m_strValue = vResult.GetString();
    BuildTuple();
    m_bJustConstructed = false;
}
Пример #5
0
//++ ------------------------------------------------------------------------------------
// Details:	Add another MI result object to  the value list's of list is results. 
//			Only result obejcts can be added to a list of result otherwise this function 
//			will return MIstatus::failure.
// Type:	Method.
// Args:	vResult	- (R) The MI result object.
// Return:	MIstatus::success - Functional succeeded.
//			MIstatus::failure - Functional failed.
// Throws:	None.
//--
bool CMICmnMIValueList::BuildList( const CMICmnMIValueResult & vResult )
{
	// Clear out the default "<Invalid>" text
	if( m_bJustConstructed )
	{
		m_bJustConstructed = false;
		m_strValue = vResult.GetString();
		return BuildList();
	}

	if( m_strValue[ 0 ] == '[' )
	{
		m_strValue = m_strValue.substr( 1, m_strValue.size() - 1 );
	}
	if( m_strValue[ m_strValue.size() - 1 ] == ']' )
	{
		m_strValue = m_strValue.substr( 0, m_strValue.size() - 1 );
	}

	const MIchar * pFormat = "[%s,%s]";
	m_strValue = CMIUtilString::Format( pFormat, m_strValue.c_str(), vResult.GetString().c_str() );

	return MIstatus::success;
}
Пример #6
0
//++
//------------------------------------------------------------------------------------
// Details: CMICmnMIValueList constructor.
//          Construct a results only list.
//          return MIstatus::failure.
// Type:    Method.
// Args:    vResult - (R) MI result object.
// Return:  None.
// Throws:  None.
//--
CMICmnMIValueList::CMICmnMIValueList(const CMICmnMIValueResult &vResult) {
  m_strValue = vResult.GetString();
  BuildList();
  m_bJustConstructed = false;
}
Пример #7
0
//++ ------------------------------------------------------------------------------------
// Details: Add to *this Out-of-band record additional information.
// Type:    Method.
// Args:    vResult           - (R) A MI result object.
// Return:  None.
// Throws:  None.
//--
void
CMICmnMIOutOfBandRecord::Add(const CMICmnMIValueResult &vResult)
{
    m_strAsyncRecord += ",";
    m_strAsyncRecord += vResult.GetString();
}