Changeset 49061 in vbox
- Timestamp:
- Oct 11, 2013 8:15:59 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 89860
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/dbg.h
r49053 r49061 461 461 RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszFilename, PCRTUUID pUuid, 462 462 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2); 463 RTDECL(int) RTDbgCfgOpenMachOImage(RTDBGCFG hDbgCfg, const char *pszFilename, PCRTUUID pUuid, 464 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2); 463 465 464 466 -
trunk/include/iprt/mangling.h
r49044 r49061 380 380 # define RTDbgCfgOpenDbg RT_MANGLER(RTDbgCfgOpenDbg) 381 381 # define RTDbgCfgOpenDsymBundle RT_MANGLER(RTDbgCfgOpenDsymBundle) 382 # define RTDbgCfgOpenMachOImage RT_MANGLER(RTDbgCfgOpenMachOImage) 382 383 # define RTDbgCfgOpenDwo RT_MANGLER(RTDbgCfgOpenDwo) 383 384 # define RTDbgCfgOpenPdb70 RT_MANGLER(RTDbgCfgOpenPdb70) -
trunk/src/VBox/Debugger/DBGPlugInDarwin.cpp
r49044 r49061 272 272 return VERR_INVALID_NAME; 273 273 if (!strcmp(uLCmd.pSeg32->segname, "__LINKEDIT")) 274 continue; /* This usually is discarded or not loaded at all. */274 break; /* This usually is discarded or not loaded at all. */ 275 275 if (cSegs >= RT_ELEMENTS(aSegs)) 276 276 return VERR_BUFFER_OVERFLOW; … … 291 291 return VERR_INVALID_NAME; 292 292 if (!strcmp(uLCmd.pSeg64->segname, "__LINKEDIT")) 293 continue; /* This usually is discarded or not loaded at all. */293 break; /* This usually is discarded or not loaded at all. */ 294 294 if (cSegs >= RT_ELEMENTS(aSegs)) 295 295 return VERR_BUFFER_OVERFLOW; … … 388 388 uint64_t uRvaNext = 0; 389 389 uint32_t cLinked = 0; 390 for (iSeg = 0; iSeg < cSegs; iSeg++) 390 iSeg = cSegs; 391 while (iSeg-- > 0) /* HACK: Map in reverse order to avoid replacing __TEXT. */ 391 392 if (aSegs[iSeg].cb) 392 393 { 393 int rc2 = RTDbgAsModuleLinkSeg(hAs, hMod, iSeg, aSegs[iSeg].Address, RTDBGASLINK_FLAGS_REPLACE /*fFlags*/); 394 /* Find matching segment in the debug module. */ 395 uint32_t iDbgSeg = 0; 396 while (iDbgSeg < cSegs) 397 { 398 RTDBGSEGMENT SegInfo; 399 int rc3 = RTDbgModSegmentByIndex(hMod, iDbgSeg, &SegInfo); 400 if (RT_SUCCESS(rc3) && !strcmp(SegInfo.szName, aSegs[iSeg].szName)) 401 break; 402 iDbgSeg++; 403 } 404 AssertMsgStmt(iDbgSeg < cSegs, ("%s\n", aSegs[iSeg].szName), continue); 405 406 /* Map it. */ 407 int rc2 = RTDbgAsModuleLinkSeg(hAs, hMod, iDbgSeg, aSegs[iSeg].Address, RTDBGASLINK_FLAGS_REPLACE /*fFlags*/); 394 408 if (RT_SUCCESS(rc2)) 395 409 cLinked++; -
trunk/src/VBox/Runtime/common/dbg/dbgcfg.cpp
r49057 r49061 184 184 185 185 186 /** Interesting bundle suffixes. */ 187 static const char * const g_apszBundleSuffixes[] = 188 { 189 ".kext", 190 ".app", 191 ".framework", 192 ".component", 193 ".action", 194 ".caction", 195 ".bundle", 196 ".sourcebundle", 197 ".menu", 198 ".plugin", 199 ".ppp", 200 ".monitorpanel", 201 ".scripting", 202 ".prefPane", 203 ".qlgenerator", 204 ".brailledriver", 205 ".saver", 206 ".SpeechVoice", 207 ".SpeechRecognizer", 208 ".SpeechSynthesizer", 209 ".mdimporter", 210 ".spreporter", 211 ".xpc", 212 NULL 213 }; 214 215 /** Debug bundle suffixes. (Same as above + .dSYM) */ 216 static const char * const g_apszDSymBundleSuffixes[] = 217 { 218 ".dSYM", 219 ".kext.dSYM", 220 ".app.dSYM", 221 ".framework.dSYM", 222 ".component.dSYM", 223 ".action.dSYM", 224 ".caction.dSYM", 225 ".bundle.dSYM", 226 ".sourcebundle.dSYM", 227 ".menu.dSYM", 228 ".plugin.dSYM", 229 ".ppp.dSYM", 230 ".monitorpanel.dSYM", 231 ".scripting.dSYM", 232 ".prefPane.dSYM", 233 ".qlgenerator.dSYM", 234 ".brailledriver.dSYM", 235 ".saver.dSYM", 236 ".SpeechVoice.dSYM", 237 ".SpeechRecognizer.dSYM", 238 ".SpeechSynthesizer.dSYM", 239 ".mdimporter.dSYM", 240 ".spreporter.dSYM", 241 ".xpc.dSYM", 242 NULL 243 }; 244 245 186 246 187 247 /** … … 374 434 if (fCaseInsensitive) 375 435 return rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, RTDIRENTRYTYPE_DIRECTORY); 436 437 pszPath[cchPath] = '\0'; 438 return false; 439 } 440 441 442 /** 443 * Appends @a pszSubDir1 and @a pszSuffix to @a pszPath and check whether it 444 * exists and is a directory. 445 * 446 * If @a fCaseInsensitive is set, we will do a case insensitive search for a 447 * matching sub directory. 448 * 449 * @returns true / false 450 * @param pszPath The path buffer containing an existing 451 * directory. RTPATH_MAX in size. 452 * @param pszSubDir The sub directory to append. 453 * @param fCaseInsensitive Whether case insensitive searching is required. 454 */ 455 static bool rtDbgCfgIsDirAndFixCase2(char *pszPath, const char *pszSubDir, const char *pszSuffix, bool fCaseInsensitive) 456 { 457 Assert(!strpbrk(pszSuffix, ":/\\")); 458 459 /* Save the length of the input path so we can restore it in the case 460 insensitive branch further down. */ 461 size_t const cchPath = strlen(pszPath); 462 463 /* 464 * Append the subdirectory and suffix, then check if we got a hit. 465 */ 466 int rc = RTPathAppend(pszPath, RTPATH_MAX, pszSubDir); 467 if (RT_SUCCESS(rc)) 468 { 469 rc = RTStrCat(pszPath, RTPATH_MAX, pszSuffix); 470 if (RT_SUCCESS(rc)) 471 { 472 if (RTDirExists(pszPath)) 473 return true; 474 475 /* 476 * Do case insensitive lookup if requested. 477 */ 478 if (fCaseInsensitive) 479 return rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, RTDIRENTRYTYPE_DIRECTORY); 480 } 481 } 376 482 377 483 pszPath[cchPath] = '\0'; … … 1251 1357 * Very similar to rtDbgCfgTryOpenDir. 1252 1358 */ 1253 static int rtDbgCfgTryOpenDsymBundleInDir(PRTDBGCFGINT pThis, char *pszPath, PRTPATHSPLIT pSplitFn, const char *pszDsymName, 1254 uint32_t fFlags, PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2) 1359 static int rtDbgCfgTryOpenDsymBundleInDir(PRTDBGCFGINT pThis, char *pszPath, PRTPATHSPLIT pSplitFn, 1360 const char * const *papszSuffixes, uint32_t fFlags, 1361 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2) 1255 1362 { 1256 1363 int rcRet = VWRN_NOT_FOUND; … … 1278 1385 /* 1279 1386 * Look for the file with less and less of the original path given. 1280 */ 1387 * Also try out typical bundle extension variations. 1388 */ 1389 const char *pszName = pSplitFn->apszComps[pSplitFn->cComps - 1]; 1281 1390 for (unsigned i = RTPATH_PROP_HAS_ROOT_SPEC(pSplitFn->fProps); i < pSplitFn->cComps; i++) 1282 1391 { … … 1287 1396 if (!rtDbgCfgIsDirAndFixCase(pszPath, pSplitFn->apszComps[i], fCaseInsensitive)) 1288 1397 rc2 = VERR_FILE_NOT_FOUND; 1289 if ( RT_SUCCESS(rc2) 1290 && !rtDbgCfgIsDirAndFixCase(pszPath, pszDsymName, fCaseInsensitive) 1291 && !rtDbgCfgIsDirAndFixCase(pszPath, "Contents", fCaseInsensitive) 1292 && !rtDbgCfgIsDirAndFixCase(pszPath, "Resources", fCaseInsensitive) 1293 && !rtDbgCfgIsDirAndFixCase(pszPath, "DWARF", fCaseInsensitive)) 1294 { 1295 if (rtDbgCfgIsFileAndFixCase(pszPath, pSplitFn->apszComps[pSplitFn->cComps - 1], NULL /*pszSuffix*/, 1296 fCaseInsensitive, false, NULL)) 1398 if (RT_SUCCESS(rc2)) 1399 { 1400 size_t cchCurPath = cchPath + strlen(&pszPath[cchPath]); 1401 for (uint32_t iSuffix = 0; papszSuffixes[iSuffix]; iSuffix++) 1297 1402 { 1298 rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath); 1299 rc2 = pfnCallback(pThis, pszPath, pvUser1, pvUser2); 1300 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN) 1403 if ( !rtDbgCfgIsDirAndFixCase2(pszPath, pszName, papszSuffixes[iSuffix], fCaseInsensitive) 1404 && !rtDbgCfgIsDirAndFixCase(pszPath, "Contents", fCaseInsensitive) 1405 && !rtDbgCfgIsDirAndFixCase(pszPath, "Resources", fCaseInsensitive) 1406 && !rtDbgCfgIsDirAndFixCase(pszPath, "DWARF", fCaseInsensitive)) 1301 1407 { 1302 if (rc2 == VINF_CALLBACK_RETURN) 1303 rtDbgCfgLog1(pThis, "Found '%s'.\n", pszPath); 1304 else 1305 rtDbgCfgLog1(pThis, "Error opening '%s'.\n", pszPath); 1306 return rc2; 1408 if (rtDbgCfgIsFileAndFixCase(pszPath, pszName, NULL /*pszSuffix*/, fCaseInsensitive, false, NULL)) 1409 { 1410 rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath); 1411 rc2 = pfnCallback(pThis, pszPath, pvUser1, pvUser2); 1412 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN) 1413 { 1414 if (rc2 == VINF_CALLBACK_RETURN) 1415 rtDbgCfgLog1(pThis, "Found '%s'.\n", pszPath); 1416 else 1417 rtDbgCfgLog1(pThis, "Error opening '%s'.\n", pszPath); 1418 return rc2; 1419 } 1420 rtDbgCfgLog1(pThis, "Error %Rrc opening '%s'.\n", rc2, pszPath); 1421 if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet)) 1422 rcRet = rc2; 1423 } 1307 1424 } 1308 rtDbgCfgLog1(pThis, "Error %Rrc opening '%s'.\n", rc2, pszPath);1309 if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet))1310 rcRet = rc2;1311 1425 } 1312 1426 } … … 1330 1444 * Very similar to rtDbgCfgTryOpenList. 1331 1445 */ 1332 static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHSPLIT pSplitFn, 1333 const char *pszDsymName, const char *pszCacheSubDir, const char *pszCacheSuffix, 1334 const char *pszUuidMappingSubDir, uint32_t fFlags, char *pszPath, 1335 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2) 1446 static int rtDbgCfgTryOpenBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHSPLIT pSplitFn, 1447 const char * const *papszSuffixes, const char *pszCacheSubDir, 1448 const char *pszCacheSuffix, const char *pszUuidMappingSubDir, 1449 uint32_t fFlags, char *pszPath, 1450 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2) 1336 1451 { 1337 1452 int rcRet = VWRN_NOT_FOUND; … … 1459 1574 RTPathChangeToUnixSlashes(pszPath, false); 1460 1575 1461 rc2 = rtDbgCfgTryOpenDsymBundleInDir(pThis, pszPath, pSplitFn, p szDsymName, fFlagsDir,1576 rc2 = rtDbgCfgTryOpenDsymBundleInDir(pThis, pszPath, pSplitFn, papszSuffixes, fFlagsDir, 1462 1577 pfnCallback, pvUser1, pvUser2); 1463 1578 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN) … … 1523 1638 1524 1639 1525 RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTUUID pUuid, 1526 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2) 1640 static int rtDbgCfgOpenBundleFile(RTDBGCFG hDbgCfg, const char *pszImage, const char * const *papszSuffixes, 1641 const char *pszBundleSubDir, PCRTUUID pUuid, const char *pszUuidMapDirName, 1642 const char *pszCacheSuffix, bool fOpenImage, 1643 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2) 1527 1644 { 1528 1645 /* 1529 1646 * Bundles are directories, means we can forget about sharing code much 1530 1647 * with the other RTDbgCfgOpenXXX methods. Thus we're duplicating a lot of 1531 * code from rtDbgCfgOpenWithSubDir with .dSYM related adjustments, so, a bug 1532 * found here or there probably means the other version needs updating. 1648 * code from rtDbgCfgOpenWithSubDir with .dSYM/.kext/.dylib/.app/.* related 1649 * adjustments, so, a bug found here or there probably means the other 1650 * version needs updating. 1533 1651 */ 1534 1652 int rcRet = VINF_SUCCESS; … … 1561 1679 pszCacheSubDir = szCacheSubDir; 1562 1680 1563 rc2 = rtDbgCfgConstructUuidMappingSubDir(szUuidMappingSubDir, sizeof(szUuidMappingSubDir), 1564 RTDBG_CACHE_UUID_MAP_DIR_DSYMS, pUuid); 1681 rc2 = rtDbgCfgConstructUuidMappingSubDir(szUuidMappingSubDir, sizeof(szUuidMappingSubDir), pszUuidMapDirName, pUuid); 1565 1682 AssertRCReturn(rc2, rc2); 1566 1683 } … … 1585 1702 AssertReturnStmt(pSplitFn->fProps & RTPATH_PROP_FILENAME, RTPathSplitFree(pSplitFn), VERR_IS_A_DIRECTORY); 1586 1703 1587 1588 /** @todo Extend this to look for pszFilename*.dSYM as well as detecting a1589 * bundle and looking for a .dSYM bundle outside the image bundle. */1590 1591 1704 /* 1592 1705 * Try the image directory first. … … 1596 1709 { 1597 1710 rc2 = RTPathSplitReassemble(pSplitFn, RTPATH_STR_F_STYLE_HOST, szPath, sizeof(szPath)); 1598 if (RT_SUCCESS(rc2)) 1599 rc2 = RTStrCat(szPath, sizeof(szPath), 1600 ".dSYM" RTPATH_SLASH_STR "Contents" RTPATH_SLASH_STR "Resources" RTPATH_SLASH_STR "DWARF"); 1601 if (RT_SUCCESS(rc2)) 1602 rc2 = RTPathAppend(szPath, sizeof(szPath), pSplitFn->apszComps[pSplitFn->cComps - 1]); 1603 if (RT_SUCCESS(rc2)) 1711 if (fOpenImage && RT_SUCCESS(rc2)) 1712 { 1713 rc2 = RTStrCat(szPath, sizeof(szPath), papszSuffixes[0]); 1714 if (RT_SUCCESS(rc2)) 1715 rc2 = RTStrCat(szPath, sizeof(szPath), pszBundleSubDir); 1716 if (RT_SUCCESS(rc2)) 1717 rc2 = RTPathAppend(szPath, sizeof(szPath), pSplitFn->apszComps[pSplitFn->cComps - 1]); 1718 } 1719 if (RT_SUCCESS(rc2) && RTPathExists(szPath)) 1604 1720 { 1605 1721 RTPathChangeToUnixSlashes(szPath, false); … … 1617 1733 && rc2 != VERR_CALLBACK_RETURN) 1618 1734 { 1619 char *pszDsymName = (char *)alloca(strlen(pSplitFn->apszComps[pSplitFn->cComps - 1]) + sizeof(".dSYM"));1620 strcat(strcpy(pszDsymName, pSplitFn->apszComps[pSplitFn->cComps - 1]), ".dSYM");1621 1622 1735 /* 1623 1736 * Try the current directory (will take cover relative paths … … 1629 1742 RTPathChangeToUnixSlashes(szPath, false); 1630 1743 1631 rc2 = rtDbgCfgTryOpenDsymBundleInDir(pThis, szPath, pSplitFn, pszDsymName, fFlags, pfnCallback, pvUser1, pvUser2); 1744 rc2 = rtDbgCfgTryOpenDsymBundleInDir(pThis, szPath, pSplitFn, g_apszDSymBundleSuffixes, 1745 fFlags, pfnCallback, pvUser1, pvUser2); 1632 1746 if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet)) 1633 1747 rcRet = rc2; … … 1643 1757 * Run the applicable lists. 1644 1758 */ 1645 rc2 = rtDbgCfgTryOpen DsumBundleInList(pThis, &pThis->PathList, pSplitFn, pszDsymName,1646 pszCacheSubDir, RTDBG_CACHE_DSYM_FILE_SUFFIX,1647 1648 1759 rc2 = rtDbgCfgTryOpenBundleInList(pThis, &pThis->PathList, pSplitFn, g_apszDSymBundleSuffixes, 1760 pszCacheSubDir, pszCacheSuffix, 1761 pszUuidMappingSubDir, fFlags, szPath, 1762 pfnCallback, pvUser1, pvUser2); 1649 1763 if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet)) 1650 1764 rcRet = rc2; … … 1664 1778 rcRet = VERR_NOT_FOUND; 1665 1779 return rcRet; 1780 } 1781 1782 1783 RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTUUID pUuid, 1784 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2) 1785 { 1786 return rtDbgCfgOpenBundleFile(hDbgCfg, pszImage, g_apszDSymBundleSuffixes, 1787 "Contents" RTPATH_SLASH_STR "Resources" RTPATH_SLASH_STR "DWARF", 1788 pUuid, RTDBG_CACHE_UUID_MAP_DIR_DSYMS, RTDBG_CACHE_DSYM_FILE_SUFFIX, false /* fOpenImage */, 1789 pfnCallback, pvUser1, pvUser2); 1790 } 1791 1792 1793 RTDECL(int) RTDbgCfgOpenMachOImage(RTDBGCFG hDbgCfg, const char *pszImage, PCRTUUID pUuid, 1794 PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2) 1795 { 1796 return rtDbgCfgOpenBundleFile(hDbgCfg, pszImage, g_apszBundleSuffixes, 1797 "Contents" RTPATH_SLASH_STR "MacOS", 1798 pUuid, RTDBG_CACHE_UUID_MAP_DIR_IMAGES, NULL /*pszCacheSuffix*/, true /* fOpenImage */, 1799 pfnCallback, pvUser1, pvUser2); 1666 1800 } 1667 1801 -
trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp
r49053 r49061 1188 1188 */ 1189 1189 1190 1191 /** 1192 * Argument package used when opening Mach-O images and .dSYMs files. 1193 */ 1194 typedef struct RTDBGMODMACHOARGS 1195 { 1196 /** For use more internal use in file locator callbacks. */ 1197 RTLDRARCH enmArch; 1198 /** For use more internal use in file locator callbacks. */ 1199 PCRTUUID pUuid; 1200 /** For use more internal use in file locator callbacks. */ 1201 bool fOpenImage; 1202 } RTDBGMODMACHOARGS; 1203 /** Pointer to a const segment package. */ 1204 typedef RTDBGMODMACHOARGS const *PCRTDBGMODMACHOARGS; 1205 1206 1207 1190 1208 /** @callback_method_impl{FNRTDBGCFGOPEN} */ 1191 1209 static DECLCALLBACK(int) 1192 rtDbgModFromMachOImageOpenMachOCallback(RTDBGCFG hDbgCfg, const char *pszFilename, void *pvUser1, void *pvUser2) 1193 { 1194 PRTDBGMODINT pDbgMod = (PRTDBGMODINT)pvUser1; 1195 PCRTDBGDWARFSEGPKG pSegPkg = (PCRTDBGDWARFSEGPKG)pvUser2; 1196 1197 /** @todo */ 1198 1199 return VERR_OPEN_FAILED; 1200 } 1201 1202 1203 /** @callback_method_impl{FNRTDBGCFGOPEN} */ 1204 static DECLCALLBACK(int) 1205 rtDbgModFromMachOImageOpenDsymCallback(RTDBGCFG hDbgCfg, const char *pszFilename, void *pvUser1, void *pvUser2) 1206 { 1207 PRTDBGMODINT pDbgMod = (PRTDBGMODINT)pvUser1; 1208 PCRTDBGDWARFSEGPKG pSegPkg = (PCRTDBGDWARFSEGPKG)pvUser2; 1210 rtDbgModFromMachOImageOpenDsymMachOCallback(RTDBGCFG hDbgCfg, const char *pszFilename, void *pvUser1, void *pvUser2) 1211 { 1212 PRTDBGMODINT pDbgMod = (PRTDBGMODINT)pvUser1; 1213 PCRTDBGMODMACHOARGS pArgs = (PCRTDBGMODMACHOARGS)pvUser2; 1209 1214 1210 1215 Assert(!pDbgMod->pDbgVt); … … 1236 1241 pDbgMod->pImgVt = pImg->pVt; 1237 1242 pDbgMod->pvImgPriv = NULL; 1238 rc = pImg->pVt->pfnTryOpen(pDbgMod, p SegPkg->enmArch);1243 rc = pImg->pVt->pfnTryOpen(pDbgMod, pArgs->enmArch); 1239 1244 if (RT_SUCCESS(rc)) 1240 1245 break; … … 1248 1253 * Check the UUID if one was given. 1249 1254 */ 1250 if (p SegPkg->pUuid)1255 if (pArgs->pUuid) 1251 1256 { 1252 1257 RTUUID UuidOpened; … … 1254 1259 if (RT_SUCCESS(rc)) 1255 1260 { 1256 if (RTUuidCompare(&UuidOpened, p SegPkg->pUuid) != 0)1261 if (RTUuidCompare(&UuidOpened, pArgs->pUuid) != 0) 1257 1262 rc = VERR_DBG_FILE_MISMATCH; 1258 1263 } … … 1267 1272 for (PRTDBGMODREGDBG pDbg = g_pDbgHead; pDbg; pDbg = pDbg->pNext) 1268 1273 { 1269 if (pDbg->pVt->fSupports & RT_DBGTYPE_DWARF) 1274 if ( pArgs->fOpenImage 1275 || (pDbg->pVt->fSupports & RT_DBGTYPE_DWARF) ) 1276 1270 1277 { 1271 1278 pDbgMod->pDbgVt = pDbg->pVt; 1272 pDbgMod->pvDbgPriv = pSegPkg->cSegs ? (void *)pSegPkg :NULL;1279 pDbgMod->pvDbgPriv = NULL; 1273 1280 rc = pDbg->pVt->pfnTryOpen(pDbgMod, pDbgMod->pImgVt->pfnGetArch(pDbgMod)); 1274 1281 if (RT_SUCCESS(rc)) … … 1286 1293 } 1287 1294 } 1295 1296 /* 1297 * Likely fallback for when opening image. 1298 */ 1299 if (pArgs->fOpenImage) 1300 { 1301 rc = rtDbgModCreateForExports(pDbgMod); 1302 if (RT_SUCCESS(rc)) 1303 { 1304 /* 1305 * Done. 1306 */ 1307 RTSemRWReleaseRead(g_hDbgModRWSem); 1308 RTStrCacheRelease(g_hDbgModStrCache, pszImgFileOrg); 1309 return VINF_CALLBACK_RETURN; 1310 } 1311 } 1288 1312 } 1289 1313 … … 1307 1331 uint32_t cSegs, PCRTDBGSEGMENT paSegs, PCRTUUID pUuid, RTDBGCFG hDbgCfg) 1308 1332 { 1309 RTDBGDWARFSEGPKG SegPkg; 1310 SegPkg.cSegs = cSegs; 1311 SegPkg.paSegs = paSegs; 1312 SegPkg.enmArch = enmArch; 1313 SegPkg.pUuid = pUuid && RTUuidIsNull(pUuid) ? pUuid : NULL; 1333 RTDBGMODMACHOARGS Args; 1334 Args.enmArch = enmArch; 1335 Args.pUuid = pUuid && RTUuidIsNull(pUuid) ? pUuid : NULL; 1336 Args.fOpenImage = false; 1314 1337 1315 1338 /* … … 1317 1340 */ 1318 1341 int rc = RTDbgCfgOpenDsymBundle(hDbgCfg, pDbgMod->pszImgFile, pUuid, 1319 rtDbgModFromMachOImageOpenDsym Callback, pDbgMod, &SegPkg);1342 rtDbgModFromMachOImageOpenDsymMachOCallback, pDbgMod, &Args); 1320 1343 if (RT_FAILURE(rc)) 1321 1344 { … … 1323 1346 * If we cannot get at the .dSYM, try the executable image. 1324 1347 */ 1325 //rc = RTDbgCfgOpenMachOImage(hDbgCfg, pDbgMod->pszImgFile, pUuid, 1326 // rtDbgModFromMachOImageOpenMachOCallback, pDbgMod, &SegPkg); 1348 Args.fOpenImage = true; 1349 rc = RTDbgCfgOpenMachOImage(hDbgCfg, pDbgMod->pszImgFile, pUuid, 1350 rtDbgModFromMachOImageOpenDsymMachOCallback, pDbgMod, &Args); 1327 1351 } 1328 1352 return rc; … … 1398 1422 */ 1399 1423 if ( !(fDbgCfg & RTDBGCFG_FLAGS_DEFERRED) 1424 || cSegs /* for the time being. */ 1400 1425 || (!cbImage && !cSegs) 1401 1426 || (fFlags & RTDBGMOD_F_NOT_DEFERRED) ) … … 1406 1431 * Procrastinate. Need image size atm. 1407 1432 */ 1408 uint32_t uRvaMax = cbImage;1409 if (!uRvaMax)1410 for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++)1411 {1412 if ( paSegs[iSeg].uRva > uRvaMax1413 && paSegs[iSeg].uRva - uRvaMax < _1M)1414 uRvaMax = paSegs[iSeg].uRva;1415 uRvaMax += paSegs[iSeg].cb;1416 }1417 1418 1433 PRTDBGMODDEFERRED pDeferred; 1419 rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromMachOImageDeferredCallback, uRvaMax, hDbgCfg,1434 rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromMachOImageDeferredCallback, cbImage, hDbgCfg, 1420 1435 RT_OFFSETOF(RTDBGMODDEFERRED, u.MachO.aSegs[cSegs]), 1421 1436 &pDeferred); … … 1426 1441 pDeferred->u.MachO.cSegs = cSegs; 1427 1442 if (cSegs) 1428 {1429 1443 memcpy(&pDeferred->u.MachO.aSegs, paSegs, cSegs * sizeof(paSegs[0])); 1430 if (!cbImage)1431 {1432 /* If we calculated a cbImage above, do corresponding RVA adjustments. */1433 uRvaMax = 0;1434 for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++)1435 {1436 if ( paSegs[iSeg].uRva > uRvaMax1437 && paSegs[iSeg].uRva - uRvaMax < _1M)1438 uRvaMax = paSegs[iSeg].uRva;1439 else1440 pDeferred->u.MachO.aSegs[iSeg].uRva = uRvaMax;1441 uRvaMax += paSegs[iSeg].cb;1442 }1443 }1444 }1445 1444 } 1446 1445 } -
trunk/src/VBox/Runtime/include/internal/dbgmod.h
r49044 r49061 641 641 642 642 643 /**644 * Special segment package used passing segment order information for mach-o645 * images (mainly mach_kernel, really).646 *647 * Passes to rtDbgModDwarf_TryOpen via RTDBGMODINF::pvDbgPriv.648 */649 typedef struct RTDBGDWARFSEGPKG650 {651 /** Pointer to the segment array. */652 PCRTDBGSEGMENT paSegs;653 /** Number of segments. */654 uint32_t cSegs;655 /** For use more internal use in file locator callbacks. */656 RTLDRARCH enmArch;657 /** For use more internal use in file locator callbacks. */658 PCRTUUID pUuid;659 } RTDBGDWARFSEGPKG;660 /** Pointer to a const segment package. */661 typedef RTDBGDWARFSEGPKG const *PCRTDBGDWARFSEGPKG;662 663 664 643 extern DECLHIDDEN(RTSTRCACHE) g_hDbgModStrCache; 665 644 extern DECLHIDDEN(RTDBGMODVTDBG const) g_rtDbgModVtDbgCodeView;
Note:
See TracChangeset
for help on using the changeset viewer.