VirtualBox

Changeset 75188 in vbox for trunk


Ignore:
Timestamp:
Oct 30, 2018 4:46:17 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/dbgmoddbghelp.cpp: Don't panic if RVA=NIL_RTLDRADDR and make sure we return failures on failure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/dbg/dbgmoddbghelp.cpp

    r73494 r75188  
    5757    PRTDBGMODINT    pMod;
    5858    uint64_t        uModAddr;
     59    RTLDRADDR       uNextRva;
    5960
    6061    /** UTF-8 version of the previous file name. */
     
    367368
    368369
    369 /** @callback_method_impl{FNRTLDRENUMSEGS, Copies the PE segments over into
    370  *                       the container.} */
     370/** @callback_method_impl{FNRTLDRENUMSEGS,
     371 * Copies the PE segments over into the container.} */
    371372static DECLCALLBACK(int) rtDbgModDbgHelpAddSegmentsCallback(RTLDRMOD hLdrMod, PCRTLDRSEG pSeg, void *pvUser)
    372373{
     
    380381    Assert(!pSeg->pszName[pSeg->cchName]);
    381382
    382     if (!pSeg->RVA)
     383    RTLDRADDR cb   = RT_MAX(pSeg->cb, pSeg->cbMapped);
     384    RTLDRADDR uRva = pSeg->RVA;
     385    if (!uRva)
    383386        pArgs->uModAddr = pSeg->LinkAddress;
    384 
    385     RTLDRADDR cb = RT_MAX(pSeg->cb, pSeg->cbMapped);
    386     return RTDbgModSegmentAdd(pArgs->hCnt, pSeg->RVA, cb, pSeg->pszName, 0 /*fFlags*/, NULL);
     387    else if (uRva == NIL_RTLDRADDR)
     388    {
     389        cb   = 0;
     390        uRva = pArgs->uNextRva;
     391    }
     392    pArgs->uNextRva = uRva + cb;
     393
     394    return RTDbgModSegmentAdd(pArgs->hCnt, uRva, cb, pSeg->pszName, 0 /*fFlags*/, NULL);
    387395}
    388396
     
    457465                    {
    458466                        rc = RTErrConvertFromWin32(GetLastError());
     467                        if (RT_SUCCESS_NP(rc))
     468                            rc = VERR_DBG_NO_MATCHING_INTERPRETER;
    459469                        LogFlow(("rtDbgModDbgHelp_TryOpen: Error loading the module '%s' at %#llx: %Rrc (%u)\n",
    460470                                 pMod->pszDbgFile, (uint64_t)uImageBase, rc, GetLastError()));
     
    470480            {
    471481                rc = RTErrConvertFromWin32(GetLastError());
     482                if (RT_SUCCESS_NP(rc))
     483                    rc = VERR_DBG_NO_MATCHING_INTERPRETER;
    472484                LogFlow(("rtDbgModDbgHelp_TryOpen: SymInitialize failed: %Rrc (%u)\n", rc, GetLastError()));
    473485            }
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