Changeset 20739 in vbox for trunk/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
- Timestamp:
- Jun 20, 2009 9:43:01 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 48855
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
r20360 r20739 9 9 #include <iprt/mem.h> 10 10 #include <iprt/string.h> 11 #include <iprt/strcache.h> 11 12 #include "internal/dbgmod.h" 12 13 … … 24 25 /** The name space core. */ 25 26 RTSTRSPACECORE NameCore; 26 /** The name. */27 char *pszName;28 27 /** The segent offset. */ 29 28 RTUINTPTR off; … … 57 56 RTSTRSPACE Names; 58 57 /** The address space tree. */ 59 AVLRUINTPTRTREE Addr Tree;58 AVLRUINTPTRTREE Addresses; 60 59 /** Segment table. */ 61 60 PRTDBGMODCONTAINERSEGMENT paSegs; … … 71 70 72 71 /** @copydoc RTDBGMODVTDBG::pfnLineByAddr */ 73 static DECLCALLBACK(int) rtDbgModContainer_LineByAddr(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGLINE pLine) 74 { 75 return VINF_SUCCESS; 72 static DECLCALLBACK(int) rtDbgModContainer_LineByAddr(PRTDBGMODINT pMod, RTDBGSEGIDX iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGLINE pLine) 73 { 74 /** @todo Make it possible to add line numbers. */ 75 return VERR_DBG_NO_LINE_NUMBERS; 76 76 } 77 77 78 78 79 79 /** @copydoc RTDBGMODVTDBG::pfnSymbolByAddr */ 80 static DECLCALLBACK(int) rtDbgModContainer_SymbolByAddr(PRTDBGMODINT pMod, uint32_tiSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol)80 static DECLCALLBACK(int) rtDbgModContainer_SymbolByAddr(PRTDBGMODINT pMod, RTDBGSEGIDX iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol) 81 81 { 82 82 return VINF_SUCCESS; … … 92 92 93 93 /** @copydoc RTDBGMODVTDBG::pfnSymbolAdd */ 94 static DECLCALLBACK(int) rtDbgModContainer_SymbolAdd(PRTDBGMODINT pMod, const char *pszSymbol, uint32_t iSeg, RTGCUINTPTR off, RTUINT cbSymbol) 95 { 96 return VINF_SUCCESS; 94 static DECLCALLBACK(int) rtDbgModContainer_SymbolAdd(PRTDBGMODINT pMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTGCUINTPTR off, uint32_t cbSymbol) 95 { 96 PRTDBGMODCONTAINER pThis = (PRTDBGMODCONTAINER)pMod->pvDbgPriv; 97 98 /* 99 * Address validation. The other arguments have already been validated. 100 */ 101 AssertMsgReturn( ( iSeg >= RTDBGSEGIDX_SPECIAL_FIRST 102 && iSeg <= RTDBGSEGIDX_SPECIAL_LAST) 103 || iSeg < pThis->cSegs, 104 ("iSeg=%x cSegs=%x\n", pThis->cSegs), 105 VERR_DBG_INVALID_SEGMENT_INDEX); 106 AssertMsgReturn( iSeg >= RTDBGSEGIDX_SPECIAL_FIRST 107 || pThis->paSegs[iSeg].cb <= off + cbSymbol, 108 ("off=%RTptr cbSymbol=%RTptr cbSeg=%RTptr\n", off, cbSymbol, pThis->paSegs[iSeg].cb), 109 VERR_DBG_INVALID_SEGMENT_OFFSET); 110 111 /* 112 * Create a new entry. 113 */ 114 PRTDBGMODCONTAINERSYMBOL pSymbol = (PRTDBGMODCONTAINERSYMBOL)RTMemAllocZ(sizeof(*pSymbol)); 115 if (!pSymbol) 116 return VERR_NO_MEMORY; 117 118 #if 0 /* continue on the workstation */ 119 pSymbol->AddrCore.Key = iSeg < RTDBGSEGIDX_SPECIAL_FIRST 120 ? pThis->paSegs->off + off 121 : off; 122 pSymbol->AddrCore.KeyLast = pSymbol->AddrCore.Key + cbSymbol; 123 pSymbol->off = off; 124 pSymbol->iSeg = iSeg; 125 pSymbol->NameCore.pszString = RTStrCacheEnter(g_hDbgModStrCache, pszSymbol); 126 if (pSymbol->NameCore.pszString) 127 { 128 if (RTStrSpaceInsert(&pThis->Names, &pSymbol->NameCore)) 129 { 130 if (RTStrSpaceInsert(&pThis->Names, &pSymbol->NameCore)) 131 { 132 133 } 134 } 135 } 136 #endif 137 int rc = VERR_NOT_IMPLEMENTED; 138 139 return rc; 97 140 } 98 141 … … 102 145 { 103 146 PRTDBGMODCONTAINERSYMBOL pSym = RT_FROM_MEMBER(pNode, RTDBGMODCONTAINERSYMBOL, AddrCore); 104 RTStr Free(pSym->pszName);147 RTStrCacheRelease(g_hDbgModStrCache, pSym->NameCore.pszString); 105 148 RTMemFree(pSym); 106 149 return 0; … … 116 159 * Destroy the symbols and instance data. 117 160 */ 118 RTAvlrUIntPtrDestroy(&pThis->Addr Tree, rtDbgModContainer_DestroyTreeNode, NULL);161 RTAvlrUIntPtrDestroy(&pThis->Addresses, rtDbgModContainer_DestroyTreeNode, NULL); 119 162 pThis->Names = NULL; 120 163 RTMemFree(pThis->paSegs); … … 165 208 166 209 pThis->Names = NULL; 167 pThis->Addr Tree= NULL;210 pThis->Addresses = NULL; 168 211 pThis->paSegs = NULL; 169 212 pThis->cSegs = 0;
Note:
See TracChangeset
for help on using the changeset viewer.