Changeset 59974 in vbox
- Timestamp:
- Mar 9, 2016 8:10:28 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp
r59973 r59974 57 57 #include <iprt/param.h> 58 58 #include <iprt/path.h> 59 #include <iprt/sort.h> 59 60 #include <iprt/string.h> 60 61 #include <iprt/strcache.h> … … 69 70 * Structures and Typedefs * 70 71 *********************************************************************************************************************************/ 71 /**72 * Directory sorting order.73 */74 typedef enum RTCVDIRORDER75 {76 RTCVDIRORDER_INVALID = 0,77 /** Ordered by module. */78 RTCVDIRORDER_BY_MOD,79 /** Ordered by module, but 0 modules at the end. */80 RTCVDIRORDER_BY_MOD_0,81 /** Ordered by section, with global modules at the end. */82 RTCVDIRORDER_BY_SST_MOD83 } RTCVDIRORDER;84 85 86 72 /** 87 73 * File type. … … 123 109 /** The offset of the subsection directory (relative to offBase). */ 124 110 uint32_t offDir; 125 /** The directory order. */126 RTCVDIRORDER enmDirOrder;127 111 /** @} */ 128 112 … … 1375 1359 1376 1360 /** 1361 * @callback_method_impl{PFNRTSORTCMP, 1362 * Used by rtDbgModCvLoadDirectory to sort the directory.} 1363 */ 1364 static DECLCALLBACK(int) rtDbgModCvDirEntCmp(void const *pvElement1, void const *pvElement2, void *pvUser) 1365 { 1366 PRTCVDIRENT32 pEntry1 = (PRTCVDIRENT32)pvElement1; 1367 PRTCVDIRENT32 pEntry2 = (PRTCVDIRENT32)pvElement2; 1368 if (pEntry1->iMod < pEntry2->iMod) 1369 return -1; 1370 if (pEntry1->iMod > pEntry2->iMod) 1371 return 1; 1372 if (pEntry1->uSubSectType < pEntry2->uSubSectType) 1373 return -1; 1374 if (pEntry1->uSubSectType > pEntry2->uSubSectType) 1375 return 1; 1376 return 0; 1377 } 1378 1379 1380 /** 1377 1381 * Loads the directory into memory (RTDBGMODCV::paDirEnts and 1378 1382 * RTDBGMODCV::cDirEnts). … … 1485 1489 if (RT_SUCCESS(rc)) 1486 1490 { 1491 uint32_t const cbDbgInfo = pThis->cbDbgInfo; 1492 uint32_t const cDirEnts = pThis->cDirEnts; 1493 1487 1494 /* 1488 * Basic info validation and determining the directory ordering. 1495 * Just sort the directory in a way we like, no need to make 1496 * complicated demands on the linker output. 1489 1497 */ 1490 bool fWatcom = 0; 1498 RTSortShell(pThis->paDirEnts, cDirEnts, sizeof(pThis->paDirEnts[0]), rtDbgModCvDirEntCmp, NULL); 1499 1500 /* 1501 * Basic info validation. 1502 */ 1491 1503 uint16_t cGlobalMods = 0; 1492 1504 uint16_t cNormalMods = 0; 1493 1505 uint16_t iModLast = 0; 1494 uint32_t const cbDbgInfo = pThis->cbDbgInfo;1495 uint32_t const cDirEnts = pThis->cDirEnts;1496 1506 Log2(("RTDbgModCv: %u (%#x) directory entries:\n", cDirEnts, cDirEnts)); 1497 1507 for (uint32_t i = 0; i < cDirEnts; i++) … … 1537 1547 iModLast = pDirEnt->iMod; 1538 1548 } 1539 else if (pDirEnt->iMod < iModLast)1540 fWatcom = true;1541 1549 cNormalMods++; 1542 1550 } … … 1549 1557 if (RT_SUCCESS(rc)) 1550 1558 { 1551 if (fWatcom) 1552 pThis->enmDirOrder = RTCVDIRORDER_BY_SST_MOD; 1553 else if (pThis->paDirEnts[0].iMod == 0) 1554 pThis->enmDirOrder = RTCVDIRORDER_BY_MOD_0; 1555 else 1556 pThis->enmDirOrder = RTCVDIRORDER_BY_MOD; 1557 Log(("CV dir stats: %u total, %u normal, %u special, iModLast=%#x (%u), enmDirOrder=%d\n", 1558 cDirEnts, cNormalMods, cGlobalMods, iModLast, iModLast, pThis->enmDirOrder)); 1559 1560 1559 Log(("CV dir stats: %u total, %u normal, %u special, iModLast=%#x (%u)\n", 1560 cDirEnts, cNormalMods, cGlobalMods, iModLast, iModLast)); 1561 1562 #if 0 /* skip this stuff */ 1561 1563 /* 1562 1564 * Validate the directory ordering. 1563 1565 */ 1564 1566 uint16_t i = 0; 1565 1566 /* Old style with special modules up front. */1567 if (pThis->enmDirOrder == RTCVDIRORDER_BY_MOD_0)1568 while (i < cGlobalMods)1569 {1570 if (pThis->paDirEnts[i].iMod != 0)1571 {1572 Log(("CV directory entry #%u: Expected iMod=%x instead of %x\n", i, 0, pThis->paDirEnts[i].iMod));1573 rc = VERR_CV_BAD_FORMAT;1574 }1575 i++;1576 }1577 1567 1578 1568 /* Normal modules. */ … … 1648 1638 i++; 1649 1639 } 1650 } 1651 1640 #endif 1641 } 1652 1642 } 1653 1643
Note:
See TracChangeset
for help on using the changeset viewer.