Changeset 20356 in vbox for trunk/src/VBox/Runtime/common/dbg
- Timestamp:
- Jun 7, 2009 1:22:52 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 48279
- Location:
- trunk/src/VBox/Runtime/common/dbg
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp
r20355 r20356 172 172 if (pDbgMod->pszName) 173 173 { 174 pDbgMod->pDbgVt = &g_rtDbgModVtDbgContainer; 175 rc = pDbgMod->pDbgVt->pfnTryOpen(pDbgMod); 174 rc = rtDbgModContainerCreate(pDbgMod, cb); 176 175 if (RT_SUCCESS(rc)) 177 176 { … … 210 209 */ 211 210 RTCritSectEnter(&pDbgMod->CritSect); /* paranoia */ 211 212 212 if (pDbgMod->pDbgVt) 213 { 213 214 pDbgMod->pDbgVt->pfnClose(pDbgMod); 215 pDbgMod->pDbgVt = NULL; 216 pDbgMod->pvDbgPriv = NULL; 217 } 218 214 219 if (pDbgMod->pImgVt) 220 { 215 221 pDbgMod->pImgVt->pfnClose(pDbgMod); 222 pDbgMod->pImgVt = NULL; 223 pDbgMod->pvImgPriv = NULL; 224 } 216 225 217 226 /* -
trunk/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
r20355 r20356 7 7 #include <iprt/avl.h> 8 8 #include <iprt/err.h> 9 #include <iprt/mem.h> 9 10 #include <iprt/string.h> 10 11 #include "internal/dbgmod.h" 11 12 12 13 14 /******************************************************************************* 15 * Structures and Typedefs * 16 *******************************************************************************/ 17 /** 18 * Symbol entry. 19 */ 20 typedef struct RTDBGMODCONTAINERSYMBOL 21 { 22 /** The address core. */ 23 AVLRUINTPTRNODECORE AddrCore; 24 /** The name space core. */ 25 RTSTRSPACECORE NameCore; 26 /** The name. */ 27 char *pszName; 28 /** The segent offset. */ 29 RTUINTPTR off; 30 /** The segment index. */ 31 RTDBGSEGIDX iSeg; 32 } RTDBGMODCONTAINERSYMBOL; 33 /** Pointer to a symbol entry in the debug info container. */ 34 typedef RTDBGMODCONTAINERSYMBOL *PRTDBGMODCONTAINERSYMBOL; 13 35 14 /** @copydoc RTDBGMODVTDBG::pfnTryOpen */ 15 static DECLCALLBACK(int) rtDbgModContainer_TryOpen(PRTDBGMODINT pMod) 36 /** 37 * Segment entry. 38 */ 39 typedef struct RTDBGMODCONTAINERSEGMENT 40 { 41 /** The segment offset. */ 42 RTUINTPTR off; 43 /** The segment size. */ 44 RTUINTPTR cb; 45 /** The segment name. */ 46 const char *pszName; 47 } RTDBGMODCONTAINERSEGMENT; 48 /** Pointer to a segment entry in the debug info container. */ 49 typedef RTDBGMODCONTAINERSEGMENT *PRTDBGMODCONTAINERSEGMENT; 50 51 /** 52 * Instance data. 53 */ 54 typedef struct RTDBGMODCONTAINER 55 { 56 /** The name space. */ 57 RTSTRSPACE Names; 58 /** The address space tree. */ 59 AVLRUINTPTRTREE AddrTree; 60 /** Segment table. */ 61 PRTDBGMODCONTAINERSEGMENT paSegs; 62 /** The number of segments in the segment table. */ 63 RTDBGSEGIDX cSegs; 64 /** The image size. 0 means unlimited. */ 65 RTUINTPTR cb; 66 } RTDBGMODCONTAINER; 67 /** Pointer to instance data for the debug info container. */ 68 typedef RTDBGMODCONTAINER *PRTDBGMODCONTAINER; 69 70 71 72 /** @copydoc RTDBGMODVTDBG::pfnLineByAddr */ 73 static DECLCALLBACK(int) rtDbgModContainer_LineByAddr(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGLINE pLine) 16 74 { 17 75 return VINF_SUCCESS; … … 19 77 20 78 21 /** @copydoc RTDBGMODVTDBG::pfnClose */ 22 static DECLCALLBACK(int) rtDbgModContainer_Close(PRTDBGMODINT pMod) 79 /** @copydoc RTDBGMODVTDBG::pfnSymbolByAddr */ 80 static DECLCALLBACK(int) rtDbgModContainer_SymbolByAddr(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol) 81 { 82 return VINF_SUCCESS; 83 } 84 85 86 /** @copydoc RTDBGMODVTDBG::pfnSymbolByName */ 87 static DECLCALLBACK(int) rtDbgModContainer_SymbolByName(PRTDBGMODINT pMod, const char *pszSymbol, PRTDBGSYMBOL pSymbol) 23 88 { 24 89 return VINF_SUCCESS; … … 33 98 34 99 35 /** @copydoc RTDBGMODVTDBG::pfnSymbolByName*/36 static DECLCALLBACK(int) rtDbgModContainer_SymbolByName(PRTDBGMODINT pMod, const char *pszSymbol, PRTDBGSYMBOL pSymbol)100 /** Destroy a symbol node. */ 101 static DECLCALLBACK(int) rtDbgModContainer_DestroyTreeNode(PAVLRUINTPTRNODECORE pNode, void *pvUser) 37 102 { 103 PRTDBGMODCONTAINERSYMBOL pSym = RT_FROM_MEMBER(pNode, RTDBGMODCONTAINERSYMBOL, AddrCore); 104 RTStrFree(pSym->pszName); 105 RTMemFree(pSym); 106 return 0; 107 } 108 109 110 /** @copydoc RTDBGMODVTDBG::pfnClose */ 111 static DECLCALLBACK(int) rtDbgModContainer_Close(PRTDBGMODINT pMod) 112 { 113 PRTDBGMODCONTAINER pThis = (PRTDBGMODCONTAINER)pMod->pvDbgPriv; 114 115 /* 116 * Destroy the symbols and instance data. 117 */ 118 RTAvlrUIntPtrDestroy(&pThis->AddrTree, rtDbgModContainer_DestroyTreeNode, NULL); 119 pThis->Names = NULL; 120 RTMemFree(pThis->paSegs); 121 pThis->paSegs = NULL; 122 RTMemFree(pThis); 123 38 124 return VINF_SUCCESS; 39 125 } 40 126 41 127 42 /** @copydoc RTDBGMODVTDBG::pfn SymbolByAddr*/43 static DECLCALLBACK(int) rtDbgModContainer_ SymbolByAddr(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol)128 /** @copydoc RTDBGMODVTDBG::pfnTryOpen */ 129 static DECLCALLBACK(int) rtDbgModContainer_TryOpen(PRTDBGMODINT pMod) 44 130 { 45 return V INF_SUCCESS;131 return VERR_INTERNAL_ERROR_5; 46 132 } 47 133 48 134 49 /** @copydoc RTDBGMODVTDBG::pfnLineByAddr */50 static DECLCALLBACK(int) rtDbgModContainer_LineByAddr(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGLINE pLine)51 {52 return VINF_SUCCESS;53 }54 55 135 56 136 /** Virtual function table for the debug info container. */ 57 RTDBGMODVTDBG const g_rtDbgModVtDbgContainer =137 static RTDBGMODVTDBG const g_rtDbgModVtDbgContainer = 58 138 { 59 139 /*.u32Magic = */ RTDBGMODVTDBG_MAGIC, 60 140 /*.fSupports = */ 0, ///@todo iprt/types.h isn't up to date... 61 /*.pszName = */ " CONTAINER",141 /*.pszName = */ "container", 62 142 /*.pfnTryOpen = */ rtDbgModContainer_TryOpen, 63 143 /*.pfnClose = */ rtDbgModContainer_Close, … … 69 149 }; 70 150 151 152 153 /** 154 * Creates a 155 * 156 * @returns IPRT status code. 157 * @param pMod The module instance. 158 * @param cb The module size. 159 */ 160 int rtDbgModContainerCreate(PRTDBGMODINT pMod, RTUINTPTR cb) 161 { 162 PRTDBGMODCONTAINER pThis = (PRTDBGMODCONTAINER)RTMemAlloc(sizeof(*pThis)); 163 if (!pThis) 164 return VERR_NO_MEMORY; 165 166 pThis->Names = NULL; 167 pThis->AddrTree = NULL; 168 pThis->paSegs = NULL; 169 pThis->cSegs = 0; 170 pThis->cb = cb; 171 172 pMod->pDbgVt = &g_rtDbgModVtDbgContainer; 173 pMod->pvDbgPriv = pThis; 174 return VINF_SUCCESS; 175 } 176
Note:
See TracChangeset
for help on using the changeset viewer.