VirtualBox

Changeset 41562 in vbox


Ignore:
Timestamp:
Jun 4, 2012 12:54:57 PM (13 years ago)
Author:
vboxsync
Message:

build fix / adding hi() and low()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp

    r41561 r41562  
    371371
    372372
    373 /** Function descriptors for the CodeView / WinDbg emulation.
    374  * The emulation isn't attempting to be identical, only somewhat similar.
    375  */
    376 const DBGCFUNC g_aFuncsCodeView[] =
    377 {
    378 };
    379 
    380 /** The number of functions in the CodeView/WinDbg emulation. */
    381 const uint32_t g_cFuncsCodeView = RT_ELEMENTS(g_aFuncsCodeView);
    382373
    383374
     
    42184209    return VINF_SUCCESS;
    42194210}
     4211
     4212
     4213
     4214
     4215/**
     4216 * @callback_method_impl{The hi(value) function implementation.}
     4217 */
     4218static DECLCALLBACK(int) dbgcFuncHi(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
     4219                                    PDBGCVAR pResult)
     4220{
     4221    AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
     4222    uint16_t uHi;
     4223    switch (paArgs[0].enmType)
     4224    {
     4225        case DBGCVAR_TYPE_GC_FLAT:  uHi = (uint16_t)(paArgs[0].u.GCFlat >> 16); break;
     4226        case DBGCVAR_TYPE_GC_FAR:   uHi = (uint16_t)paArgs[0].u.GCFar.sel; break;
     4227        case DBGCVAR_TYPE_GC_PHYS:  uHi = (uint16_t)(paArgs[0].u.GCPhys >> 16); break;
     4228        case DBGCVAR_TYPE_HC_FLAT:  uHi = (uint16_t)((uintptr_t)paArgs[0].u.pvHCFlat >> 16); break;
     4229        case DBGCVAR_TYPE_HC_PHYS:  uHi = (uint16_t)(paArgs[0].u.HCPhys >> 16); break;
     4230        case DBGCVAR_TYPE_NUMBER:   uHi = (uint16_t)(paArgs[0].u.u64Number >> 16); break;
     4231        default:
     4232            AssertFailedReturn(VERR_DBGC_PARSE_BUG);
     4233    }
     4234
     4235    DBGCVAR_INIT_NUMBER(pResult, uHi);
     4236    NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM);
     4237    return VINF_SUCCESS;
     4238}
     4239
     4240
     4241/**
     4242 * @callback_method_impl{The low(value) function implementation.}
     4243 */
     4244static DECLCALLBACK(int) dbgcFuncLow(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
     4245                                     PDBGCVAR pResult)
     4246{
     4247    AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
     4248    uint16_t uLow;
     4249    switch (paArgs[0].enmType)
     4250    {
     4251        case DBGCVAR_TYPE_GC_FLAT:  uLow = (uint16_t)paArgs[0].u.GCFlat; break;
     4252        case DBGCVAR_TYPE_GC_FAR:   uLow = (uint16_t)paArgs[0].u.GCFar.off; break;
     4253        case DBGCVAR_TYPE_GC_PHYS:  uLow = (uint16_t)paArgs[0].u.GCPhys; break;
     4254        case DBGCVAR_TYPE_HC_FLAT:  uLow = (uint16_t)(uintptr_t)paArgs[0].u.pvHCFlat; break;
     4255        case DBGCVAR_TYPE_HC_PHYS:  uLow = (uint16_t)paArgs[0].u.HCPhys; break;
     4256        case DBGCVAR_TYPE_NUMBER:   uLow = (uint16_t)paArgs[0].u.u64Number; break;
     4257        default:
     4258            AssertFailedReturn(VERR_DBGC_PARSE_BUG);
     4259    }
     4260
     4261    DBGCVAR_INIT_NUMBER(pResult, uLow);
     4262    NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM);
     4263    return VINF_SUCCESS;
     4264}
     4265
     4266
     4267/** Generic pointer or number argument. */
     4268static const DBGCVARDESC    g_aArgPointerNumber[] =
     4269{
     4270    /* cTimesMin,   cTimesMax,  enmCategory,            fFlags,                         pszName,        pszDescription */
     4271    {  1,           1,      DBGCVAR_CAT_POINTER_NUMBER, 0,                              "value",        "Address or number." },
     4272};
     4273
     4274
     4275
     4276/** Function descriptors for the CodeView / WinDbg emulation.
     4277 * The emulation isn't attempting to be identical, only somewhat similar.
     4278 */
     4279const DBGCFUNC g_aFuncsCodeView[] =
     4280{
     4281    { "hi",     1, 1,   &g_aArgPointerNumber[0],    RT_ELEMENTS(g_aArgPointerNumber),   0, dbgcFuncHi,      "value", "Returns the high 16-bit bits of a value." },
     4282    { "low",    1, 1,   &g_aArgPointerNumber[0],    RT_ELEMENTS(g_aArgPointerNumber),   0, dbgcFuncLow,     "value", "Returns the low 16-bit bits of a value." },
     4283};
     4284
     4285/** The number of functions in the CodeView/WinDbg emulation. */
     4286const uint32_t g_cFuncsCodeView = RT_ELEMENTS(g_aFuncsCodeView);
     4287
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