VirtualBox

Changeset 59973 in vbox


Ignore:
Timestamp:
Mar 9, 2016 8:07:42 PM (9 years ago)
Author:
vboxsync
Message:

dbgmodecodeview.cpp: committed too much

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp

    r59972 r59973  
    5757#include <iprt/param.h>
    5858#include <iprt/path.h>
    59 #include <iprt/sort.h>
    6059#include <iprt/string.h>
    6160#include <iprt/strcache.h>
     
    7069*   Structures and Typedefs                                                                                                      *
    7170*********************************************************************************************************************************/
     71/**
     72 * Directory sorting order.
     73 */
     74typedef 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
    7286/**
    7387 * File type.
     
    109123    /** The offset of the subsection directory (relative to offBase). */
    110124    uint32_t        offDir;
     125    /** The directory order. */
     126    RTCVDIRORDER    enmDirOrder;
    111127    /** @}  */
    112128
     
    13591375
    13601376/**
    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 /**
    13811377 * Loads the directory into memory (RTDBGMODCV::paDirEnts and
    13821378 * RTDBGMODCV::cDirEnts).
     
    14891485    if (RT_SUCCESS(rc))
    14901486    {
    1491         uint32_t const cbDbgInfo    = pThis->cbDbgInfo;
    1492         uint32_t const cDirEnts     = pThis->cDirEnts;
    1493 
    14941487        /*
    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.
    14971489         */
    1498         RTSortShell(pThis->paDirEnts, cDirEnts, sizeof(pThis->paDirEnts[0]), rtDbgModCvDirEntCmp, NULL);
    1499 
    1500         /*
    1501          * Basic info validation.
    1502          */
     1490        bool           fWatcom      = 0;
    15031491        uint16_t       cGlobalMods  = 0;
    15041492        uint16_t       cNormalMods  = 0;
    15051493        uint16_t       iModLast     = 0;
     1494        uint32_t const cbDbgInfo    = pThis->cbDbgInfo;
     1495        uint32_t const cDirEnts     = pThis->cDirEnts;
    15061496        Log2(("RTDbgModCv: %u (%#x) directory entries:\n", cDirEnts, cDirEnts));
    15071497        for (uint32_t i = 0; i < cDirEnts; i++)
     
    15471537                    iModLast = pDirEnt->iMod;
    15481538                }
     1539                else if (pDirEnt->iMod < iModLast)
     1540                    fWatcom = true;
    15491541                cNormalMods++;
    15501542            }
     
    15571549        if (RT_SUCCESS(rc))
    15581550        {
    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
    15631561            /*
    15641562             * Validate the directory ordering.
    15651563             */
    15661564            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                }
    15671577
    15681578            /* Normal modules. */
     
    16381648                    i++;
    16391649                }
    1640 #endif
    1641         }
     1650        }
     1651
    16421652    }
    16431653
Note: See TracChangeset for help on using the changeset viewer.

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