VirtualBox

Changeset 75240 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 3, 2018 2:56:41 AM (6 years ago)
Author:
vboxsync
Message:

DBGFStack: Pick up RBP from AddrReturnFrame when trying use unwind info. Don't insist on far16/32 returns, convert to near if DBGFR3AddrFromSelOff fails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp

    r73495 r75240  
    543543                else if (pFrame->enmReturnType == RTDBGRETURNTYPE_NEAR32)
    544544                {
     545#if 1
     546                    /* Assumes returning 32-bit code. */
    545547                    pFrame->fFlags       |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN;
    546548                    pFrame->enmReturnType = RTDBGRETURNTYPE_FAR32;
    547549                    cbRetAddr = 8;
     550#else
     551                    /* Assumes returning 16-bit code. */
     552                    pFrame->fFlags       |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN;
     553                    pFrame->enmReturnType = RTDBGRETURNTYPE_FAR16;
     554                    cbRetAddr = 4;
     555#endif
    548556                }
    549557            }
     
    610618    }
    611619    else
     620    {
     621        int rc2;
    612622        switch (pFrame->enmReturnType)
    613623        {
     
    640650                break;
    641651            case RTDBGRETURNTYPE_FAR16:
    642                 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[1], uRet.pu16[0]);
     652                rc2 = DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[1], uRet.pu16[0]);
     653                if (RT_SUCCESS(rc2))
     654                    break;
     655                rc2 = DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, pFrame->AddrPC.Sel, uRet.pu16[0]);
     656                if (RT_SUCCESS(rc2))
     657                    pFrame->enmReturnType = RTDBGRETURNTYPE_NEAR16;
     658                else
     659                    DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[1], uRet.pu16[0]);
    643660                break;
    644661            case RTDBGRETURNTYPE_FAR32:
    645                 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[2], uRet.pu32[0]);
     662                rc2 = DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[2], uRet.pu32[0]);
     663                if (RT_SUCCESS(rc2))
     664                    break;
     665                rc2 = DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, pFrame->AddrPC.Sel, uRet.pu32[0]);
     666                if (RT_SUCCESS(rc2))
     667                    pFrame->enmReturnType = RTDBGRETURNTYPE_NEAR32;
     668                else
     669                    DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[2], uRet.pu32[0]);
    646670                break;
    647671            case RTDBGRETURNTYPE_FAR64:
     
    667691                return VERR_INVALID_PARAMETER;
    668692        }
     693    }
    669694
    670695
     
    726751        {
    727752            dbgfR3UnwindCtxSetPcAndSp(pUnwindCtx, &pFrame->AddrReturnPC, &pFrame->AddrReturnStack);
     753            pUnwindCtx->m_State.u.x86.auRegs[X86_GREG_xBP] = pFrame->AddrReturnFrame.off;
    728754        }
    729755        /** @todo Reevaluate CS if the previous frame return type isn't near. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette