VirtualBox

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

Last change on this file since 19559 was 19559, checked in by vboxsync, 16 years ago

IPRT: Coded up the debug address space, adding a RTUINTPTR AVL range tree in the process. Stubbed the debug module interpreter.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.9 KB
Line 
1/* $Id: dbgmod.h 19559 2009-05-10 04:36:23Z 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.virtualbox.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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ___internal_dbgmod_h
23#define ___internal_dbgmod_h
24
25#include <iprt/types.h>
26#include "internal/magics.h"
27
28__BEGIN_DECLS
29
30/** @defgroup grp_rt_dbgmod RTDbgMod - Debug Module Interperter
31 * @ingroup grp_rt
32 * @internal
33 * @{
34 */
35
36
37/** Pointer to the internal module structure. */
38typedef struct RTDBGMODINT *PRTDBGMODINT;
39
40/**
41 * Virtual method table for executable image interpreters.
42 */
43typedef struct RTDBGMODVTIMG
44{
45 /** Magic number (RTDBGMODVTIMG_MAGIC). */
46 uint32_t u32Magic;
47 /** Mask of supported executable image types, see grp_rt_exe_img_type.
48 * Used to speed up the search for a suitable interpreter. */
49 uint32_t fSupports;
50 /** The name of the interpreter. */
51 const char *pszName;
52
53 /**
54 * Try open the image.
55 *
56 * This combines probing and opening.
57 *
58 * @returns VBox status code. No informational returns defined.
59 *
60 * @param pMod Pointer to the module that is being opened.
61 *
62 * The RTDBGMOD::pszDbgFile member will point to
63 * the filename of any debug info we're aware of
64 * on input. Also, or alternatively, it is expected
65 * that the interpreter will look for debug info in
66 * the executable image file when present and that it
67 * may ask the image interpreter for this when it's
68 * around.
69 *
70 * Upon successful return the method is expected to
71 * initialize pDbgOps and pvDbgPriv.
72 */
73 DECLCALLBACKMEMBER(int, pfnTryOpen)(PRTDBGMODINT pMod);
74
75 /**
76 * Close the interpreter, freeing all associated resources.
77 *
78 * The caller sets the pDbgOps and pvDbgPriv RTDBGMOD members
79 * to NULL upon return.
80 *
81 * @param pMod Pointer to the module structure.
82 */
83 DECLCALLBACKMEMBER(int, pfnClose)(PRTDBGMODINT pMod);
84
85} RTDBGMODVTIMG;
86/** Pointer to a const RTDBGMODVTIMG. */
87typedef RTDBGMODVTIMG const *PCRTDBGMODVTIMG;
88
89
90/**
91 * Virtual method table for debug info interpreters.
92 */
93typedef struct RTDBGMODVTDBG
94{
95 /** Magic number (RTDBGMODVTDBG_MAGIC). */
96 uint32_t u32Magic;
97 /** Mask of supported debug info types, see grp_rt_dbg_type.
98 * Used to speed up the search for a suitable interpreter. */
99 uint32_t fSupports;
100 /** The name of the interpreter. */
101 const char *pszName;
102
103 /**
104 * Try open the image.
105 *
106 * This combines probing and opening.
107 *
108 * @returns VBox status code. No informational returns defined.
109 *
110 * @param pMod Pointer to the module that is being opened.
111 *
112 * The RTDBGMOD::pszDbgFile member will point to
113 * the filename of any debug info we're aware of
114 * on input. Also, or alternatively, it is expected
115 * that the interpreter will look for debug info in
116 * the executable image file when present and that it
117 * may ask the image interpreter for this when it's
118 * around.
119 *
120 * Upon successful return the method is expected to
121 * initialize pDbgOps and pvDbgPriv.
122 */
123 DECLCALLBACKMEMBER(int, pfnTryOpen)(PRTDBGMODINT pMod);
124
125 /**
126 * Close the interpreter, freeing all associated resources.
127 *
128 * The caller sets the pDbgOps and pvDbgPriv RTDBGMOD members
129 * to NULL upon return.
130 *
131 * @param pMod Pointer to the module structure.
132 */
133 DECLCALLBACKMEMBER(int, pfnClose)(PRTDBGMODINT pMod);
134
135 /**
136 * Queries symbol information by symbol name.
137 *
138 * @returns VBox status code.
139 * @retval VINF_SUCCESS on success, no informational status code.
140 * @retval VERR_RTDBGMOD_NO_SYMBOLS if there aren't any symbols.
141 * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
142 *
143 * @param pMod Pointer to the module structure.
144 * @param pszSymbol The symbol name.
145 * @para pSymbol Where to store the symbol information.
146 */
147 DECLCALLBACKMEMBER(int, pfnSymbolByName)(PRTDBGMODINT pMod, const char *pszSymbol, PRTDBGSYMBOL pSymbol);
148
149 /**
150 * Queries symbol information by address.
151 *
152 * The returned symbol is what the debug info interpreter consideres the symbol
153 * most applicable to the specified address. This usually means a symbol with an
154 * address equal or lower than the requested.
155 *
156 * @returns VBox status code.
157 * @retval VINF_SUCCESS on success, no informational status code.
158 * @retval VERR_RTDBGMOD_NO_SYMBOLS if there aren't any symbols.
159 * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
160 *
161 * @param pMod Pointer to the module structure.
162 * @param iSeg The segment number (0-based). RTDBGMOD_SEG_RVA can be used.
163 * @param off The offset into the segment.
164 * @param poffDisp Where to store the distance between the specified address
165 * and the returned symbol. Optional.
166 * @param pSymbol Where to store the symbol information.
167 */
168 DECLCALLBACKMEMBER(int, pfnSymbolByAddr)(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol);
169
170 /**
171 * Queries line number information by address.
172 *
173 * @returns VBox status code.
174 * @retval VINF_SUCCESS on success, no informational status code.
175 * @retval VERR_RTDBGMOD_NO_LINE_NUMBERS if there aren't any line numbers.
176 * @retval VERR_RTDBGMOD_LINE_NOT_FOUND if no suitable line number was found.
177 *
178 * @param pMod Pointer to the module structure.
179 * @param iSeg The segment number (0-based). RTDBGMOD_SEG_RVA can be used.
180 * @param off The offset into the segment.
181 * @param poffDisp Where to store the distance between the specified address
182 * and the returned line number. Optional.
183 * @param pLine Where to store the information about the closest line number.
184 */
185 DECLCALLBACKMEMBER(int, pfnLineByAddr)(PRTDBGMODINT pMod, uint32_t iSeg, RTGCUINTPTR off, PRTGCINTPTR poffDisp, PRTDBGLINE pLine);
186
187 /**
188 * Adds a symbol to the module (optional).
189 *
190 * This method is used to implement DBGFR3SymbolAdd.
191 *
192 * @returns VBox status code.
193 * @retval VERR_NOT_SUPPORTED if the interpreter doesn't support this feature.
194 *
195 * @param pMod Pointer to the module structure.
196 * @param pszSymbol The symbol name.
197 * @param iSeg The segment number (0-based). RTDBGMOD_SEG_RVA can be used.
198 * @param off The offset into the segment.
199 * @param cbSymbol The area covered by the symbol. 0 is fine.
200 */
201 DECLCALLBACKMEMBER(int, pfnSymbolAdd)(PRTDBGMODINT pMod, const char *pszSymbol, uint32_t iSeg, RTGCUINTPTR off, RTUINT cbSymbol);
202
203 /** For catching initialization errors (RTDBGMODVTDBG_MAGIC). */
204 uint32_t u32EndMagic;
205} RTDBGMODVTDBG;
206/** Pointer to a const RTDBGMODVTDBG. */
207typedef RTDBGMODVTDBG const *PCRTDBGMODVTDBG;
208
209
210/**
211 * Debug module structure.
212 */
213typedef struct RTDBGMODINT
214{
215 /** Magic value (RTDBGMOD_MAGIC). */
216 uint32_t u32Magic;
217 /** The number of address spaces this module is currently linked into.
218 * This is used to perform automatic cleanup and sharing. */
219 uint32_t cLinks;
220 /** The module name (short). */
221 const char *pszName;
222 /** The module filename. Can be NULL. */
223 const char *pszImgFile;
224 /** The debug info file (if external). Can be NULL. */
225 const char *pszDbgFile;
226
227 /** The method table for the executable image interpreter. */
228 PCRTDBGMODVTIMG pImgVt;
229 /** Pointer to the private data of the executable image interpreter. */
230 void *pvImgPriv;
231
232 /** The method table for the debug info interpreter. */
233 PCRTDBGMODVTDBG pDbgVt;
234 /** Pointer to the private data of the debug info interpreter. */
235 void *pvDbgPriv;
236
237} RTDBGMODINT;
238
239
240/** @} */
241
242__END_DECLS
243
244#endif
245
246
Note: See TracBrowser for help on using the repository browser.

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