VirtualBox

Changeset 46134 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
May 16, 2013 11:32:06 PM (12 years ago)
Author:
vboxsync
Message:

RTDbgModRemoveAll

Location:
trunk/src/VBox/Runtime/common/dbg
Files:
3 edited

Legend:

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

    r44529 r46134  
    395395}
    396396RT_EXPORT_SYMBOL(RTDbgAsRelease);
     397
     398
     399RTDECL(int) RTDbgAsLockExcl(RTDBGAS hDbgAs)
     400{
     401    PRTDBGASINT pDbgAs = hDbgAs;
     402    RTDBGAS_VALID_RETURN_RC(pDbgAs, VERR_INVALID_HANDLE);
     403    RTDBGAS_LOCK_WRITE(pDbgAs);
     404    return VINF_SUCCESS;
     405}
     406RT_EXPORT_SYMBOL(RTDbgAsLockExcl);
     407
     408
     409RTDECL(int) RTDbgAsUnlockExcl(RTDBGAS hDbgAs)
     410{
     411    PRTDBGASINT pDbgAs = hDbgAs;
     412    RTDBGAS_VALID_RETURN_RC(pDbgAs, VERR_INVALID_HANDLE);
     413    RTDBGAS_UNLOCK_WRITE(pDbgAs);
     414    return VINF_SUCCESS;
     415}
     416RT_EXPORT_SYMBOL(RTDbgAsUnlockExcl);
    397417
    398418
  • trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp

    r46109 r46134  
    11611161
    11621162
     1163RTDECL(int) RTDbgModRemoveAll(RTDBGMOD hDbgMod, bool fLeaveSegments)
     1164{
     1165    PRTDBGMODINT pDbgMod = hDbgMod;
     1166    RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
     1167
     1168    RTDBGMOD_LOCK(pDbgMod);
     1169
     1170    /* Only possible on container modules. */
     1171    int rc = VINF_SUCCESS;
     1172    if (pDbgMod->pDbgVt != &g_rtDbgModVtDbgContainer)
     1173    {
     1174        if (fLeaveSegments)
     1175        {
     1176            rc = rtDbgModContainer_LineRemoveAll(pDbgMod);
     1177            if (RT_SUCCESS(rc))
     1178                rc = rtDbgModContainer_SymbolRemoveAll(pDbgMod);
     1179        }
     1180        else
     1181            rc = rtDbgModContainer_RemoveAll(pDbgMod);
     1182    }
     1183    else
     1184        rc = VERR_ACCESS_DENIED;
     1185
     1186    RTDBGMOD_UNLOCK(pDbgMod);
     1187    return rc;
     1188}
     1189
     1190
    11631191RTDECL(RTDBGSEGIDX) RTDbgModRvaToSegOff(RTDBGMOD hDbgMod, RTUINTPTR uRva, PRTUINTPTR poffSeg)
    11641192{
  • trunk/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp

    r46048 r46134  
    613613
    614614
     615/** Destroy a line number node. */
     616static DECLCALLBACK(int)  rtDbgModContainer_DestroyTreeLineNode(PAVLU32NODECORE pNode, void *pvUser)
     617{
     618    PRTDBGMODCTNLINE pLine = RT_FROM_MEMBER(pNode, RTDBGMODCTNLINE, OrdinalCore);
     619    RTStrCacheRelease(g_hDbgModStrCache, pLine->pszFile);
     620    pLine->pszFile = NULL;
     621    RTMemFree(pLine);
     622    NOREF(pvUser);
     623    return 0;
     624}
     625
     626
    615627/** Destroy a symbol node. */
    616628static DECLCALLBACK(int)  rtDbgModContainer_DestroyTreeNode(PAVLRUINTPTRNODECORE pNode, void *pvUser)
     
    643655    pThis->Names = NULL;
    644656
     657    RTAvlU32Destroy(&pThis->LineOrdinalTree, rtDbgModContainer_DestroyTreeLineNode, NULL);
     658
    645659    RTMemFree(pThis->paSegs);
    646660    pThis->paSegs = NULL;
     
    662676
    663677/** Virtual function table for the debug info container. */
    664 static RTDBGMODVTDBG const g_rtDbgModVtDbgContainer =
     678DECL_HIDDEN_CONST(RTDBGMODVTDBG) const g_rtDbgModVtDbgContainer =
    665679{
    666680    /*.u32Magic = */            RTDBGMODVTDBG_MAGIC,
     
    691705};
    692706
     707
     708
     709/**
     710 * Special container operation for removing all symbols.
     711 *
     712 * @returns IPRT status code.
     713 * @param   pMod        The module instance.
     714 */
     715DECLHIDDEN(int) rtDbgModContainer_SymbolRemoveAll(PRTDBGMODINT pMod)
     716{
     717    PRTDBGMODCTN pThis = (PRTDBGMODCTN)pMod->pvDbgPriv;
     718
     719    for (uint32_t iSeg = 0; iSeg < pThis->cSegs; iSeg++)
     720    {
     721        RTAvlrUIntPtrDestroy(&pThis->paSegs[iSeg].SymAddrTree, rtDbgModContainer_DestroyTreeNode, NULL);
     722        Assert(pThis->paSegs[iSeg].SymAddrTree == NULL);
     723    }
     724
     725    RTAvlrUIntPtrDestroy(&pThis->AbsAddrTree, rtDbgModContainer_DestroyTreeNode, NULL);
     726    Assert(pThis->AbsAddrTree == NULL);
     727
     728    pThis->Names = NULL;
     729    pThis->iNextSymbolOrdinal = 0;
     730
     731    return VINF_SUCCESS;
     732}
     733
     734
     735/**
     736 * Special container operation for removing all line numbers.
     737 *
     738 * @returns IPRT status code.
     739 * @param   pMod        The module instance.
     740 */
     741DECLHIDDEN(int) rtDbgModContainer_LineRemoveAll(PRTDBGMODINT pMod)
     742{
     743    PRTDBGMODCTN pThis = (PRTDBGMODCTN)pMod->pvDbgPriv;
     744
     745    for (uint32_t iSeg = 0; iSeg < pThis->cSegs; iSeg++)
     746        pThis->paSegs[iSeg].LineAddrTree = NULL;
     747
     748    RTAvlU32Destroy(&pThis->LineOrdinalTree, rtDbgModContainer_DestroyTreeLineNode, NULL);
     749    Assert(pThis->LineOrdinalTree == NULL);
     750
     751    pThis->iNextLineOrdinal = 0;
     752
     753    return VINF_SUCCESS;
     754}
     755
     756
     757/**
     758 * Special container operation for removing everything.
     759 *
     760 * @returns IPRT status code.
     761 * @param   pMod        The module instance.
     762 */
     763DECLHIDDEN(int) rtDbgModContainer_RemoveAll(PRTDBGMODINT pMod)
     764{
     765    PRTDBGMODCTN pThis = (PRTDBGMODCTN)pMod->pvDbgPriv;
     766
     767    rtDbgModContainer_LineRemoveAll(pMod);
     768    rtDbgModContainer_SymbolRemoveAll(pMod);
     769
     770    for (uint32_t iSeg = 0; iSeg < pThis->cSegs; iSeg++)
     771    {
     772        RTStrCacheRelease(g_hDbgModStrCache, pThis->paSegs[iSeg].pszName);
     773        pThis->paSegs[iSeg].pszName = NULL;
     774    }
     775
     776    pThis->cSegs = 0;
     777    pThis->cb = 0;
     778
     779    return VINF_SUCCESS;
     780}
    693781
    694782
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