Changeset 83085 in vbox for trunk/src/VBox/Runtime/common/dbg
- Timestamp:
- Feb 15, 2020 9:19:54 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp
r83084 r83085 1390 1390 1391 1391 1392 RTDECL(int) RTDbgModCreateFromMachOImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, 1393 RTLDRARCH enmArch, uint32_t cbImage, uint32_t cSegs, PCRTDBGSEGMENT paSegs,1392 RTDECL(int) RTDbgModCreateFromMachOImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTLDRARCH enmArch, 1393 PRTLDRMOD phLdrModIn, uint32_t cbImage, uint32_t cSegs, PCRTDBGSEGMENT paSegs, 1394 1394 PCRTUUID pUuid, RTDBGCFG hDbgCfg, uint32_t fFlags) 1395 1395 { … … 1410 1410 AssertReturn(!cbImage, VERR_INVALID_PARAMETER); 1411 1411 } 1412 AssertReturn(cbImage || cSegs, VERR_INVALID_PARAMETER);1413 1412 AssertPtrNullReturn(pUuid, VERR_INVALID_POINTER); 1414 1413 AssertReturn(!(fFlags & ~RTDBGMOD_F_VALID_MASK), VERR_INVALID_FLAGS); 1414 1415 AssertPtrNullReturn(phLdrModIn, VERR_INVALID_POINTER); 1416 RTLDRMOD hLdrModIn = phLdrModIn ? *phLdrModIn : NIL_RTLDRMOD; 1417 AssertReturn(hLdrModIn == NIL_RTLDRMOD || RTLdrSize(hLdrModIn) != ~(size_t)0, VERR_INVALID_HANDLE); 1418 1419 AssertReturn(cbImage || cSegs || hLdrModIn != NIL_RTLDRMOD, VERR_INVALID_PARAMETER); 1415 1420 1416 1421 int rc = rtDbgModLazyInit(); … … 1423 1428 rc = RTDbgCfgQueryUInt(hDbgCfg, RTDBGCFGPROP_FLAGS, &fDbgCfg); 1424 1429 AssertRCReturn(rc, rc); 1430 } 1431 1432 /* 1433 * If we got no UUID but the caller passed in a module handle, try 1434 * query the UUID from it. 1435 */ 1436 RTUUID UuidFromImage = RTUUID_INITIALIZE_NULL; 1437 if ((!pUuid || RTUuidIsNull(pUuid)) && hLdrModIn != NIL_RTLDRMOD) 1438 { 1439 rc = RTLdrQueryProp(hLdrModIn, RTLDRPROP_UUID, &UuidFromImage, sizeof(UuidFromImage)); 1440 if (RT_SUCCESS(rc)) 1441 pUuid = &UuidFromImage; 1425 1442 } 1426 1443 … … 1451 1468 || cSegs /* for the time being. */ 1452 1469 || (!cbImage && !cSegs) 1453 || (fFlags & RTDBGMOD_F_NOT_DEFERRED) ) 1470 || (fFlags & RTDBGMOD_F_NOT_DEFERRED) 1471 || hLdrModIn != NIL_RTLDRMOD) 1472 { 1454 1473 rc = rtDbgModFromMachOImageWorker(pDbgMod, enmArch, cbImage, cSegs, paSegs, pUuid, hDbgCfg, fFlags); 1474 if (RT_FAILURE(rc) && hLdrModIn != NIL_RTLDRMOD) 1475 { 1476 /* 1477 * Create module based on exports from hLdrModIn. 1478 */ 1479 if (!cbImage) 1480 cbImage = (uint32_t)RTLdrSize(hLdrModIn); 1481 pDbgMod->pImgVt = &g_rtDbgModVtImgLdr; 1482 1483 rc = rtDbgModLdrOpenFromHandle(pDbgMod, hLdrModIn); 1484 if (RT_SUCCESS(rc)) 1485 { 1486 /* We now own the loader handle, so clear the caller variable. */ 1487 if (phLdrModIn) 1488 *phLdrModIn = NIL_RTLDRMOD; 1489 1490 /** @todo delayed exports stuff */ 1491 rc = rtDbgModCreateForExports(pDbgMod); 1492 } 1493 } 1494 } 1455 1495 else 1456 1496 { … … 1493 1533 return rc; 1494 1534 } 1495 1496 1497 1498 1535 RT_EXPORT_SYMBOL(RTDbgModCreateFromMachOImage); 1499 1536
Note:
See TracChangeset
for help on using the changeset viewer.