VirtualBox

Changeset 83085 in vbox for trunk/src/VBox/Debugger


Ignore:
Timestamp:
Feb 15, 2020 9:19:54 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
136140
Message:

IPRT,VMM,DBGPlugInDarwin: Implemented in-memory guest kernel and kext image loading for OS X / Mach-O. Requires LINKEDIT to not be jettisoned to work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGPlugInDarwin.cpp

    r83084 r83085  
    407407 * @param   uMaxAddr            Highest allowed address.
    408408 */
    409 static int dbgDiggerDarwinIsSegmentPresent(PUVM pUVM, uint64_t uSegAddr, uint64_t cbSeg, uint64_t uMinAddr, uint64_t uMaxAddr)
     409static bool dbgDiggerDarwinIsSegmentPresent(PUVM pUVM, uint64_t uSegAddr, uint64_t cbSeg, uint64_t uMinAddr, uint64_t uMaxAddr)
    410410{
    411411    /*
     
    657657     */
    658658    RTDBGMOD hMod;
    659     rc = RTDbgModCreateFromMachOImage(&hMod, pszName, NULL, f64Bit ? RTLDRARCH_AMD64 : RTLDRARCH_X86_32, 0 /*cbImage*/,
    660                                       cSegs, aSegs, &Uuid, DBGFR3AsGetConfig(pUVM),
     659    rc = RTDbgModCreateFromMachOImage(&hMod, pszName, NULL, f64Bit ? RTLDRARCH_AMD64 : RTLDRARCH_X86_32, NULL /*phLdrModIn*/,
     660                                      0 /*cbImage*/, cSegs, aSegs, &Uuid, DBGFR3AsGetConfig(pUVM),
    661661                                      RTDBGMOD_F_NOT_DEFERRED | (fHasLinkEdit ? RTDBGMOD_F_MACHO_LOAD_LINKEDIT : 0));
    662662
     663
     664    /*
     665     * If module creation failed and we've got a linkedit segment, try open the
     666     * image in-memory, because that will at a minimum give us symbol table symbols.
     667     */
     668    if (RT_FAILURE(rc) && fHasLinkEdit)
     669    {
     670        DBGFADDRESS DbgfAddr;
     671        RTERRINFOSTATIC ErrInfo;
     672        rc = DBGFR3ModInMem(pUVM, DBGFR3AddrFromFlat(pUVM, &DbgfAddr, uModAddr),
     673                            DBGFMODINMEM_F_NO_CONTAINER_FALLBACK,
     674                            pszName, NULL /*pszFilename*/, f64Bit ? RTLDRARCH_AMD64 : RTLDRARCH_X86_32, 0 /*cbImage */,
     675                            &hMod, RTErrInfoInitStatic(&ErrInfo));
     676        if (RT_FAILURE(rc))
     677            LogRel(("OSXDig: Failed to do an in-memory-opening of '%s' at %#RX64: %Rrc%s%s\n", pszName, uModAddr, rc,
     678                    RTErrInfoIsSet(&ErrInfo.Core) ? " - " : "", RTErrInfoIsSet(&ErrInfo.Core) ? ErrInfo.Core.pszMsg : ""));
     679    }
     680
     681    /*
     682     * Final fallback is a container module.
     683     */
    663684    if (RT_FAILURE(rc))
    664685    {
    665         /** @todo try open in memory. */
    666 
    667         /*
    668          * Final fallback is a container module.
    669          */
    670686        rc = RTDbgModCreate(&hMod, pszName, 0, 0);
    671687        if (RT_FAILURE(rc))
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette