VirtualBox

Ignore:
Timestamp:
Nov 15, 2018 12:40:53 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/dbgmodcontainer.cpp: Fix for symbol replacement for the case that we're replacing the most recently added symbol (ordinal = next-ordinal - 1).

File:
1 edited

Legend:

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

    r74980 r75482  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_DBG
    3132#include <iprt/dbg.h>
    3233#include "internal/iprt.h"
     
    3435#include <iprt/avl.h>
    3536#include <iprt/err.h>
     37#include <iprt/log.h>
    3638#include <iprt/mem.h>
    3739#define RTDBGMODCNT_WITH_MEM_CACHE
     
    410412static void rtDbgModContainer_SymbolReplace(PRTDBGMODCTN pThis, PAVLRUINTPTRTREE pAddrTree, PRTDBGMODCTNSYMBOL pToRemove)
    411413{
     414    RTLogPrintf("rtDbgModContainer_SymbolReplace: pToRemove=%p ordinal=%u %04x:%08RX64 %s\n",
     415         pToRemove, pToRemove->OrdinalCore.Key, pToRemove->iSeg, pToRemove->AddrCore.Key, pToRemove->NameCore.pszString);
     416
    412417    /* Unlink it. */
    413418    PRTSTRSPACECORE pRemovedName = RTStrSpaceRemove(&pThis->Names, pToRemove->NameCore.pszString);
     
    426431    RTMemFree(pToRemove);
    427432
    428     /* Jump the last symbol ordinal to take its place. */
    429     PAVLU32NODECORE pLastOrdinal = RTAvlU32Remove(&pThis->SymbolOrdinalTree, pThis->iNextSymbolOrdinal - 1);
    430     AssertReturnVoid(pLastOrdinal);
    431 
    432     pThis->iNextSymbolOrdinal -= 1;
    433     pLastOrdinal->Key = iOrdinal;
    434     bool fInsert = RTAvlU32Insert(&pThis->SymbolOrdinalTree, pLastOrdinal);
    435     Assert(fInsert); RT_NOREF_PV(fInsert);
     433    /* Jump the last symbol ordinal to take its place, unless pToRemove is the last one. */
     434    if (iOrdinal >= pThis->iNextSymbolOrdinal - 1)
     435        pThis->iNextSymbolOrdinal -= 1;
     436    else
     437    {
     438        PAVLU32NODECORE pLastOrdinal = RTAvlU32Remove(&pThis->SymbolOrdinalTree, pThis->iNextSymbolOrdinal - 1);
     439        AssertReturnVoid(pLastOrdinal);
     440
     441        pThis->iNextSymbolOrdinal -= 1;
     442        pLastOrdinal->Key = iOrdinal;
     443        bool fInsert = RTAvlU32Insert(&pThis->SymbolOrdinalTree, pLastOrdinal);
     444        Assert(fInsert); RT_NOREF_PV(fInsert);
     445    }
    436446}
    437447
     
    494504                    if (piOrdinal)
    495505                        *piOrdinal = pThis->iNextSymbolOrdinal;
     506                    RTLogPrintf("rtDbgModContainer_SymbolAdd: ordinal=%u %04x:%08RX64 LB %#RX64 %s\n",
     507                           pThis->iNextSymbolOrdinal, iSeg, off, cb, pSymbol->NameCore.pszString);
    496508                    pThis->iNextSymbolOrdinal++;
    497509                    return rc;
     
    559571                                *piOrdinal = pThis->iNextSymbolOrdinal;
    560572                            pThis->iNextSymbolOrdinal++;
     573                            RTLogPrintf("rtDbgModContainer_SymbolAdd: ordinal=%u %04x:%08RX64 LB %#RX64 %s [replace codepath]\n",
     574                                   pThis->iNextSymbolOrdinal, iSeg, off, cb, pSymbol->NameCore.pszString);
    561575                            return rc;
    562576                        }
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