VirtualBox

Ignore:
Timestamp:
Feb 15, 2020 3:16:11 PM (5 years ago)
Author:
vboxsync
Message:

IPRT,DBGPlugInDarwin: Added flags for indicating that the LINKEDIT segment should be loaded in Mach-O images and debug files.

Location:
trunk/src/VBox/Runtime/common/dbg
Files:
4 edited

Legend:

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

    r82968 r83084  
    329329    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
    330330    AssertReturn(*pszName, VERR_INVALID_PARAMETER);
    331     AssertReturn(fFlags == 0 || fFlags == RTDBGMOD_F_NOT_DEFERRED, VERR_INVALID_PARAMETER);
     331    AssertReturn(fFlags == 0 || fFlags == RTDBGMOD_F_NOT_DEFERRED, VERR_INVALID_FLAGS);
    332332
    333333    int rc = rtDbgModLazyInit();
     
    842842                        pDbgMod->pvImgPriv = NULL;
    843843                        /** @todo need to specify some arch stuff here. */
    844                         rc = pImg->pVt->pfnTryOpen(pDbgMod, enmArch);
     844                        rc = pImg->pVt->pfnTryOpen(pDbgMod, enmArch, 0 /*fLdrFlags*/);
    845845                        if (RT_SUCCESS(rc))
    846846                        {
     
    980980            pDbgMod->pImgVt    = pImg->pVt;
    981981            pDbgMod->pvImgPriv = NULL;
    982             int rc2 = pImg->pVt->pfnTryOpen(pDbgMod, RTLDRARCH_WHATEVER);
     982            int rc2 = pImg->pVt->pfnTryOpen(pDbgMod, RTLDRARCH_WHATEVER, 0 /*fLdrFlags*/);
    983983            if (RT_SUCCESS(rc2))
    984984            {
     
    11591159                    {
    11601160                        PRTDBGMODDEFERRED pDeferred;
    1161                         rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromPeImageDeferredCallback, cbImage, hDbgCfg, 0,
    1162                                                     &pDeferred);
     1161                        rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromPeImageDeferredCallback, cbImage, hDbgCfg,
     1162                                                    0 /*cbDeferred*/, 0 /*fFlags*/, &pDeferred);
    11631163                        if (RT_SUCCESS(rc))
    11641164                            pDeferred->u.PeImage.uTimestamp = uTimestamp;
     
    12171217    /** For use more internal use in file locator callbacks. */
    12181218    bool                fOpenImage;
     1219    /** RTDBGMOD_F_XXX. */
     1220    uint32_t            fFlags;
    12191221} RTDBGMODMACHOARGS;
    12201222/** Pointer to a const segment package. */
     
    12591261            pDbgMod->pImgVt    = pImg->pVt;
    12601262            pDbgMod->pvImgPriv = NULL;
    1261             int rc2 = pImg->pVt->pfnTryOpen(pDbgMod, pArgs->enmArch);
     1263            int rc2 = pImg->pVt->pfnTryOpen(pDbgMod, pArgs->enmArch,
     1264                                            pArgs->fFlags & RTDBGMOD_F_MACHO_LOAD_LINKEDIT ? RTLDR_O_MACHO_LOAD_LINKEDIT : 0);
    12621265            if (RT_SUCCESS(rc2))
    12631266            {
     
    13501353
    13511354static int rtDbgModFromMachOImageWorker(PRTDBGMODINT pDbgMod, RTLDRARCH enmArch, uint32_t cbImage,
    1352                                         uint32_t cSegs, PCRTDBGSEGMENT paSegs, PCRTUUID pUuid, RTDBGCFG hDbgCfg)
     1355                                        uint32_t cSegs, PCRTDBGSEGMENT paSegs, PCRTUUID pUuid, RTDBGCFG hDbgCfg, uint32_t fFlags)
    13531356{
    13541357    RT_NOREF_PV(cbImage); RT_NOREF_PV(cSegs); RT_NOREF_PV(paSegs);
     
    13581361    Args.pUuid      = pUuid && RTUuidIsNull(pUuid) ? pUuid : NULL;
    13591362    Args.fOpenImage = false;
     1363    Args.fFlags     = fFlags;
    13601364
    13611365    /*
     
    13821386    return rtDbgModFromMachOImageWorker(pDbgMod, pDeferred->u.MachO.enmArch, pDeferred->cbImage,
    13831387                                        pDeferred->u.MachO.cSegs, pDeferred->u.MachO.aSegs,
    1384                                         &pDeferred->u.MachO.Uuid, pDeferred->hDbgCfg);
     1388                                        &pDeferred->u.MachO.Uuid, pDeferred->hDbgCfg, pDeferred->fFlags);
    13851389}
    13861390
     
    14081412    AssertReturn(cbImage || cSegs, VERR_INVALID_PARAMETER);
    14091413    AssertPtrNullReturn(pUuid, VERR_INVALID_POINTER);
    1410     AssertReturn(!(fFlags & ~(RTDBGMOD_F_NOT_DEFERRED)), VERR_INVALID_PARAMETER);
     1414    AssertReturn(!(fFlags & ~RTDBGMOD_F_VALID_MASK), VERR_INVALID_FLAGS);
    14111415
    14121416    int rc = rtDbgModLazyInit();
     
    14481452                    || (!cbImage && !cSegs)
    14491453                    || (fFlags & RTDBGMOD_F_NOT_DEFERRED) )
    1450                     rc = rtDbgModFromMachOImageWorker(pDbgMod, enmArch, cbImage, cSegs, paSegs, pUuid, hDbgCfg);
     1454                    rc = rtDbgModFromMachOImageWorker(pDbgMod, enmArch, cbImage, cSegs, paSegs, pUuid, hDbgCfg, fFlags);
    14511455                else
    14521456                {
     
    14571461                    rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromMachOImageDeferredCallback, cbImage, hDbgCfg,
    14581462                                                RT_UOFFSETOF_DYN(RTDBGMODDEFERRED, u.MachO.aSegs[cSegs]),
    1459                                                 &pDeferred);
     1463                                                0 /*fFlags*/, &pDeferred);
    14601464                    if (RT_SUCCESS(rc))
    14611465                    {
  • trunk/src/VBox/Runtime/common/dbg/dbgmoddeferred.cpp

    r82968 r83084  
    636636
    637637/** @interface_method_impl{RTDBGMODVTIMG,pfnTryOpen} */
    638 static DECLCALLBACK(int) rtDbgModDeferredImg_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enmArch)
    639 {
    640     NOREF(enmArch);
     638static DECLCALLBACK(int) rtDbgModDeferredImg_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enmArch, uint32_t fLdrFlags)
     639{
     640    RT_NOREF(enmArch, fLdrFlags);
    641641    return rtDbgModDeferredDoIt(pMod, true /*fForceRetry*/);
    642642}
     
    681681 * @param   cbDeferred          The size of the deferred instance data, 0 if the
    682682 *                              default structure is good enough.
     683 * @param   fFlags              RTDBGMOD_F_XXX.
    683684 * @param   ppDeferred          Where to return the instance data. Can be NULL.
    684685 */
    685686DECLHIDDEN(int) rtDbgModDeferredCreate(PRTDBGMODINT pDbgMod, PFNRTDBGMODDEFERRED pfnDeferred, RTUINTPTR cbImage,
    686                                        RTDBGCFG hDbgCfg, size_t cbDeferred, PRTDBGMODDEFERRED *ppDeferred)
     687                                       RTDBGCFG hDbgCfg, size_t cbDeferred, uint32_t fFlags, PRTDBGMODDEFERRED *ppDeferred)
    687688{
    688689    AssertReturn(!pDbgMod->pDbgVt, VERR_DBG_MOD_IPE);
     
    701702    pDeferred->hDbgCfg     = hDbgCfg;
    702703    pDeferred->pfnDeferred = pfnDeferred;
     704    pDeferred->fFlags      = fFlags;
    703705
    704706    pDbgMod->pDbgVt             = &g_rtDbgModVtDbgDeferred;
  • trunk/src/VBox/Runtime/common/dbg/dbgmoddwarf.cpp

    r82968 r83084  
    60776077            pDbgInfoMod->pszName = pDbgMod->pszName;
    60786078            pDbgInfoMod->pImgVt  = &g_rtDbgModVtImgLdr;
    6079             rc = pDbgInfoMod->pImgVt->pfnTryOpen(pDbgInfoMod, enmArch);
     6079            rc = pDbgInfoMod->pImgVt->pfnTryOpen(pDbgInfoMod, enmArch, 0 /*fLdrFlags*/);
    60806080            if (RT_SUCCESS(rc))
    60816081            {
  • trunk/src/VBox/Runtime/common/dbg/dbgmodldr.cpp

    r82968 r83084  
    216216
    217217/** @interface_method_impl{RTDBGMODVTIMG,pfnTryOpen} */
    218 static DECLCALLBACK(int) rtDbgModLdr_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enmArch)
     218static DECLCALLBACK(int) rtDbgModLdr_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enmArch, uint32_t fLdrFlags)
    219219{
    220220    RTLDRMOD hLdrMod;
    221     int rc = RTLdrOpen(pMod->pszImgFile, RTLDR_O_FOR_DEBUG, enmArch, &hLdrMod);
     221    int rc = RTLdrOpen(pMod->pszImgFile, RTLDR_O_FOR_DEBUG | fLdrFlags, enmArch, &hLdrMod);
    222222    if (RT_SUCCESS(rc))
    223223    {
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