コード例 #1
0
bool UnixNativeCodeManager::FindMethodInfo(PTR_VOID        ControlPC, 
                                           MethodInfo *    pMethodInfoOut)
{
    UnixNativeMethodInfo * pMethodInfo = (UnixNativeMethodInfo *)pMethodInfoOut;
    UIntNative startAddress;
    UIntNative lsda;

    if (!FindProcInfo((UIntNative)ControlPC, &startAddress, &lsda))
    {
        return false;
    }

    PTR_UInt8 lsdaPtr = dac_cast<PTR_UInt8>(lsda);

    int offsetFromMainFunction = *dac_cast<PTR_Int32>(lsdaPtr);
    lsdaPtr += sizeof(int);
    pMethodInfo->funcFlags = *lsdaPtr;
    ++lsdaPtr;

    PTR_UInt8 ehInfoPtr = NULL;
    if (pMethodInfo->funcFlags & UBF_FUNC_HAS_EHINFO)
    {
        // main function contains the EH info blob in its LSDA, funclets just refer
        // to the main function's blob
        if (offsetFromMainFunction == 0)
        {
            ehInfoPtr = lsdaPtr;
        }
        else
        {
            Int32 relAddr = *dac_cast<PTR_Int32>(lsdaPtr);
            lsdaPtr += sizeof(Int32);
            ehInfoPtr = lsdaPtr + relAddr;
        }
    }

    pMethodInfo->pMethodStartAddress = (PTR_VOID)(startAddress - offsetFromMainFunction);
    pMethodInfo->pEhInfo = ehInfoPtr;
    pMethodInfo->executionAborted = false;

    return true;
}
コード例 #2
0
bool UnixNativeCodeManager::FindMethodInfo(PTR_VOID        ControlPC, 
                                           MethodInfo *    pMethodInfoOut)
{
    UnixNativeMethodInfo * pMethodInfo = (UnixNativeMethodInfo *)pMethodInfoOut;
    UIntNative startAddress;
    UIntNative lsda;

    if (!FindProcInfo((UIntNative)ControlPC, &startAddress, &lsda))
    {
        return false;
    }

    PTR_UInt8 p = dac_cast<PTR_UInt8>(lsda);

    pMethodInfo->pLSDA = p;

    uint8_t unwindBlockFlags = *p++;

    if ((unwindBlockFlags & UBF_FUNC_KIND_MASK) != UBF_FUNC_KIND_ROOT)
    {
        // Funclets just refer to the main function's blob
        pMethodInfo->pMainLSDA = p + *dac_cast<PTR_Int32>(p);
        p += sizeof(int32_t);

        pMethodInfo->pMethodStartAddress = dac_cast<PTR_VOID>(startAddress - *dac_cast<PTR_Int32>(p));
    }
    else
    {
        pMethodInfo->pMainLSDA = dac_cast<PTR_UInt8>(lsda);
        pMethodInfo->pMethodStartAddress = dac_cast<PTR_VOID>(startAddress);
    }

    pMethodInfo->executionAborted = false;

    return true;
}