Changeset 59973 in vbox
- Timestamp:
- Mar 9, 2016 8:07:42 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp
r59972 r59973 57 57 #include <iprt/param.h> 58 58 #include <iprt/path.h> 59 #include <iprt/sort.h>60 59 #include <iprt/string.h> 61 60 #include <iprt/strcache.h> … … 70 69 * Structures and Typedefs * 71 70 *********************************************************************************************************************************/ 71 /** 72 * Directory sorting order. 73 */ 74 typedef enum RTCVDIRORDER 75 { 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_MOD 83 } RTCVDIRORDER; 84 85 72 86 /** 73 87 * File type. … … 109 123 /** The offset of the subsection directory (relative to offBase). */ 110 124 uint32_t offDir; 125 /** The directory order. */ 126 RTCVDIRORDER enmDirOrder; 111 127 /** @} */ 112 128 … … 1359 1375 1360 1376 /** 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 /**1381 1377 * Loads the directory into memory (RTDBGMODCV::paDirEnts and 1382 1378 * RTDBGMODCV::cDirEnts). … … 1489 1485 if (RT_SUCCESS(rc)) 1490 1486 { 1491 uint32_t const cbDbgInfo = pThis->cbDbgInfo;1492 uint32_t const cDirEnts = pThis->cDirEnts;1493 1494 1487 /* 1495 * Just sort the directory in a way we like, no need to make 1496 * complicated demands on the linker output. 1488 * Basic info validation and determining the directory ordering. 1497 1489 */ 1498 RTSortShell(pThis->paDirEnts, cDirEnts, sizeof(pThis->paDirEnts[0]), rtDbgModCvDirEntCmp, NULL); 1499 1500 /* 1501 * Basic info validation. 1502 */ 1490 bool fWatcom = 0; 1503 1491 uint16_t cGlobalMods = 0; 1504 1492 uint16_t cNormalMods = 0; 1505 1493 uint16_t iModLast = 0; 1494 uint32_t const cbDbgInfo = pThis->cbDbgInfo; 1495 uint32_t const cDirEnts = pThis->cDirEnts; 1506 1496 Log2(("RTDbgModCv: %u (%#x) directory entries:\n", cDirEnts, cDirEnts)); 1507 1497 for (uint32_t i = 0; i < cDirEnts; i++) … … 1547 1537 iModLast = pDirEnt->iMod; 1548 1538 } 1539 else if (pDirEnt->iMod < iModLast) 1540 fWatcom = true; 1549 1541 cNormalMods++; 1550 1542 } … … 1557 1549 if (RT_SUCCESS(rc)) 1558 1550 { 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 */ 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 1563 1561 /* 1564 1562 * Validate the directory ordering. 1565 1563 */ 1566 1564 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 } 1567 1577 1568 1578 /* Normal modules. */ … … 1638 1648 i++; 1639 1649 } 1640 #endif 1641 } 1650 } 1651 1642 1652 } 1643 1653
Note:
See TracChangeset
for help on using the changeset viewer.