VirtualBox

Changeset 35694 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jan 24, 2011 5:35:59 PM (14 years ago)
Author:
vboxsync
Message:

Debugger console: more cleanup.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
4 edited

Legend:

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

    r35348 r35694  
    26632663
    26642664#ifdef VBOX_WITH_DEBUGGER
     2665
    26652666/**
    26662667 * The '.csamoff' command.
     
    26752676static DECLCALLBACK(int) csamr3CmdOff(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult)
    26762677{
    2677     /*
    2678      * Validate input.
    2679      */
    2680     if (!pVM)
    2681         return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: The command requires VM to be selected.\n");
    2682 
    2683     CSAMDisableScanning(pVM);
    2684     return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "CSAM Scanning disabled\n");
     2678    DBGC_CMDHLP_REQ_VM_RET(pCmdHlp, pCmd, pVM);
     2679
     2680    int rc = CSAMDisableScanning(pVM);
     2681    if (RT_FAILURE(rc))
     2682        return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "CSAMDisableScanning");
     2683    return DBGCCmdHlpPrintf(pCmdHlp, "CSAM Scanning disabled\n");
    26852684}
    26862685
     
    26972696static DECLCALLBACK(int) csamr3CmdOn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult)
    26982697{
    2699     /*
    2700      * Validate input.
    2701      */
    2702     if (!pVM)
    2703         return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: The command requires VM to be selected.\n");
    2704 
    2705     CSAMEnableScanning(pVM);
    2706     return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "CSAM Scanning enabled\n");
    2707 }
    2708 #endif
     2698    DBGC_CMDHLP_REQ_VM_RET(pCmdHlp, pCmd, pVM);
     2699
     2700    int rc = CSAMEnableScanning(pVM);
     2701    if (RT_FAILURE(rc))
     2702        return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "CSAMEnableScanning");
     2703    return DBGCCmdHlpPrintf(pCmdHlp, "CSAM Scanning enabled\n");
     2704}
     2705
     2706#endif /* VBOX_WITH_DEBUGGER */
  • trunk/src/VBox/VMM/VMMR3/DBGFBp.cpp

    r35346 r35694  
    3838RT_C_DECLS_BEGIN
    3939static DECLCALLBACK(int) dbgfR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable,
    40                                         uint8_t u8Type, uint8_t cb, PRTUINT piBp);
    41 static DECLCALLBACK(int) dbgfR3BpSetInt3(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, PRTUINT piBp);
    42 static DECLCALLBACK(int) dbgfR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, PRTUINT piBp);
    43 static DECLCALLBACK(int) dbgfR3BpClear(PVM pVM, RTUINT iBp);
    44 static DECLCALLBACK(int) dbgfR3BpEnable(PVM pVM, RTUINT iBp);
    45 static DECLCALLBACK(int) dbgfR3BpDisable(PVM pVM, RTUINT iBp);
     40                                        uint8_t u8Type, uint8_t cb, uint32_t *piBp);
     41static DECLCALLBACK(int) dbgfR3BpSetInt3(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, uint32_t *piBp);
     42static DECLCALLBACK(int) dbgfR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, uint32_t *piBp);
     43static DECLCALLBACK(int) dbgfR3BpClear(PVM pVM, uint32_t iBp);
     44static DECLCALLBACK(int) dbgfR3BpEnable(PVM pVM, uint32_t iBp);
     45static DECLCALLBACK(int) dbgfR3BpDisable(PVM pVM, uint32_t iBp);
    4646static DECLCALLBACK(int) dbgfR3BpEnum(PVM pVM, PFNDBGFBPENUM pfnCallback, void *pvUser);
    4747static int dbgfR3BpRegArm(PVM pVM, PDBGFBP pBp);
     
    101101     * Determine which array to search.
    102102     */
    103     unsigned cBps;
    104     PRTUINT  pcBpsCur;
    105     PDBGFBP  paBps;
     103    unsigned    cBps;
     104    uint32_t   *pcBpsCur;
     105    PDBGFBP     paBps;
    106106    switch (enmType)
    107107    {
     
    149149 * @param   iBp     The breakpoint id.
    150150 */
    151 static PDBGFBP dbgfR3BpGet(PVM pVM, RTUINT iBp)
     151static PDBGFBP dbgfR3BpGet(PVM pVM, uint32_t iBp)
    152152{
    153153    /* Find it. */
     
    278278 * @thread  Any thread.
    279279 */
    280 VMMR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp)
     280VMMR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, uint32_t *piBp)
    281281{
    282282    /*
     
    303303 * @thread  Any thread.
    304304 */
    305 static DECLCALLBACK(int) dbgfR3BpSetInt3(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, PRTUINT piBp)
     305static DECLCALLBACK(int) dbgfR3BpSetInt3(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, uint32_t *piBp)
    306306{
    307307    /*
     
    435435 */
    436436VMMR3DECL(int) DBGFR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
    437                               uint8_t fType, uint8_t cb, PRTUINT piBp)
     437                              uint8_t fType, uint8_t cb, uint32_t *piBp)
    438438{
    439439    /** @todo SMP - broadcast, VT-x/AMD-V. */
     
    466466 */
    467467static DECLCALLBACK(int) dbgfR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable,
    468                                         uint8_t fType, uint8_t cb, PRTUINT piBp)
     468                                        uint8_t fType, uint8_t cb, uint32_t *piBp)
    469469{
    470470    /*
     
    603603 * @thread  Any thread.
    604604 */
    605 VMMR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp)
     605VMMR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, uint32_t *piBp)
    606606{
    607607    /*
     
    628628 * @internal
    629629 */
    630 static DECLCALLBACK(int) dbgfR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, PRTUINT piBp)
     630static DECLCALLBACK(int) dbgfR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, uint32_t *piBp)
    631631{
    632632    /*
     
    695695 * @thread  Any thread.
    696696 */
    697 VMMR3DECL(int) DBGFR3BpClear(PVM pVM, RTUINT iBp)
     697VMMR3DECL(int) DBGFR3BpClear(PVM pVM, uint32_t iBp)
    698698{
    699699    /*
     
    715715 * @internal
    716716 */
    717 static DECLCALLBACK(int) dbgfR3BpClear(PVM pVM, RTUINT iBp)
     717static DECLCALLBACK(int) dbgfR3BpClear(PVM pVM, uint32_t iBp)
    718718{
    719719    /*
     
    768768 * @thread  Any thread.
    769769 */
    770 VMMR3DECL(int) DBGFR3BpEnable(PVM pVM, RTUINT iBp)
     770VMMR3DECL(int) DBGFR3BpEnable(PVM pVM, uint32_t iBp)
    771771{
    772772    /*
     
    788788 * @internal
    789789 */
    790 static DECLCALLBACK(int) dbgfR3BpEnable(PVM pVM, RTUINT iBp)
     790static DECLCALLBACK(int) dbgfR3BpEnable(PVM pVM, uint32_t iBp)
    791791{
    792792    /*
     
    841841 * @thread  Any thread.
    842842 */
    843 VMMR3DECL(int) DBGFR3BpDisable(PVM pVM, RTUINT iBp)
     843VMMR3DECL(int) DBGFR3BpDisable(PVM pVM, uint32_t iBp)
    844844{
    845845    /*
     
    861861 * @internal
    862862 */
    863 static DECLCALLBACK(int) dbgfR3BpDisable(PVM pVM, RTUINT iBp)
     863static DECLCALLBACK(int) dbgfR3BpDisable(PVM pVM, uint32_t iBp)
    864864{
    865865    /*
  • trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp

    r35346 r35694  
    8686    {  1,           1,          DBGCVAR_CAT_STRING,     0,                              "direction",    "write/read." },
    8787    {  1,           1,          DBGCVAR_CAT_STRING,     0,                              "filename",     "Filename." },
    88     {  1,           1,          DBGCVAR_CAT_STRING,     0,                              "errcode",      "IPRT error code." },
     88    {  1,           1,          DBGCVAR_CAT_NUMBER,     0,                              "errcode",      "VBox status code." },
    8989};
    9090
     
    699699static DECLCALLBACK(int) pdmacEpFileErrorInject(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR pArgs, unsigned cArgs, PDBGCVAR pResult)
    700700{
    701     bool fWrite;
    702     PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile;
    703 
    704701    /*
    705702     * Validate input.
    706703     */
    707     if (!pVM)
    708         return DBGCCmdHlpPrintf(pCmdHlp, "error: The command requires a VM to be selected.\n");
    709     if (    cArgs != 3
    710         ||  pArgs[0].enmType != DBGCVAR_TYPE_STRING
    711         ||  pArgs[1].enmType != DBGCVAR_TYPE_STRING
    712         ||  pArgs[2].enmType != DBGCVAR_TYPE_STRING)
    713         return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: parser error, invalid arguments.\n");
    714 
     704    DBGC_CMDHLP_REQ_VM_RET(pCmdHlp, pCmd, pVM);
     705    DBGC_CMDHLP_ASSERT_PARSER_RET(pCmdHlp, pCmd, -1, cArgs == 3);
     706    DBGC_CMDHLP_ASSERT_PARSER_RET(pCmdHlp, pCmd, 0, pArgs[0].enmType == DBGCVAR_TYPE_STRING);
     707    DBGC_CMDHLP_ASSERT_PARSER_RET(pCmdHlp, pCmd, 1, pArgs[1].enmType == DBGCVAR_TYPE_STRING);
     708    DBGC_CMDHLP_ASSERT_PARSER_RET(pCmdHlp, pCmd, 2, pArgs[2].enmType == DBGCVAR_TYPE_NUMBER);
     709
     710    PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile;
    715711    pEpClassFile = (PPDMASYNCCOMPLETIONEPCLASSFILE)pVM->pUVM->pdm.s.apAsyncCompletionEndpointClass[PDMASYNCCOMPLETIONEPCLASSTYPE_FILE];
    716712
    717713    /* Syntax is "read|write <filename> <status code>" */
     714    bool fWrite;
    718715    if (!RTStrCmp(pArgs[0].u.pszString, "read"))
    719716        fWrite = false;
     
    721718        fWrite = true;
    722719    else
    723     {
    724         DBGCCmdHlpPrintf(pCmdHlp, "error: invalid transefr direction '%s'.\n", pArgs[0].u.pszString);
    725         return VINF_SUCCESS;
    726     }
    727 
    728     /* Search for the matching endpoint. */
     720        return DBGCCmdHlpFail(pCmdHlp, pCmd, "invalid transfer direction '%s'", pArgs[0].u.pszString);
     721
     722    int32_t rcToInject = (int32_t)pArgs[2].u.u64Number;
     723    if ((uint64_t)rcToInject != pArgs[2].u.u64Number)
     724        return DBGCCmdHlpFail(pCmdHlp, pCmd, "The status code '%lld' is out of range", pArgs[0].u.u64Number);
     725
     726
     727    /*
     728     * Search for the matching endpoint.
     729     */
    729730    RTCritSectEnter(&pEpClassFile->Core.CritSect);
     731
    730732    PPDMASYNCCOMPLETIONENDPOINTFILE pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEpClassFile->Core.pEndpointsHead;
    731 
    732733    while (pEpFile)
    733734    {
     
    736737        pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEpFile->Core.pNext;
    737738    }
    738 
    739739    if (pEpFile)
    740740    {
    741         int rcToInject = RTStrToInt32(pArgs[2].u.pszString);
    742 
     741        /*
     742         * Do the job.
     743         */
    743744        if (fWrite)
    744745            ASMAtomicXchgS32(&pEpFile->rcReqWrite, rcToInject);
    745746        else
    746             ASMAtomicXchgS32(&pEpFile->rcReqRead, rcToInject);
    747 
    748             DBGCCmdHlpPrintf(pCmdHlp, "Injected %Rrc into '%s' for %s\n",
    749                              rcToInject, pArgs[1].u.pszString, pArgs[0].u.pszString);
    750     }
    751     else
    752         DBGCCmdHlpPrintf(pCmdHlp, "No file with name '%s' found\n", NULL, pArgs[1].u.pszString);
     747            ASMAtomicXchgS32(&pEpFile->rcReqRead,  rcToInject);
     748
     749        DBGCCmdHlpPrintf(pCmdHlp, "Injected %Rrc into '%s' for %s\n",
     750                         (int)rcToInject, pArgs[1].u.pszString, pArgs[0].u.pszString);
     751    }
    753752
    754753    RTCritSectLeave(&pEpClassFile->Core.CritSect);
     754
     755    if (!pEpFile)
     756        return DBGCCmdHlpFail(pCmdHlp, pCmd, "No file with name '%s' found", pArgs[1].u.pszString);
    755757    return VINF_SUCCESS;
    756758}
    757 #endif
     759#endif /* VBOX_WITH_DEBUGGER */
    758760
    759761static int pdmacFileInitialize(PPDMASYNCCOMPLETIONEPCLASS pClassGlobals, PCFGMNODE pCfgNode)
     
    830832    if (RT_SUCCESS(rc))
    831833    {
    832         rc = DBGCRegisterCommands(&g_aCmds[0], 1);
     834        rc = DBGCRegisterCommands(&g_aCmds[0], RT_ELEMENTS(g_aCmds));
    833835        AssertRC(rc);
    834836    }
  • trunk/src/VBox/VMM/VMMR3/STAM.cpp

    r35346 r35694  
    172172{
    173173    /* pszCmd,      cArgsMin, cArgsMax, paArgDesc,          cArgDescs,                  pResultDesc,        fFlags,     pfnHandler          pszSyntax,          ....pszDescription */
    174     { "stats",      0,        1,        &g_aArgPat[0],      RT_ELEMENTS(g_aArgPat),        NULL,               0,          stamR3CmdStats,     "[pattern]",        "Display statistics." },
    175     { "statsreset", 0,        1,        &g_aArgPat[0],      RT_ELEMENTS(g_aArgPat),        NULL,               0,          stamR3CmdStatsReset,"[pattern]",        "Resets statistics." }
     174    { "stats",      0,        1,        &g_aArgPat[0],      RT_ELEMENTS(g_aArgPat),     NULL,               0,          stamR3CmdStats,     "[pattern]",        "Display statistics." },
     175    { "statsreset", 0,        1,        &g_aArgPat[0],      RT_ELEMENTS(g_aArgPat),     NULL,               0,          stamR3CmdStatsReset,"[pattern]",        "Resets statistics." }
    176176};
    177177#endif
     
    19221922     * Validate input.
    19231923     */
    1924     if (!pVM)
    1925         return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: The command requires VM to be selected.\n");
     1924    DBGC_CMDHLP_REQ_VM_RET(pCmdHlp, pCmd, pVM);
    19261925    PUVM pUVM = pVM->pUVM;
    19271926    if (!pUVM->stam.s.pHead)
    1928         return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Sorry, no statistics present.\n");
     1927        return DBGCCmdHlpFail(pCmdHlp, pCmd, "No statistics present");
    19291928
    19301929    /*
     
    19321931     */
    19331932    STAMR3PRINTONEARGS Args;
    1934     Args.pVM = pVM;
    1935     Args.pvArg = pCmdHlp;
    1936     Args.pfnPrintf = stamR3EnumDbgfPrintf;
     1933    Args.pVM        = pVM;
     1934    Args.pvArg      = pCmdHlp;
     1935    Args.pfnPrintf  = stamR3EnumDbgfPrintf;
    19371936
    19381937    return stamR3EnumU(pUVM, cArgs ? paArgs[0].u.pszString : NULL, true /* fUpdateRing0 */, stamR3PrintOne, &Args);
     
    19741973     * Validate input.
    19751974     */
    1976     if (!pVM)
    1977         return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: The command requires VM to be selected.\n");
     1975    DBGC_CMDHLP_REQ_VM_RET(pCmdHlp, pCmd, pVM);
    19781976    PUVM pUVM = pVM->pUVM;
    19791977    if (!pUVM->stam.s.pHead)
    1980         return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Sorry, no statistics present.\n");
     1978        return DBGCCmdHlpFail(pCmdHlp, pCmd, "No statistics present");
    19811979
    19821980    /*
     
    19851983    int rc = STAMR3ResetU(pUVM, cArgs ? paArgs[0].u.pszString : NULL);
    19861984    if (RT_SUCCESS(rc))
    1987         return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "info: Statistics reset.\n");
    1988 
    1989     return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "Resetting statistics.\n");
     1985        return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "STAMR3ResetU");
     1986    return DBGCCmdHlpPrintf(pCmdHlp, "Statistics have been reset.\n");
    19901987}
    19911988
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