VirtualBox

Changeset 64824 in vbox


Ignore:
Timestamp:
Dec 9, 2016 5:06:19 PM (8 years ago)
Author:
vboxsync
Message:

VMM/TRPM: Added 'trpmevent' dbg info command, useful and required esp. in guru meditation dumps.

File:
1 edited

Legend:

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

    r63429 r64824  
    434434static DECLCALLBACK(int) trpmR3Save(PVM pVM, PSSMHANDLE pSSM);
    435435static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
     436static DECLCALLBACK(void) trpmR3InfoEvent(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
    436437
    437438
     
    529530    if (RT_FAILURE(rc))
    530531        return rc;
     532
     533    /*
     534     * Register info handlers.
     535     */
     536    rc = DBGFR3InfoRegisterInternalEx(pVM, "trpmevent", "Dumps TRPM pending event.", trpmR3InfoEvent,
     537                                      DBGFINFO_FLAGS_ALL_EMTS);
     538    AssertRCReturn(rc, rc);
    531539
    532540    /*
     
    15831591}
    15841592
     1593
     1594/**
     1595 * Displays the pending TRPM event.
     1596 *
     1597 * @param   pVM         The cross context VM structure.
     1598 * @param   pHlp        The info helper functions.
     1599 * @param   pszArgs     Arguments, ignored.
     1600 */
     1601static DECLCALLBACK(void) trpmR3InfoEvent(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
     1602{
     1603    NOREF(pszArgs);
     1604    PVMCPU pVCpu = VMMGetCpu(pVM);
     1605    if (!pVCpu)
     1606        pVCpu = &pVM->aCpus[0];
     1607
     1608    uint8_t     uVector;
     1609    uint8_t     cbInstr;
     1610    TRPMEVENT   enmTrapEvent;
     1611    RTGCUINT    uErrorCode;
     1612    RTGCUINTPTR uCR2;
     1613    int rc = TRPMQueryTrapAll(pVCpu, &uVector, &enmTrapEvent, &uErrorCode, &uCR2, &cbInstr);
     1614    if (RT_SUCCESS(rc))
     1615    {
     1616        pHlp->pfnPrintf(pHlp, "CPU[%u]: TRPM event\n", pVCpu->idCpu);
     1617        static const char * const s_apszTrpmEventType[] =
     1618        {
     1619            "Trap",
     1620            "Hardware Int",
     1621            "Software Int"
     1622        };
     1623        if (RT_LIKELY(enmTrapEvent < RT_ELEMENTS(s_apszTrpmEventType)))
     1624        {
     1625            pHlp->pfnPrintf(pHlp, " Type       = %s\n", s_apszTrpmEventType[enmTrapEvent]);
     1626            pHlp->pfnPrintf(pHlp, " uVector    = %#x\n", uVector);
     1627            pHlp->pfnPrintf(pHlp, " uErrorCode = %#RGu\n", uErrorCode);
     1628            pHlp->pfnPrintf(pHlp, " uCR2       = %#RGp\n", uCR2);
     1629            pHlp->pfnPrintf(pHlp, " cbInstr    = %u bytes\n", cbInstr);
     1630        }
     1631        else
     1632            pHlp->pfnPrintf(pHlp, " Type       = %#x (Invalid!)\n", enmTrapEvent);
     1633    }
     1634    else if (rc == VERR_TRPM_NO_ACTIVE_TRAP)
     1635        pHlp->pfnPrintf(pHlp, "CPU[%u]: TRPM event (None)\n", pVCpu->idCpu);
     1636    else
     1637        pHlp->pfnPrintf(pHlp, "CPU[%u]: TRPM event - Query failed! rc=%Rrc\n", pVCpu->idCpu, rc);
     1638}
     1639
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