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

static int kDbgModPeRVAToSegOff ( PKDBGMODPE  pModPe,
uint32_t  uRVA,
int32_t *  piSegment,
KDBGADDR poff 
) [static]

Calcs the segment:offset address for a RVA.

Returns:
IPRT status code.
Parameters:
pModPe The PE debug module instance.
uRVA The RVA.
piSegment Where to store the segment number.
poff Where to store the segment offset.

Todo:
should probably be less strict about address in the alignment gaps.

Definition at line 106 of file kDbgModPE.cpp.

References KDBGMODPE::aSections, KDBGMODPE::cbImage, KDBGMODPE::cSections, and KDBG_ERR_INVALID_ADDRESS.

Referenced by kDbgModPeQueryLine(), and kDbgModPeQuerySymbol().

{
    kDbgAssertMsgReturn(uRVA < pModPe->cbImage, ("uRVA=%x, cbImage=%x\n", uRVA, pModPe->cbImage),
                        KDBG_ERR_INVALID_ADDRESS);
    for (int32_t iSegment = 0; iSegment < pModPe->cSections; iSegment++)
    {
        /** @todo should probably be less strict about address in the alignment gaps. */
        uint32_t off = uRVA - pModPe->aSections[iSegment].VirtualAddress;
        if (off < pModPe->aSections[iSegment].Misc.VirtualSize)
        {
            *poff = off;
            *piSegment = iSegment;
            return 0;
        }
    }
    kDbgAssertMsgFailedReturn(("uRVA=%x\n", uRVA), KDBG_ERR_INVALID_ADDRESS);
}


Generated by  Doxygen 1.6.0   Back to index