VirtualBox

Changeset 35629 in vbox for trunk/src/VBox/Debugger


Ignore:
Timestamp:
Jan 19, 2011 3:15:21 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69534
Message:

tstDBGCParse: more tests.

Location:
trunk/src/VBox/Debugger
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGCInternal.h

    r35628 r35629  
    152152    /** Pointer to the current VM. */
    153153    PVM                 pVM;
    154     /** The current virtual CPU id. */
     154    /** The ID of current virtual CPU. */
    155155    VMCPUID             idCpu;
    156156    /** The current address space handle. */
  • trunk/src/VBox/Debugger/DBGConsole.cpp

    r35628 r35629  
    861861    pDbgc->pBack            = pBack;
    862862    pDbgc->pVM              = NULL;
    863     pDbgc->idCpu            = NIL_VMCPUID;
     863    pDbgc->idCpu            = 0;
    864864    pDbgc->hDbgAs           = DBGF_AS_GLOBAL;
    865865    pDbgc->pszEmulation     = "CodeView/WinDbg";
     
    975975        if (RT_SUCCESS(rc))
    976976        {
    977             pDbgc->pVM = pVM;
     977            pDbgc->pVM   = pVM;
    978978            pDbgc->idCpu = 0;
    979979            rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,
  • trunk/src/VBox/Debugger/testcase/tstDBGCParser.cpp

    r31932 r35629  
    55
    66/*
    7  * Copyright (C) 2006-2010 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3030*******************************************************************************/
    3131static DECLCALLBACK(bool) tstDBGCBackInput(PDBGCBACK pBack, uint32_t cMillies);
    32 static DECLCALLBACK(int) tstDBGCBackRead(PDBGCBACK pBack, void *pvBuf, size_t cbBuf, size_t *pcbRead);
    33 static DECLCALLBACK(int) tstDBGCBackWrite(PDBGCBACK pBack, const void *pvBuf, size_t cbBuf, size_t *pcbWritten);
     32static DECLCALLBACK(int)  tstDBGCBackRead(PDBGCBACK pBack, void *pvBuf, size_t cbBuf, size_t *pcbRead);
     33static DECLCALLBACK(int)  tstDBGCBackWrite(PDBGCBACK pBack, const void *pvBuf, size_t cbBuf, size_t *pcbWritten);
    3434static DECLCALLBACK(void) tstDBGCBackSetReady(PDBGCBACK pBack, bool fReady);
    3535
     
    269269     * Create a DBGC instance.
    270270     */
     271    RTTestSub(g_hTest, "dbgcCreate");
    271272    PDBGC pDbgc;
    272273    rc = dbgcCreate(&pDbgc, &g_tstBack, 0);
     
    277278        if (RT_SUCCESS(rc))
    278279        {
     280            RTTestSub(g_hTest, "basic parsing");
    279281            tstTry(pDbgc, "stop\n", VINF_SUCCESS);
    280282            tstTry(pDbgc, "format 1\n", VINF_SUCCESS);
     
    283285            tstTry(pDbgc, "sa 3 23 4 'q' \"21123123\" 'b' \n", VINF_SUCCESS);
    284286
    285             tstNumOp(pDbgc, "1",                                        1);
    286             tstNumOp(pDbgc, "1",                                        1);
    287             tstNumOp(pDbgc, "1",                                        1);
    288 
    289             tstNumOp(pDbgc, "+1",                                       1);
    290             tstNumOp(pDbgc, "++++++1",                                  1);
    291 
    292             tstNumOp(pDbgc, "-1",                                       UINT64_MAX);
    293             tstNumOp(pDbgc, "--1",                                      1);
    294             tstNumOp(pDbgc, "---1",                                     UINT64_MAX);
    295             tstNumOp(pDbgc, "----1",                                    1);
    296 
    297             tstNumOp(pDbgc, "~0",                                       UINT64_MAX);
    298             tstNumOp(pDbgc, "~1",                                       UINT64_MAX-1);
    299             tstNumOp(pDbgc, "~~0",                                      0);
    300             tstNumOp(pDbgc, "~~1",                                      1);
    301 
    302             tstNumOp(pDbgc, "!1",                                       0);
    303             tstNumOp(pDbgc, "!0",                                       1);
    304             tstNumOp(pDbgc, "!42",                                      0);
    305             tstNumOp(pDbgc, "!!42",                                     1);
    306             tstNumOp(pDbgc, "!!!42",                                    0);
    307             tstNumOp(pDbgc, "!!!!42",                                   1);
    308 
    309             tstNumOp(pDbgc, "1 +1",                                     2);
    310             tstNumOp(pDbgc, "1 + 1",                                    2);
    311             tstNumOp(pDbgc, "1+1",                                      2);
    312             tstNumOp(pDbgc, "1+ 1",                                     2);
    313 
    314             tstNumOp(pDbgc, "1 - 1",                                    0);
    315             tstNumOp(pDbgc, "99 - 90",                                  9);
    316 
    317             tstNumOp(pDbgc, "2 * 2",                                    4);
    318 
    319             tstNumOp(pDbgc, "2 / 2",                                    1);
    320             tstNumOp(pDbgc, "2 / 0",                                    UINT64_MAX);
    321             tstNumOp(pDbgc, "0i1024 / 0i4",                             256);
    322 
    323             tstNumOp(pDbgc, "1<<1",                                     2);
    324             tstNumOp(pDbgc, "1<<0i32",                                  UINT64_C(0x0000000100000000));
    325             tstNumOp(pDbgc, "1<<0i48",                                  UINT64_C(0x0001000000000000));
    326             tstNumOp(pDbgc, "1<<0i63",                                  UINT64_C(0x8000000000000000));
    327 
    328             tstNumOp(pDbgc, "fedcba0987654321>>0i04",                   UINT64_C(0x0fedcba098765432));
    329             tstNumOp(pDbgc, "fedcba0987654321>>0i32",                   UINT64_C(0xfedcba09));
    330             tstNumOp(pDbgc, "fedcba0987654321>>0i48",                   UINT64_C(0x0000fedc));
    331 
    332             tstNumOp(pDbgc, "0ef & 4",                                  4);
    333             tstNumOp(pDbgc, "01234567891 & fff",                        UINT64_C(0x00000000891));
    334             tstNumOp(pDbgc, "01234567891 & ~fff",                       UINT64_C(0x01234567000));
    335 
    336             tstNumOp(pDbgc, "1 | 1",                                    1);
    337             tstNumOp(pDbgc, "0 | 4",                                    4);
    338             tstNumOp(pDbgc, "4 | 0",                                    4);
    339             tstNumOp(pDbgc, "4 | 4",                                    4);
    340             tstNumOp(pDbgc, "1 | 4 | 2",                                7);
    341 
    342             tstNumOp(pDbgc, "1 ^ 1",                                    0);
    343             tstNumOp(pDbgc, "1 ^ 0",                                    1);
    344             tstNumOp(pDbgc, "0 ^ 1",                                    1);
    345             tstNumOp(pDbgc, "3 ^ 1",                                    2);
    346             tstNumOp(pDbgc, "7 ^ 3",                                    4);
    347 
    348             tstNumOp(pDbgc, "7 || 3",                                   1);
    349             tstNumOp(pDbgc, "1 || 0",                                   1);
    350             tstNumOp(pDbgc, "0 || 1",                                   1);
    351             tstNumOp(pDbgc, "0 || 0",                                   0);
    352 
    353             tstNumOp(pDbgc, "0 && 0",                                   0);
    354             tstNumOp(pDbgc, "1 && 0",                                   0);
    355             tstNumOp(pDbgc, "0 && 1",                                   0);
    356             tstNumOp(pDbgc, "1 && 1",                                   1);
    357             tstNumOp(pDbgc, "4 && 1",                                   1);
    358 
     287            if (RTTestErrorCount(g_hTest) == 0)
     288            {
     289                RTTestSub(g_hTest, "Operators");
     290                tstNumOp(pDbgc, "1",                                        1);
     291                tstNumOp(pDbgc, "1",                                        1);
     292                tstNumOp(pDbgc, "1",                                        1);
     293
     294                tstNumOp(pDbgc, "+1",                                       1);
     295                tstNumOp(pDbgc, "++++++1",                                  1);
     296
     297                tstNumOp(pDbgc, "-1",                                       UINT64_MAX);
     298                tstNumOp(pDbgc, "--1",                                      1);
     299                tstNumOp(pDbgc, "---1",                                     UINT64_MAX);
     300                tstNumOp(pDbgc, "----1",                                    1);
     301
     302                tstNumOp(pDbgc, "~0",                                       UINT64_MAX);
     303                tstNumOp(pDbgc, "~1",                                       UINT64_MAX-1);
     304                tstNumOp(pDbgc, "~~0",                                      0);
     305                tstNumOp(pDbgc, "~~1",                                      1);
     306
     307                tstNumOp(pDbgc, "!1",                                       0);
     308                tstNumOp(pDbgc, "!0",                                       1);
     309                tstNumOp(pDbgc, "!42",                                      0);
     310                tstNumOp(pDbgc, "!!42",                                     1);
     311                tstNumOp(pDbgc, "!!!42",                                    0);
     312                tstNumOp(pDbgc, "!!!!42",                                   1);
     313
     314                tstNumOp(pDbgc, "1 +1",                                     2);
     315                tstNumOp(pDbgc, "1 + 1",                                    2);
     316                tstNumOp(pDbgc, "1+1",                                      2);
     317                tstNumOp(pDbgc, "1+ 1",                                     2);
     318
     319                tstNumOp(pDbgc, "1 - 1",                                    0);
     320                tstNumOp(pDbgc, "99 - 90",                                  9);
     321
     322                tstNumOp(pDbgc, "2 * 2",                                    4);
     323
     324                tstNumOp(pDbgc, "2 / 2",                                    1);
     325                tstNumOp(pDbgc, "2 / 0",                                    UINT64_MAX);
     326                tstNumOp(pDbgc, "0i1024 / 0i4",                             256);
     327
     328                tstNumOp(pDbgc, "1<<1",                                     2);
     329                tstNumOp(pDbgc, "1<<0i32",                                  UINT64_C(0x0000000100000000));
     330                tstNumOp(pDbgc, "1<<0i48",                                  UINT64_C(0x0001000000000000));
     331                tstNumOp(pDbgc, "1<<0i63",                                  UINT64_C(0x8000000000000000));
     332
     333                tstNumOp(pDbgc, "fedcba0987654321>>0i04",                   UINT64_C(0x0fedcba098765432));
     334                tstNumOp(pDbgc, "fedcba0987654321>>0i32",                   UINT64_C(0xfedcba09));
     335                tstNumOp(pDbgc, "fedcba0987654321>>0i48",                   UINT64_C(0x0000fedc));
     336
     337                tstNumOp(pDbgc, "0ef & 4",                                  4);
     338                tstNumOp(pDbgc, "01234567891 & fff",                        UINT64_C(0x00000000891));
     339                tstNumOp(pDbgc, "01234567891 & ~fff",                       UINT64_C(0x01234567000));
     340
     341                tstNumOp(pDbgc, "1 | 1",                                    1);
     342                tstNumOp(pDbgc, "0 | 4",                                    4);
     343                tstNumOp(pDbgc, "4 | 0",                                    4);
     344                tstNumOp(pDbgc, "4 | 4",                                    4);
     345                tstNumOp(pDbgc, "1 | 4 | 2",                                7);
     346
     347                tstNumOp(pDbgc, "1 ^ 1",                                    0);
     348                tstNumOp(pDbgc, "1 ^ 0",                                    1);
     349                tstNumOp(pDbgc, "0 ^ 1",                                    1);
     350                tstNumOp(pDbgc, "3 ^ 1",                                    2);
     351                tstNumOp(pDbgc, "7 ^ 3",                                    4);
     352
     353                tstNumOp(pDbgc, "7 || 3",                                   1);
     354                tstNumOp(pDbgc, "1 || 0",                                   1);
     355                tstNumOp(pDbgc, "0 || 1",                                   1);
     356                tstNumOp(pDbgc, "0 || 0",                                   0);
     357
     358                tstNumOp(pDbgc, "0 && 0",                                   0);
     359                tstNumOp(pDbgc, "1 && 0",                                   0);
     360                tstNumOp(pDbgc, "0 && 1",                                   0);
     361                tstNumOp(pDbgc, "1 && 1",                                   1);
     362                tstNumOp(pDbgc, "4 && 1",                                   1);
     363            }
     364
     365            if (RTTestErrorCount(g_hTest) == 0)
     366            {
     367                RTTestSub(g_hTest, "Odd cases");
     368                tstTry(pDbgc, "r @rax\n", VINF_SUCCESS);
     369                tstTry(pDbgc, "r @eax\n", VINF_SUCCESS);
     370                tstTry(pDbgc, "r @ah\n", VINF_SUCCESS);
     371            }
    359372        }
    360373
  • trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp

    r35625 r35629  
    55
    66/*
    7  * Copyright (C) 2006-2010 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818#include <VBox/err.h>
    1919#include <VBox/vmm/vm.h>
     20#include <iprt/string.h>
    2021
    2122
     
    206207    return VERR_INTERNAL_ERROR;
    207208}
    208 VMMR3DECL(int) DBGFR3RegNmQuery(    PVM pVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType)
    209 {
     209VMMR3DECL(int) DBGFR3RegNmQuery(PVM pVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType)
     210{
     211    if (idDefCpu == 0 || idDefCpu == DBGFREG_HYPER_VMCPUID)
     212    {
     213        if (!strcmp(pszReg, "ah"))
     214        {
     215            pValue->u16 = 0xf0;
     216            *penmType   = DBGFREGVALTYPE_U8;
     217            return VINF_SUCCESS;
     218        }
     219        if (!strcmp(pszReg, "ax"))
     220        {
     221            pValue->u16 = 0xbabe;
     222            *penmType   = DBGFREGVALTYPE_U16;
     223            return VINF_SUCCESS;
     224        }
     225        if (!strcmp(pszReg, "eax"))
     226        {
     227            pValue->u32 = 0xcafebabe;
     228            *penmType   = DBGFREGVALTYPE_U32;
     229            return VINF_SUCCESS;
     230        }
     231        if (!strcmp(pszReg, "rax"))
     232        {
     233            pValue->u64 = UINT64_C(0x00beef00feedface);
     234            *penmType   = DBGFREGVALTYPE_U32;
     235            return VINF_SUCCESS;
     236        }
     237    }
    210238    return VERR_INTERNAL_ERROR;
    211239}
Note: See TracChangeset for help on using the changeset viewer.

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