VirtualBox

Ignore:
Timestamp:
Nov 1, 2016 12:05:15 PM (8 years ago)
Author:
vboxsync
Message:

DBGFR3Cfg: Bugfixes, correctly split a basic block transferring any errors and setting the correct end address

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/DBGFR3Cfg.cpp

    r64503 r64507  
    464464        {
    465465            /* Move instructions over. */
    466             pCfgBbNew->cInstr = cInstrNew;
    467             pCfgBbNew->AddrEnd = pCfgBb->AddrEnd;
     466            pCfgBbNew->cInstr     = cInstrNew;
     467            pCfgBbNew->AddrEnd    = pCfgBb->AddrEnd;
    468468            pCfgBbNew->enmEndType = pCfgBb->enmEndType;
     469            pCfgBbNew->fFlags     = pCfgBb->fFlags & ~DBGF_CFG_BB_F_ENTRY;
     470
     471            /* Move any error to the new basic block and clear them in the old basic block. */
     472            pCfgBbNew->rcError    = pCfgBb->rcError;
     473            pCfgBbNew->pszErr     = pCfgBb->pszErr;
     474            pCfgBb->rcError       = VINF_SUCCESS;
     475            pCfgBb->pszErr        = NULL;
     476            pCfgBb->fFlags       &= ~DBGF_CFG_BB_F_INCOMPLETE_ERR;
    469477
    470478            memcpy(&pCfgBbNew->aInstr[0], &pCfgBb->aInstr[idxInstrSplit], cInstrNew * sizeof(DBGFCFGBBINSTR));
    471479            pCfgBb->cInstr     = idxInstrSplit;
    472480            pCfgBb->enmEndType = DBGFCFGBBENDTYPE_UNCOND;
    473             pCfgBb->AddrEnd    = pCfgBb->aInstr[idxInstrSplit].AddrInstr;
     481            pCfgBb->AddrEnd    = pCfgBb->aInstr[idxInstrSplit-1].AddrInstr;
    474482            pCfgBb->AddrTarget = pCfgBbNew->AddrStart;
    475             DBGFR3AddrAdd(&pCfgBb->AddrEnd, pCfgBb->aInstr[idxInstrSplit].cbInstr - 1);
     483            DBGFR3AddrAdd(&pCfgBb->AddrEnd, pCfgBb->aInstr[idxInstrSplit-1].cbInstr - 1);
    476484            RT_BZERO(&pCfgBb->aInstr[idxInstrSplit], cInstrNew * sizeof(DBGFCFGBBINSTR));
    477485
     
    584592            break;
    585593        }
     594
     595        pCfgBb->fFlags &= ~DBGF_CFG_BB_F_EMPTY;
    586596
    587597        rc = dbgfR3DisasInstrStateEx(pUVM, idCpu, &AddrDisasm, fFlags,
     
    610620                PDBGFCFGBBINSTR pInstr = &pCfgBb->aInstr[pCfgBb->cInstr];
    611621
    612                 pCfgBb->fFlags &= ~DBGF_CFG_BB_F_EMPTY;
    613 
    614622                pInstr->AddrInstr = AddrDisasm;
    615623                pInstr->cbInstr   = DisState.cbInstr;
     
    618626
    619627                pCfgBb->AddrEnd = AddrDisasm;
    620                 DBGFR3AddrSub(&pCfgBb->AddrEnd, 1);
     628                DBGFR3AddrAdd(&pCfgBb->AddrEnd, pInstr->cbInstr - 1);
    621629                DBGFR3AddrAdd(&AddrDisasm, pInstr->cbInstr);
    622630
     
    10071015    pDumpBb->pCfgBb = pCfgBb;
    10081016    pDumpBb->cchHeight = pCfgBb->cInstr + 4; /* Include spacing and border top and bottom. */
     1017    pDumpBb->cchWidth = 0;
    10091018    if (   RT_FAILURE(pCfgBb->rcError)
    10101019        && pCfgBb->pszErr)
     
    10131022        pDumpBb->cchWidth = RT_MAX(pDumpBb->cchWidth, (uint32_t)strlen(pCfgBb->pszErr));
    10141023    }
    1015     pDumpBb->cchWidth = 0;
    10161024    for (unsigned i = 0; i < pCfgBb->cInstr; i++)
    10171025        pDumpBb->cchWidth = RT_MAX(pDumpBb->cchWidth, (uint32_t)strlen(pCfgBb->aInstr[i].pszInstr));
     
    11781186            cchWidth = RT_MAX(cchWidth, pDumpBb->cchWidth);
    11791187            cchHeight += pDumpBb->cchHeight;
     1188
     1189            /* Incomplete blocks don't have a successor. */
     1190            if (pDumpBb->pCfgBb->fFlags & DBGF_CFG_BB_F_INCOMPLETE_ERR)
     1191                continue;
     1192
    11801193            switch (pDumpBb->pCfgBb->enmEndType)
    11811194            {
     
    12221235                uY += paDumpBb[i].cchHeight;
    12231236
     1237                /* Incomplete blocks don't have a successor. */
     1238                if (paDumpBb[i].pCfgBb->fFlags & DBGF_CFG_BB_F_INCOMPLETE_ERR)
     1239                    continue;
     1240
    12241241                switch (paDumpBb[i].pCfgBb->enmEndType)
    12251242                {
     
    12471264            {
    12481265                PDBGFCFGDUMPBB pDumpBb = &paDumpBb[i];
     1266
     1267                /* Incomplete blocks don't have a successor. */
     1268                if (pDumpBb->pCfgBb->fFlags & DBGF_CFG_BB_F_INCOMPLETE_ERR)
     1269                    continue;
    12491270
    12501271                switch (pDumpBb->pCfgBb->enmEndType)
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