VirtualBox

source: vbox/trunk/src/VBox/Runtime/include/internal/dbgmod.h@ 20513

最後變更 在這個檔案從20513是 20513,由 vboxsync 提交於 16 年 前

OSE header fixes

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 9.7 KB
 
1/* $Id: dbgmod.h 20513 2009-06-12 13:03:42Z vboxsync $ */
2/** @file
3 * IPRT - Internal Header for RTDbgMod and the associated interpreters.
4 */
5
6/*
7 * Copyright (C) 2008-2009 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 *
26 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31#ifndef ___internal_dbgmod_h
32#define ___internal_dbgmod_h
33
34#include <iprt/types.h>
35#include <iprt/critsect.h>
36#include "internal/magics.h"
37
38RT_C_DECLS_BEGIN
39
40/** @defgroup grp_rt_dbgmod RTDbgMod - Debug Module Interperter
41 * @ingroup grp_rt
42 * @internal
43 * @{
44 */
45
46
47/** Pointer to the internal module structure. */
48typedef struct RTDBGMODINT *PRTDBGMODINT;
49
50/**
51 * Virtual method table for executable image interpreters.
52 */
53typedef struct RTDBGMODVTIMG
54{
55 /** Magic number (RTDBGMODVTIMG_MAGIC). */
56 uint32_t u32Magic;
57 /** Mask of supported executable image types, see grp_rt_exe_img_type.
58 * Used to speed up the search for a suitable interpreter. */
59 uint32_t fSupports;
60 /** The name of the interpreter. */
61 const char *pszName;
62
63 /**
64 * Try open the image.
65 *
66 * This combines probing and opening.
67 *
68 * @returns VBox status code. No informational returns defined.
69 *
70 * @param pMod Pointer to the module that is being opened.
71 *
72 * The RTDBGMOD::pszDbgFile member will point to
73 * the filename of any debug info we're aware of
74 * on input. Also, or alternatively, it is expected
75 * that the interpreter will look for debug info in
76 * the executable image file when present and that it
77 * may ask the image interpreter for this when it's
78 * around.
79 *
80 * Upon successful return the method is expected to
81 * initialize pDbgOps and pvDbgPriv.
82 */
83 DECLCALLBACKMEMBER(int, pfnTryOpen)(PRTDBGMODINT pMod);
84
85 /**
86 * Close the interpreter, freeing all associated resources.
87 *
88 * The caller sets the pDbgOps and pvDbgPriv RTDBGMOD members
89 * to NULL upon return.
90 *
91 * @param pMod Pointer to the module structure.
92 */
93 DECLCALLBACKMEMBER(int, pfnClose)(PRTDBGMODINT pMod);
94
95} RTDBGMODVTIMG;
96/** Pointer to a const RTDBGMODVTIMG. */
97typedef RTDBGMODVTIMG const *PCRTDBGMODVTIMG;
98
99
100/**
101 * Virtual method table for debug info interpreters.
102 */
103typedef struct RTDBGMODVTDBG
104{
105 /** Magic number (RTDBGMODVTDBG_MAGIC). */
106 uint32_t u32Magic;
107 /** Mask of supported debug info types, see grp_rt_dbg_type.
108 * Used to speed up the search for a suitable interpreter. */
109 uint32_t fSupports;
110 /** The name of the interpreter. */
111 const char *pszName;
112
113 /**
114 * Try open the image.
115 *
116 * This combines probing and opening.
117 *
118 * @returns VBox status code. No informational returns defined.
119 *
120 * @param pMod Pointer to the module that is being opened.
121 *
122 * The RTDBGMOD::pszDbgFile member will point to
123 * the filename of any debug info we're aware of
124 * on input. Also, or alternatively, it is expected
125 * that the interpreter will look for debug info in
126 * the executable image file when present and that it
127 * may ask the image interpreter for this when it's
128 * around.
129 *
130 * Upon successful return the method is expected to
131 * initialize pDbgOps and pvDbgPriv.
132 */
133 DECLCALLBACKMEMBER(int, pfnTryOpen)(PRTDBGMODINT pMod);
134
135 /**
136 * Close the interpreter, freeing all associated resources.
137 *
138 * The caller sets the pDbgOps and pvDbgPriv RTDBGMOD members
139 * to NULL upon return.
140 *
141 * @param pMod Pointer to the module structure.
142 */
143 DECLCALLBACKMEMBER(int, pfnClose)(PRTDBGMODINT pMod);
144
145 /**
146 * Adds a symbol to the module (optional).
147 *
148 * This method is used to implement DBGFR3SymbolAdd.
149 *
150 * @returns VBox status code.
151 * @retval VERR_NOT_SUPPORTED if the interpreter doesn't support this feature.
152 *
153 * @param pMod Pointer to the module structure.
154 * @param pszSymbol The symbol name.
155 * @param iSeg The segment number (0-based). RTDBGMOD_SEG_RVA can be used.
156 * @param off The offset into the segment.
157 * @param cbSymbol The area covered by the symbol. 0 is fine.
158 */
159 DECLCALLBACKMEMBER(int, pfnSymbolAdd)(PRTDBGMODINT pMod, const char *pszSymbol, uint32_t iSeg, RTGCUINTPTR off, RTUINT cbSymbol);
160
161 /**
162 * Queries symbol information by symbol name.
163 *
164 * @returns VBox status code.
165 * @retval VINF_SUCCESS on success, no informational status code.
166 * @retval VERR_RTDBGMOD_NO_SYMBOLS if there aren't any symbols.
167 * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
168 *
169 * @param pMod Pointer to the module structure.
170 * @param pszSymbol The symbol name.
171 * @para pSymbol Where to store the symbol information.
172 */
173 DECLCALLBACKMEMBER(int, pfnSymbolByName)(PRTDBGMODINT pMod, const char *pszSymbol, PRTDBGSYMBOL pSymbol);
174
175 /**
176 * Queries symbol information by address.
177 *
178 * The returned symbol is what the debug info interpreter consideres the symbol
179 * most applicable to the specified address. This usually means a symbol with an
180 * address equal or lower than the requested.
181 *
182 * @returns VBox status code.
183 * @retval VINF_SUCCESS on success, no informational status code.
184 * @retval VERR_RTDBGMOD_NO_SYMBOLS if there aren't any symbols.
185 * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
186 *
187 * @param pMod Pointer to the module structure.
188 * @param iSeg The segment number (0-based). RTDBGMOD_SEG_RVA can be used.
189 * @param off The offset into the segment.
190 * @param poffDisp Where to store the distance between the specified address
191 * and the returned symbol. Optional.
192 * @param pSymbol Where to store the symbol information.
193 */
194 DECLCALLBACKMEMBER(int, pfnSymbolByAddr)(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol);
195
196 /**
197 * Queries line number information by address.
198 *
199 * @returns VBox status code.
200 * @retval VINF_SUCCESS on success, no informational status code.
201 * @retval VERR_RTDBGMOD_NO_LINE_NUMBERS if there aren't any line numbers.
202 * @retval VERR_RTDBGMOD_LINE_NOT_FOUND if no suitable line number was found.
203 *
204 * @param pMod Pointer to the module structure.
205 * @param iSeg The segment number (0-based). RTDBGMOD_SEG_RVA can be used.
206 * @param off The offset into the segment.
207 * @param poffDisp Where to store the distance between the specified address
208 * and the returned line number. Optional.
209 * @param pLine Where to store the information about the closest line number.
210 */
211 DECLCALLBACKMEMBER(int, pfnLineByAddr)(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGLINE pLine);
212
213 /** For catching initialization errors (RTDBGMODVTDBG_MAGIC). */
214 uint32_t u32EndMagic;
215} RTDBGMODVTDBG;
216/** Pointer to a const RTDBGMODVTDBG. */
217typedef RTDBGMODVTDBG const *PCRTDBGMODVTDBG;
218
219
220/**
221 * Debug module structure.
222 */
223typedef struct RTDBGMODINT
224{
225 /** Magic value (RTDBGMOD_MAGIC). */
226 uint32_t u32Magic;
227 /** The number of reference there are to this module.
228 * This is used to perform automatic cleanup and sharing. */
229 uint32_t volatile cRefs;
230 /** The module name (short). */
231 char *pszName;
232 /** The module filename. Can be NULL. */
233 char *pszImgFile;
234 /** The debug info file (if external). Can be NULL. */
235 char *pszDbgFile;
236
237 /** Critical section serializing access to the module. */
238 RTCRITSECT CritSect;
239
240 /** The method table for the executable image interpreter. */
241 PCRTDBGMODVTIMG pImgVt;
242 /** Pointer to the private data of the executable image interpreter. */
243 void *pvImgPriv;
244
245 /** The method table for the debug info interpreter. */
246 PCRTDBGMODVTDBG pDbgVt;
247 /** Pointer to the private data of the debug info interpreter. */
248 void *pvDbgPriv;
249
250} RTDBGMODINT;
251/** Pointer to an debug module structure. */
252typedef RTDBGMODINT *PRTDBGMODINT;
253
254
255int rtDbgModContainerCreate(PRTDBGMODINT pMod, RTUINTPTR cb);
256
257/** @} */
258
259RT_C_DECLS_END
260
261#endif
262
263
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette