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

static KU32 KPRF_NAME() RecordModSeg ( KPRF_TYPE(P, HDR)  pHdr,
KPRF_TYPE(, UPTR)  uPC 
) [static]

Record a module segment.

This is an internal worker for recording a module segment when adding a new function.

Returns:
Offset to the module if existing or successfully added

0 if not found.

Parameters:
pHdr The profiler header.
uPC Address within the module.

Definition at line 170 of file prfcoremodseg.cpp.h.

References KPRF_ALIGN, KPRF_NAME, KPRF_OFF2PTR, KPRF_OFFSETOF, KPRF_TYPE, and NewModSeg().

{
    /*
     * Lookup the module segment, inserting it if not found (and there is room).
     */
    KU32 off = 0;
    KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(P,MODSEG, pHdr->offModSegs, pHdr);
    const KU32 cbModSegs = pHdr->cbModSegs;
    for (;;)
    {
        /* done and not found? */
        if (off >= cbModSegs)
            return KPRF_NAME(NewModSeg)(pHdr, uPC, off);

        /*
         * Match?
         */
        if (    pCur->fLoaded
            &&  uPC - pCur->uBasePtr <= pCur->cbSegmentMinusOne)
            return off + pHdr->offModSegs;

        KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]);
        cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR));
        off += cbCur;
        pCur = (KPRF_TYPE(PC,MODSEG))((KU8 *)pCur + cbCur);
    }
}


Generated by  Doxygen 1.6.0   Back to index