Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

static int BasicTestsEnumSymCallback ( PKLDRMOD  pMod,
KU32  iSymbol,
const char *  pchSymbol,
KSIZE  cchSymbol,
const char *  pszVersion,
KLDRADDR  uValue,
KU32  fKind,
void *  pvUser 
) [static]

Dump symbols and check that we can query each of them recursivly.

Definition at line 207 of file tstkLdrMod.c.

References Failure(), kLdrModQuerySymbol(), MY_BASEADDRESS, NIL_KLDRMOD_SYM_ORDINAL, NULL, and PRI_KLDRADDR.

Referenced by BasicTestsSub2().

{
    KLDRADDR    uValue2;
    KU32        fKind2;
    int         rc;

    /* dump */
    printf("#0x%08x: %016" PRI_KLDRADDR " %#08x", iSymbol, uValue, fKind);
    if (pchSymbol)
        printf(" %.*s", cchSymbol, pchSymbol);
    printf("\n");

    /* query by ordinal */
    if (iSymbol != NIL_KLDRMOD_SYM_ORDINAL)
    {
        fKind2 = 0;
        rc = kLdrModQuerySymbol(pMod, pvUser, MY_BASEADDRESS, iSymbol, NULL, 0, NULL, NULL, NULL,
                                &uValue2, &fKind2);
        if (rc)
            return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc));
        if (uValue != uValue2)
            return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/ord)  pvBits=%p",
                           iSymbol, cchSymbol, pchSymbol, uValue, uValue2, pvUser);
        if (fKind != fKind2)
            return Failure("Symbol %#x (%.*s): Kind mismatch %#x != %#x (enum!=query/ord) pvBits=%p",
                           iSymbol, cchSymbol, pchSymbol, fKind, fKind2, pvUser);
    }

    /* query by name. */
    if (pchSymbol)
    {
        fKind2 = 0;
        rc = kLdrModQuerySymbol(pMod, pvUser, MY_BASEADDRESS, NIL_KLDRMOD_SYM_ORDINAL, pchSymbol, cchSymbol, pszVersion,
                                NULL, NULL, &uValue2, &fKind2);
        if (rc)
            return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc));
        if (uValue != uValue2)
            return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/name) pvBits=%p",
                           iSymbol, cchSymbol, pchSymbol, uValue, uValue2, pvUser);
        if (fKind != fKind2)
            return Failure("Symbol %#x (%.*s): Kind mismatch %#x != %#x (enum!=query/name) pvBits=%p",
                           iSymbol, cchSymbol, pchSymbol, fKind, fKind2, pvUser);
    }

    return 0;
}


Generated by  Doxygen 1.6.0   Back to index