VirtualBox

Changeset 4329 in vbox


Ignore:
Timestamp:
Aug 24, 2007 12:45:10 AM (17 years ago)
Author:
vboxsync
Message:

Some DBGCVAR stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/dbg.h

    r4213 r4329  
    203203
    204204
     205/**
     206 * Macro for initializing a DBGC variable with defaults.
     207 * The result is an unknown variable type without any range.
     208 */
     209#define DBGCVAR_INIT(pVar) \
     210        do { \
     211            (pVar)->pDesc = NULL;\
     212            (pVar)->pNext = NULL; \
     213            (pVar)->enmType = DBGCVAR_TYPE_UNKNOWN; \
     214            (pVar)->u.u64Number = 0; \
     215            (pVar)->enmRangeType = DBGCVAR_RANGE_NONE; \
     216            (pVar)->u64Range = 0; \
     217        } while (0)
     218
     219/**
     220 * Macro for initializing a DBGC variable with a HC physical address.
     221 */
     222#define DBGCVAR_INIT_HC_PHYS(pVar, Phys) \
     223        do { \
     224            DBGCVAR_INIT(pVar); \
     225            (pVar)->enmType = DBGCVAR_TYPE_HC_PHYS; \
     226            (pVar)->u.HCPhys = (Phys); \
     227        } while (0)
     228
     229/**
     230 * Macro for initializing a DBGC variable with a HC flat address.
     231 */
     232#define DBGCVAR_INIT_HC_FLAT(pVar, Flat) \
     233        do { \
     234            DBGCVAR_INIT(pVar); \
     235            (pVar)->enmType = DBGCVAR_TYPE_HC_FLAT; \
     236            (pVar)->u.pvHCFlat = (Flat); \
     237        } while (0)
     238
     239/**
     240 * Macro for initializing a DBGC variable with a GC physical address.
     241 */
     242#define DBGCVAR_INIT_GC_PHYS(pVar, Phys) \
     243        do { \
     244            DBGCVAR_INIT(pVar); \
     245            (pVar)->enmType = DBGCVAR_TYPE_GC_PHYS; \
     246            (pVar)->u.GCPhys = (Phys); \
     247        } while (0)
     248
     249/**
     250 * Macro for initializing a DBGC variable with a GC flat address.
     251 */
     252#define DBGCVAR_INIT_GC_FLAT(pVar, Flat) \
     253        do { \
     254            DBGCVAR_INIT(pVar); \
     255            (pVar)->enmType = DBGCVAR_TYPE_GC_FLAT; \
     256            (pVar)->u.GCFlat = (Flat); \
     257        } while (0)
     258
     259/**
     260 * Macro for initializing a DBGC variable with a GC far address.
     261 */
     262#define DBGCVAR_INIT_GC_FAR(pVar, _sel, _off) \
     263        do { \
     264            DBGCVAR_INIT(pVar); \
     265            (pVar)->enmType = DBGCVAR_TYPE_GC_FAR; \
     266            (pVar)->u.GCFar.sel = (_sel); \
     267            (pVar)->u.GCFar.off = (_off); \
     268        } while (0)
     269
     270/**
     271 * Macro for initializing a DBGC variable with a number
     272 */
     273#define DBGCVAR_INIT_NUMBER(pVar, Value) \
     274        do { \
     275            DBGCVAR_INIT(pVar); \
     276            (pVar)->enmType = DBGCVAR_TYPE_NUMBER; \
     277            (pVar)->u.u64 = (Value); \
     278        } while (0)
     279
     280
    205281/** Pointer to helper functions for commands. */
    206282typedef struct DBGCCMDHLP *PDBGCCMDHLP;
     
    388464} DBGCCMDHLP;
    389465
     466
     467#ifdef IN_RING3
     468/**
     469 * Command helper for writing formatted text to the debug console.
     470 *
     471 * @returns VBox status.
     472 * @param   pCmdHlp     Pointer to the command callback structure.
     473 * @param   pszFormat   The format string.
     474 *                      This is using the log formatter, so it's format extensions can be used.
     475 * @param   ...         Arguments specified in the format string.
     476 */
     477DECLINLINE(int) DBGCCmdHlpPrintf(PDBGCCMDHLP pCmdHlp, const char *pszFormat, ...)
     478{
     479    va_list va;
     480    int rc;
     481    va_start(va, pszFormat);
     482    rc = pCmdHlp->pfnPrintfV(pCmdHlp, NULL, pszFormat, va);
     483    va_end(va);
     484    return rc;
     485}
     486
     487/**
     488 * @copydoc FNDBGCHLPVBOXERROR
     489 */
     490DECLINLINE(int) DBGCCmdHlpVBoxError(PDBGCCMDHLP pCmdHlp, int rc, const char *pszFormat, ...)
     491{
     492    va_list va;
     493    va_start(va, pszFormat);
     494    rc = pCmdHlp->pfnVBoxErrorV(pCmdHlp, rc, pszFormat, va);
     495    va_end(va);
     496    return rc;
     497}
     498
     499/**
     500 * @copydoc FNDBGCHLPMEMREAD
     501 */
     502DECLINLINE(int) DBGCCmdHlpMemRead(PDBGCCMDHLP pCmdHlp, PVM pVM, void *pvBuffer, size_t cbRead, PCDBGCVAR pVarPointer, size_t *pcbRead)
     503{
     504    return pCmdHlp->pfnMemRead(pCmdHlp, pVM, pvBuffer, cbRead, pVarPointer, pcbRead);
     505}
     506#endif /* IN_RING3 */
    390507
    391508
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