bool
RegisterContextPOSIXProcessMonitor_arm64::ReadRegister(const unsigned reg,
                                                       lldb_private::RegisterValue &value)
{
    ProcessMonitor &monitor = GetMonitor();
    return monitor.ReadRegisterValue(m_thread.GetID(),
                                     GetRegisterOffset(reg),
                                     GetRegisterName(reg),
                                     GetRegisterSize(reg),
                                     value);
}
Esempio n. 2
0
int NumberReg(char *input)
{
	int numreg = 0;
	int aux=0;
	FILE *file;
	char carac;

	file = fopen(input, "r");
	
	while(carac != EOF){
	
		carac = getc(file);
		aux ++;	
		if(aux % (GetRegisterSize()+1) == 0){
			numreg++;}
	}

	fclose(file);
	return numreg;
}
Esempio n. 3
0
//-----------------------------------------------------------------------------
// Name: MakeLogParamFromBuffer
// Object: fill a LogParam struct (winapioverride struct used for parameter parsing) from a buffer)
//          WARNING : do not call for top level (top level : NbPointedTimesFromRoot ==0 )
// Parameters :
//      CUserDataTypeVar* pUserDataTypeVar : user data type var from which make buffer ( not always current object )
//      PBYTE Buffer : current buffer from which extract data
//      SIZE_T BufferSize : current size of buffer containing data
//      OUT PARAMETER_LOG_INFOS* pLogInfos : filled struct
// Return : TRUE on success
//-----------------------------------------------------------------------------
BOOL CUserDataTypeVar::MakeLogParamFromBuffer(CUserDataTypeVar* pUserDataTypeVar , PBYTE Buffer, SIZE_T BufferSize,OUT PARAMETER_LOG_INFOS* pLogInfos)
{
    // default output parameter
    memset(pLogInfos,0,sizeof(PARAMETER_LOG_INFOS));
    // copy var name in output parameter
    _tcscpy(pLogInfos->pszParameterName,pUserDataTypeVar->VarName);

    // get parameter informations from CSupportedParameters static table
    SUPPORTED_PARAMETERS_STRUCT* pTypeInfos = CSupportedParameters::GetParamInfos(pUserDataTypeVar->pUserDataType->BaseType);

    // if pointer value
    if (pTypeInfos->DataSize==0) 
    {

        // NOT FOR TOP LEVEL (NbPointedTimesFromRoot !=0 ) 
        // data are lost, we can only access pointer value (not data) 
        // --> act as a pointer to display only pointer value
        pLogInfos->dwType = PARAM_POINTER;
        if ( BufferSize!=GetRegisterSize() )
            return FALSE;

        // copy buffer informations to struct
        pLogInfos->Value = 0;
        memcpy(&pLogInfos->Value,Buffer,__min(BufferSize,sizeof(PBYTE))); // works for 32 or 64 bits due to little endian representation
        pLogInfos->dwSizeOfData = sizeof(PBYTE);

        return TRUE;
    }


    /////////////////////////////
    // value isn't passed as ref
    /////////////////////////////

    // copy var type
    pLogInfos->dwType=pUserDataType->BaseType;

    // copy data size
    pLogInfos->dwSizeOfData = BufferSize;

    // according to data size, store value in OutputStruct.Value or OutputStruct.pValue
    if (BufferSize <= sizeof(PBYTE) )
    {
        if (BufferSize < sizeof(PBYTE) )
        {
            switch (BufferSize)
            {
            default:
            case 1:
                {
                    BYTE b;
                    b=*( (BYTE*)Buffer );
                    pLogInfos->Value = (PBYTE)b;
                }
                break;
            case 2:
                {
                    WORD w;
                    w=*( (WORD*)Buffer );
                    pLogInfos->Value = (PBYTE)w;
                }
                break;
            case 4:
                {
                    DWORD dw;
                    dw=*( (DWORD*)Buffer );
                    pLogInfos->Value = (PBYTE)dw;
                }
                break;
            }
        }
        else
            pLogInfos->Value = *( (PBYTE*)Buffer );

        // apply mask and shifting (mask and shifting can be applied only in this case)
        if (pUserDataTypeVar->pBitsFieldInfosList)
        {
            BITS_FIELD_INFOS* pBitsFieldInfos;
            CLinkListItem* pItem;
            for (pItem = pUserDataTypeVar->pBitsFieldInfosList->Head; pItem ;pItem = pItem->NextItem )
            {
                pBitsFieldInfos = (BITS_FIELD_INFOS*)pItem->ItemData;

                // apply shift
                pBitsFieldInfos->Value = (((ULONG_PTR)pLogInfos->Value) >> pBitsFieldInfos->Shift);
                // apply mask
                pBitsFieldInfos->Value = (((ULONG_PTR)pBitsFieldInfos->Value) & pBitsFieldInfos->MaskAfterShifting);
            }
        }
    }