1 | /* $Id: dbg.h 20744 2009-06-21 15:43:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Debugging Routines.
|
---|
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 | * 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 ___iprt_dbg_h
|
---|
32 | #define ___iprt_dbg_h
|
---|
33 |
|
---|
34 | #include <iprt/types.h>
|
---|
35 | #include <iprt/stdarg.h>
|
---|
36 |
|
---|
37 | RT_C_DECLS_BEGIN
|
---|
38 |
|
---|
39 | /** @defgroup grp_rt_dbg RTDbg - Debugging Routines
|
---|
40 | * @ingroup grp_rt
|
---|
41 | * @{
|
---|
42 | */
|
---|
43 |
|
---|
44 |
|
---|
45 | /** Debug segment index. */
|
---|
46 | typedef uint32_t RTDBGSEGIDX;
|
---|
47 | /** Pointer to a debug segment index. */
|
---|
48 | typedef RTDBGSEGIDX *PRTDBGSEGIDX;
|
---|
49 | /** Pointer to a const debug segment index. */
|
---|
50 | typedef RTDBGSEGIDX const *PCRTDBGSEGIDX;
|
---|
51 | /** NIL debug segment index. */
|
---|
52 | #define NIL_RTDBGSEGIDX UINT32_C(0xffffffff)
|
---|
53 | /** The last normal segment index. */
|
---|
54 | #define RTDBGSEGIDX_LAST UINT32_C(0xffffffef)
|
---|
55 | /** Special segment index that indicates that the offset is a relative
|
---|
56 | * virtual address (RVA). I.e. an offset from the start of the module. */
|
---|
57 | #define RTDBGSEGIDX_RVA UINT32_C(0xfffffff0)
|
---|
58 | /** Special segment index that indicates that the offset is a absolute. */
|
---|
59 | #define RTDBGSEGIDX_ABS UINT32_C(0xfffffff1)
|
---|
60 | /** The last valid special segment index. */
|
---|
61 | #define RTDBGSEGIDX_SPECIAL_LAST RTDBGSEGIDX_ABS
|
---|
62 | /** The last valid special segment index. */
|
---|
63 | #define RTDBGSEGIDX_SPECIAL_FIRST (RTDBGSEGIDX_LAST + 1U)
|
---|
64 |
|
---|
65 |
|
---|
66 | /** Max length (including '\\0') of a segment name. */
|
---|
67 | #define RTDBG_SEGMENT_NAME_LENGTH (128 - 8 - 8 - 8 - 4 - 4)
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Debug module segment.
|
---|
71 | */
|
---|
72 | typedef struct RTDBGSEGMENT
|
---|
73 | {
|
---|
74 | /** The load address.
|
---|
75 | * RTUINTPTR_MAX if not applicable. */
|
---|
76 | RTUINTPTR Address;
|
---|
77 | /** The image relative virtual address of the segment.
|
---|
78 | * RTUINTPTR_MAX if not applicable. */
|
---|
79 | RTUINTPTR uRva;
|
---|
80 | /** The segment size. */
|
---|
81 | RTUINTPTR cb;
|
---|
82 | /** The segment flags. (reserved) */
|
---|
83 | uint32_t fFlags;
|
---|
84 | /** The segment index. */
|
---|
85 | RTDBGSEGIDX iSeg;
|
---|
86 | /** Symbol name. */
|
---|
87 | char szName[RTDBG_SEGMENT_NAME_LENGTH];
|
---|
88 | } RTDBGSEGMENT;
|
---|
89 | /** Pointer to a debug module segment. */
|
---|
90 | typedef RTDBGSEGMENT *PRTDBGSEGMENT;
|
---|
91 | /** Pointer to a const debug module segment. */
|
---|
92 | typedef RTDBGSEGMENT const *PCRTDBGSEGMENT;
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | /** Max length (including '\\0') of a symbol name. */
|
---|
97 | #define RTDBG_SYMBOL_NAME_LENGTH (384 - 8 - 8 - 8 - 4 - 4 - 8)
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Debug symbol.
|
---|
101 | */
|
---|
102 | typedef struct RTDBGSYMBOL
|
---|
103 | {
|
---|
104 | /** Symbol value (address).
|
---|
105 | * This depends a bit who you ask. It will be the same as offSeg when you
|
---|
106 | * as RTDbgMod, but the mapping address if you ask RTDbgAs. */
|
---|
107 | RTUINTPTR Value;
|
---|
108 | /** Symbol size. */
|
---|
109 | RTUINTPTR cb;
|
---|
110 | /** Offset into the segment specified by iSeg. */
|
---|
111 | RTUINTPTR offSeg;
|
---|
112 | /** Segment number. */
|
---|
113 | RTDBGSEGIDX iSeg;
|
---|
114 | /** Symbol Flags. (reserved). */
|
---|
115 | uint32_t fFlags;
|
---|
116 | /** Symbol ordinal.
|
---|
117 | * This is set to UINT32_MAX if the ordinals aren't supported. */
|
---|
118 | uint32_t iOrdinal;
|
---|
119 | /** Symbol name. */
|
---|
120 | char szName[RTDBG_SYMBOL_NAME_LENGTH];
|
---|
121 | } RTDBGSYMBOL;
|
---|
122 | /** Pointer to debug symbol. */
|
---|
123 | typedef RTDBGSYMBOL *PRTDBGSYMBOL;
|
---|
124 | /** Pointer to const debug symbol. */
|
---|
125 | typedef const RTDBGSYMBOL *PCRTDBGSYMBOL;
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * Allocate a new symbol structure.
|
---|
129 | *
|
---|
130 | * @returns Pointer to a new structure on success, NULL on failure.
|
---|
131 | */
|
---|
132 | RTDECL(PRTDBGSYMBOL) RTDbgSymbolAlloc(void);
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * Duplicates a symbol structure.
|
---|
136 | *
|
---|
137 | * @returns Pointer to duplicate on success, NULL on failure.
|
---|
138 | *
|
---|
139 | * @param pSymbol The symbol to duplicate.
|
---|
140 | */
|
---|
141 | RTDECL(PRTDBGSYMBOL) RTDbgSymbolDup(PCRTDBGSYMBOL pSymbol);
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * Free a symbol structure previously allocated by a RTDbg method.
|
---|
145 | *
|
---|
146 | * @param pSymbol The symbol to free. NULL is ignored.
|
---|
147 | */
|
---|
148 | RTDECL(void) RTDbgSymbolFree(PRTDBGSYMBOL pSymbol);
|
---|
149 |
|
---|
150 |
|
---|
151 | /** Max length (including '\\0') of a debug info file name. */
|
---|
152 | #define RTDBG_FILE_NAME_LENGTH (260)
|
---|
153 |
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * Debug line number information.
|
---|
157 | */
|
---|
158 | typedef struct RTDBGLINE
|
---|
159 | {
|
---|
160 | /** Address.
|
---|
161 | * This depends a bit who you ask. It will be the same as offSeg when you
|
---|
162 | * as RTDbgMod, but the mapping address if you ask RTDbgAs. */
|
---|
163 | RTUINTPTR Address;
|
---|
164 | /** Offset into the segment specified by iSeg. */
|
---|
165 | RTUINTPTR offSeg;
|
---|
166 | /** Segment number. */
|
---|
167 | RTDBGSEGIDX iSeg;
|
---|
168 | /** Line number. */
|
---|
169 | uint32_t uLineNo;
|
---|
170 | /** Symbol ordinal.
|
---|
171 | * This is set to UINT32_MAX if the ordinals aren't supported. */
|
---|
172 | uint32_t iOrdinal;
|
---|
173 | /** Filename. */
|
---|
174 | char szFilename[RTDBG_FILE_NAME_LENGTH];
|
---|
175 | } RTDBGLINE;
|
---|
176 | /** Pointer to debug line number. */
|
---|
177 | typedef RTDBGLINE *PRTDBGLINE;
|
---|
178 | /** Pointer to const debug line number. */
|
---|
179 | typedef const RTDBGLINE *PCRTDBGLINE;
|
---|
180 |
|
---|
181 | /**
|
---|
182 | * Allocate a new line number structure.
|
---|
183 | *
|
---|
184 | * @returns Pointer to a new structure on success, NULL on failure.
|
---|
185 | */
|
---|
186 | RTDECL(PRTDBGLINE) RTDbgLineAlloc(void);
|
---|
187 |
|
---|
188 | /**
|
---|
189 | * Duplicates a line number structure.
|
---|
190 | *
|
---|
191 | * @returns Pointer to duplicate on success, NULL on failure.
|
---|
192 | *
|
---|
193 | * @param pLine The line number to duplicate.
|
---|
194 | */
|
---|
195 | RTDECL(PRTDBGLINE) RTDbgLineDup(PCRTDBGLINE pLine);
|
---|
196 |
|
---|
197 | /**
|
---|
198 | * Free a line number structure previously allocated by a RTDbg method.
|
---|
199 | *
|
---|
200 | * @param pLine The line number to free. NULL is ignored.
|
---|
201 | */
|
---|
202 | RTDECL(void) RTDbgLineFree(PRTDBGLINE pLine);
|
---|
203 |
|
---|
204 |
|
---|
205 | /** @defgroup grp_rt_dbgas RTDbgAs - Debug Address Space
|
---|
206 | * @{
|
---|
207 | */
|
---|
208 |
|
---|
209 | /**
|
---|
210 | * Creates an empty address space.
|
---|
211 | *
|
---|
212 | * @returns IPRT status code.
|
---|
213 | *
|
---|
214 | * @param phDbgAs Where to store the address space handle on success.
|
---|
215 | * @param FirstAddr The first address in the address space.
|
---|
216 | * @param LastAddr The last address in the address space.
|
---|
217 | * @param pszName The name of the address space.
|
---|
218 | */
|
---|
219 | RTDECL(int) RTDbgAsCreate(PRTDBGAS phDbgAs, RTUINTPTR FirstAddr, RTUINTPTR LastAddr, const char *pszName);
|
---|
220 |
|
---|
221 | /**
|
---|
222 | * Variant of RTDbgAsCreate that takes a name format string.
|
---|
223 | *
|
---|
224 | * @returns IPRT status code.
|
---|
225 | *
|
---|
226 | * @param phDbgAs Where to store the address space handle on success.
|
---|
227 | * @param FirstAddr The first address in the address space.
|
---|
228 | * @param LastAddr The last address in the address space.
|
---|
229 | * @param pszNameFmt The name format of the address space.
|
---|
230 | * @param va Format arguments.
|
---|
231 | */
|
---|
232 | RTDECL(int) RTDbgAsCreateV(PRTDBGAS phDbgAs, RTUINTPTR FirstAddr, RTUINTPTR LastAddr, const char *pszNameFmt, va_list va);
|
---|
233 |
|
---|
234 | /**
|
---|
235 | * Variant of RTDbgAsCreate that takes a name format string.
|
---|
236 | *
|
---|
237 | * @returns IPRT status code.
|
---|
238 | *
|
---|
239 | * @param phDbgAs Where to store the address space handle on success.
|
---|
240 | * @param FirstAddr The first address in the address space.
|
---|
241 | * @param LastAddr The last address in the address space.
|
---|
242 | * @param pszNameFmt The name format of the address space.
|
---|
243 | * @param ... Format arguments.
|
---|
244 | */
|
---|
245 | RTDECL(int) RTDbgAsCreateF(PRTDBGAS phDbgAs, RTUINTPTR FirstAddr, RTUINTPTR LastAddr, const char *pszNameFmt, ...);
|
---|
246 |
|
---|
247 | /**
|
---|
248 | * Retains a reference to the address space.
|
---|
249 | *
|
---|
250 | * @returns New reference count, UINT32_MAX on invalid handle (asserted).
|
---|
251 | *
|
---|
252 | * @param hDbgAs The address space handle.
|
---|
253 | *
|
---|
254 | * @remarks Will not take any locks.
|
---|
255 | */
|
---|
256 | RTDECL(uint32_t) RTDbgAsRetain(RTDBGAS hDbgAs);
|
---|
257 |
|
---|
258 | /**
|
---|
259 | * Release a reference to the address space.
|
---|
260 | *
|
---|
261 | * When the reference count reaches zero, the address space is destroyed.
|
---|
262 | * That means unlinking all the modules it currently contains, potentially
|
---|
263 | * causing some or all of them to be destroyed as they are managed by
|
---|
264 | * reference counting.
|
---|
265 | *
|
---|
266 | * @returns New reference count, UINT32_MAX on invalid handle (asserted).
|
---|
267 | *
|
---|
268 | * @param hDbgAs The address space handle. The NIL handle is quietly
|
---|
269 | * ignored and 0 is returned.
|
---|
270 | *
|
---|
271 | * @remarks Will not take any locks.
|
---|
272 | */
|
---|
273 | RTDECL(uint32_t) RTDbgAsRelease(RTDBGAS hDbgAs);
|
---|
274 |
|
---|
275 | /**
|
---|
276 | * Gets the name of an address space.
|
---|
277 | *
|
---|
278 | * @returns read only address space name.
|
---|
279 | * NULL if hDbgAs is invalid.
|
---|
280 | *
|
---|
281 | * @param hDbgAs The address space handle.
|
---|
282 | *
|
---|
283 | * @remarks Will not take any locks.
|
---|
284 | */
|
---|
285 | RTDECL(const char *) RTDbgAsName(RTDBGAS hDbgAs);
|
---|
286 |
|
---|
287 | /**
|
---|
288 | * Gets the first address in an address space.
|
---|
289 | *
|
---|
290 | * @returns The address.
|
---|
291 | * 0 if hDbgAs is invalid.
|
---|
292 | *
|
---|
293 | * @param hDbgAs The address space handle.
|
---|
294 | *
|
---|
295 | * @remarks Will not take any locks.
|
---|
296 | */
|
---|
297 | RTDECL(RTUINTPTR) RTDbgAsFirstAddr(RTDBGAS hDbgAs);
|
---|
298 |
|
---|
299 | /**
|
---|
300 | * Gets the last address in an address space.
|
---|
301 | *
|
---|
302 | * @returns The address.
|
---|
303 | * 0 if hDbgAs is invalid.
|
---|
304 | *
|
---|
305 | * @param hDbgAs The address space handle.
|
---|
306 | *
|
---|
307 | * @remarks Will not take any locks.
|
---|
308 | */
|
---|
309 | RTDECL(RTUINTPTR) RTDbgAsLastAddr(RTDBGAS hDbgAs);
|
---|
310 |
|
---|
311 | /**
|
---|
312 | * Gets the number of modules in the address space.
|
---|
313 | *
|
---|
314 | * This can be used together with RTDbgAsModuleByIndex
|
---|
315 | * to enumerate the modules.
|
---|
316 | *
|
---|
317 | * @returns The number of modules.
|
---|
318 | *
|
---|
319 | * @param hDbgAs The address space handle.
|
---|
320 | *
|
---|
321 | * @remarks Will not take any locks.
|
---|
322 | */
|
---|
323 | RTDECL(uint32_t) RTDbgAsModuleCount(RTDBGAS hDbgAs);
|
---|
324 |
|
---|
325 | /** @name Flags for RTDbgAsModuleLink and RTDbgAsModuleLinkSeg
|
---|
326 | * @{ */
|
---|
327 | /** Replace all conflicting module.
|
---|
328 | * (The conflicting modules will be removed the address space and their
|
---|
329 | * references released.) */
|
---|
330 | #define RTDBGASLINK_FLAGS_REPLACE RT_BIT_32(0)
|
---|
331 | /** Mask containing the valid flags. */
|
---|
332 | #define RTDBGASLINK_FLAGS_VALID_MASK UINT32_C(0x00000001)
|
---|
333 | /** @} */
|
---|
334 |
|
---|
335 | /**
|
---|
336 | * Links a module into the address space at the give address.
|
---|
337 | *
|
---|
338 | * The size of the mapping is determined using RTDbgModImageSize().
|
---|
339 | *
|
---|
340 | * @returns IPRT status code.
|
---|
341 | * @retval VERR_OUT_OF_RANGE if the specified address will put the module
|
---|
342 | * outside the address space.
|
---|
343 | * @retval VERR_ADDRESS_CONFLICT if the mapping clashes with existing mappings.
|
---|
344 | *
|
---|
345 | * @param hDbgAs The address space handle.
|
---|
346 | * @param hDbgMod The module handle of the module to be linked in.
|
---|
347 | * @param ImageAddr The address to link the module at.
|
---|
348 | * @param fFlags See RTDBGASLINK_FLAGS_*.
|
---|
349 | */
|
---|
350 | RTDECL(int) RTDbgAsModuleLink(RTDBGAS hDbgAs, RTDBGMOD hDbgMod, RTUINTPTR ImageAddr, uint32_t fFlags);
|
---|
351 |
|
---|
352 | /**
|
---|
353 | * Links a segment into the address space at the give address.
|
---|
354 | *
|
---|
355 | * The size of the mapping is determined using RTDbgModSegmentSize().
|
---|
356 | *
|
---|
357 | * @returns IPRT status code.
|
---|
358 | * @retval VERR_OUT_OF_RANGE if the specified address will put the module
|
---|
359 | * outside the address space.
|
---|
360 | * @retval VERR_ADDRESS_CONFLICT if the mapping clashes with existing mappings.
|
---|
361 | *
|
---|
362 | * @param hDbgAs The address space handle.
|
---|
363 | * @param hDbgMod The module handle.
|
---|
364 | * @param iSeg The segment number (0-based) of the segment to be
|
---|
365 | * linked in.
|
---|
366 | * @param SegAddr The address to link the segment at.
|
---|
367 | * @param fFlags See RTDBGASLINK_FLAGS_*.
|
---|
368 | */
|
---|
369 | RTDECL(int) RTDbgAsModuleLinkSeg(RTDBGAS hDbgAs, RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR SegAddr, uint32_t fFlags);
|
---|
370 |
|
---|
371 | /**
|
---|
372 | * Unlinks all the mappings of a module from the address space.
|
---|
373 | *
|
---|
374 | * @returns IPRT status code.
|
---|
375 | * @retval VERR_NOT_FOUND if the module wasn't found.
|
---|
376 | *
|
---|
377 | * @param hDbgAs The address space handle.
|
---|
378 | * @param hDbgMod The module handle of the module to be unlinked.
|
---|
379 | */
|
---|
380 | RTDECL(int) RTDbgAsModuleUnlink(RTDBGAS hDbgAs, RTDBGMOD hDbgMod);
|
---|
381 |
|
---|
382 | /**
|
---|
383 | * Unlinks the mapping at the specified address.
|
---|
384 | *
|
---|
385 | * @returns IPRT status code.
|
---|
386 | * @retval VERR_NOT_FOUND if no module or segment is mapped at that address.
|
---|
387 | *
|
---|
388 | * @param hDbgAs The address space handle.
|
---|
389 | * @param Addr The address within the mapping to be unlinked.
|
---|
390 | */
|
---|
391 | RTDECL(int) RTDbgAsModuleUnlinkByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr);
|
---|
392 |
|
---|
393 | /**
|
---|
394 | * Get a the handle of a module in the address space by is index.
|
---|
395 | *
|
---|
396 | * @returns A retained handle to the specified module. The caller must release
|
---|
397 | * the returned reference.
|
---|
398 | * NIL_RTDBGMOD if invalid index or handle.
|
---|
399 | *
|
---|
400 | * @param hDbgAs The address space handle.
|
---|
401 | * @param iModule The index of the module to get.
|
---|
402 | *
|
---|
403 | * @remarks The module indexes may change after calls to RTDbgAsModuleLink,
|
---|
404 | * RTDbgAsModuleLinkSeg, RTDbgAsModuleUnlink and
|
---|
405 | * RTDbgAsModuleUnlinkByAddr.
|
---|
406 | */
|
---|
407 | RTDECL(RTDBGMOD) RTDbgAsModuleByIndex(RTDBGAS hDbgAs, uint32_t iModule);
|
---|
408 |
|
---|
409 | /**
|
---|
410 | * Queries mapping module information by handle.
|
---|
411 | *
|
---|
412 | * @returns IPRT status code.
|
---|
413 | * @retval VERR_NOT_FOUND if no mapping was found at the specified address.
|
---|
414 | *
|
---|
415 | * @param hDbgAs The address space handle.
|
---|
416 | * @param Addr Address within the mapping of the module or segment.
|
---|
417 | * @param phMod Where to the return the retained module handle.
|
---|
418 | * Optional.
|
---|
419 | * @param pAddr Where to return the base address of the mapping.
|
---|
420 | * Optional.
|
---|
421 | * @param piSeg Where to return the segment index. This is set to
|
---|
422 | * NIL if the entire module is mapped as a single
|
---|
423 | * mapping. Optional.
|
---|
424 | */
|
---|
425 | RTDECL(int) RTDbgAsModuleByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTDBGMOD phMod, PRTUINTPTR pAddr, PRTDBGSEGIDX piSeg);
|
---|
426 |
|
---|
427 | /**
|
---|
428 | * Queries mapping module information by name.
|
---|
429 | *
|
---|
430 | * @returns IPRT status code.
|
---|
431 | * @retval VERR_NOT_FOUND if no mapping was found at the specified address.
|
---|
432 | * @retval VERR_OUT_OF_RANGE if the name index was out of range.
|
---|
433 | *
|
---|
434 | * @param hDbgAs The address space handle.
|
---|
435 | * @param pszName The module name.
|
---|
436 | * @param iName There can be more than one module by the same name
|
---|
437 | * in an address space. This argument indicates which
|
---|
438 | * is ment. (0 based)
|
---|
439 | * @param phMod Where to the return the retained module handle.
|
---|
440 | */
|
---|
441 | RTDECL(int) RTDbgAsModuleByName(RTDBGAS hDbgAs, const char *pszName, uint32_t iName, PRTDBGMOD phMod);
|
---|
442 |
|
---|
443 | /**
|
---|
444 | * Adds a symbol to a module in the address space.
|
---|
445 | *
|
---|
446 | * @returns IPRT status code. See RTDbgModSymbolAdd for more specific ones.
|
---|
447 | * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
|
---|
448 | * @retval VERR_NOT_FOUND if no module was found at the specified address.
|
---|
449 | * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding
|
---|
450 | * custom symbols.
|
---|
451 | *
|
---|
452 | * @param hDbgAs The address space handle.
|
---|
453 | * @param pszSymbol The symbol name.
|
---|
454 | * @param Addr The address of the symbol.
|
---|
455 | * @param cb The size of the symbol.
|
---|
456 | * @param fFlags Symbol flags.
|
---|
457 | * @param piOrdinal Where to return the symbol ordinal on success. If
|
---|
458 | * the interpreter doesn't do ordinals, this will be set to
|
---|
459 | * UINT32_MAX. Optional
|
---|
460 | */
|
---|
461 | RTDECL(int) RTDbgAsSymbolAdd(RTDBGAS hDbgAs, const char *pszSymbol, RTUINTPTR Addr, RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal);
|
---|
462 |
|
---|
463 | /**
|
---|
464 | * Query a symbol by address.
|
---|
465 | *
|
---|
466 | * @returns IPRT status code. See RTDbgModSymbolAddr for more specific ones.
|
---|
467 | * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
|
---|
468 | * @retval VERR_NOT_FOUND if the address couldn't be mapped to a module.
|
---|
469 | *
|
---|
470 | * @param hDbgAs The address space handle.
|
---|
471 | * @param Addr The address which closest symbol is requested.
|
---|
472 | * @param poffDisp Where to return the distance between the symbol
|
---|
473 | * and address. Optional.
|
---|
474 | * @param pSymbol Where to return the symbol info.
|
---|
475 | */
|
---|
476 | RTDECL(int) RTDbgAsSymbolByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymbol);
|
---|
477 |
|
---|
478 | /**
|
---|
479 | * Query a symbol by address.
|
---|
480 | *
|
---|
481 | * @returns IPRT status code. See RTDbgModSymbolAddrA for more specific ones.
|
---|
482 | * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
|
---|
483 | * @retval VERR_NOT_FOUND if the address couldn't be mapped to a module.
|
---|
484 | *
|
---|
485 | * @param hDbgAs The address space handle.
|
---|
486 | * @param Addr The address which closest symbol is requested.
|
---|
487 | * @param poffDisp Where to return the distance between the symbol
|
---|
488 | * and address. Optional.
|
---|
489 | * @param ppSymbol Where to return the pointer to the allocated
|
---|
490 | * symbol info. Always set. Free with RTDbgSymbolFree.
|
---|
491 | */
|
---|
492 | RTDECL(int) RTDbgAsSymbolByAddrA(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymbol);
|
---|
493 |
|
---|
494 | /**
|
---|
495 | * Query a symbol by name.
|
---|
496 | *
|
---|
497 | * @returns IPRT status code.
|
---|
498 | * @retval VERR_SYMBOL_NOT_FOUND if not found.
|
---|
499 | *
|
---|
500 | * @param hDbgAs The address space handle.
|
---|
501 | * @param pszSymbol The symbol name.
|
---|
502 | * @param pSymbol Where to return the symbol info.
|
---|
503 | */
|
---|
504 | RTDECL(int) RTDbgAsSymbolByName(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol);
|
---|
505 |
|
---|
506 | /**
|
---|
507 | * Query a symbol by name.
|
---|
508 | *
|
---|
509 | * @returns IPRT status code.
|
---|
510 | * @retval VERR_SYMBOL_NOT_FOUND if not found.
|
---|
511 | *
|
---|
512 | * @param hDbgAs The address space handle.
|
---|
513 | * @param pszSymbol The symbol name.
|
---|
514 | * @param ppSymbol Where to return the pointer to the allocated
|
---|
515 | * symbol info. Always set. Free with RTDbgSymbolFree.
|
---|
516 | */
|
---|
517 | RTDECL(int) RTDbgAsSymbolByNameA(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol);
|
---|
518 |
|
---|
519 | /**
|
---|
520 | * Query a line number by address.
|
---|
521 | *
|
---|
522 | * @returns IPRT status code. See RTDbgModSymbolAddrA for more specific ones.
|
---|
523 | * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
|
---|
524 | * @retval VERR_NOT_FOUND if the address couldn't be mapped to a module.
|
---|
525 | *
|
---|
526 | * @param hDbgAs The address space handle.
|
---|
527 | * @param Addr The address which closest symbol is requested.
|
---|
528 | * @param poffDisp Where to return the distance between the line
|
---|
529 | * number and address.
|
---|
530 | * @param pLine Where to return the line number information.
|
---|
531 | */
|
---|
532 | RTDECL(int) RTDbgAs(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGLINE pLine);
|
---|
533 |
|
---|
534 | /**
|
---|
535 | * Adds a line number to a module in the address space.
|
---|
536 | *
|
---|
537 | * @returns IPRT status code. See RTDbgModSymbolAdd for more specific ones.
|
---|
538 | * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
|
---|
539 | * @retval VERR_NOT_FOUND if no module was found at the specified address.
|
---|
540 | * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding
|
---|
541 | * custom symbols.
|
---|
542 | *
|
---|
543 | * @param hDbgAs The address space handle.
|
---|
544 | * @param pszFile The file name.
|
---|
545 | * @param uLineNo The line number.
|
---|
546 | * @param Addr The address of the symbol.
|
---|
547 | * @param piOrdinal Where to return the line number ordinal on success.
|
---|
548 | * If the interpreter doesn't do ordinals, this will be
|
---|
549 | * set to UINT32_MAX. Optional.
|
---|
550 | */
|
---|
551 | RTDECL(int) RTDbgAsLineAdd(RTDBGAS hDbgAs, const char *pszFile, uint32_t uLineNo, RTUINTPTR Addr, uint32_t *piOrdinal);
|
---|
552 |
|
---|
553 | /**
|
---|
554 | * Query a line number by address.
|
---|
555 | *
|
---|
556 | * @returns IPRT status code. See RTDbgModSymbolAddrA for more specific ones.
|
---|
557 | * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
|
---|
558 | * @retval VERR_NOT_FOUND if the address couldn't be mapped to a module.
|
---|
559 | *
|
---|
560 | * @param hDbgAs The address space handle.
|
---|
561 | * @param Addr The address which closest symbol is requested.
|
---|
562 | * @param poffDisp Where to return the distance between the line
|
---|
563 | * number and address.
|
---|
564 | * @param ppLine Where to return the pointer to the allocated line
|
---|
565 | * number info. Always set. Free with RTDbgLineFree.
|
---|
566 | */
|
---|
567 | RTDECL(int) RTDbgAsLineByAddrA(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGLINE *ppLine);
|
---|
568 |
|
---|
569 | /** @todo Missing some bits here. */
|
---|
570 |
|
---|
571 | /** @} */
|
---|
572 |
|
---|
573 |
|
---|
574 | /** @defgroup grp_rt_dbgmod RTDbgMod - Debug Module Interpreter
|
---|
575 | * @{
|
---|
576 | */
|
---|
577 | RTDECL(int) RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, RTUINTPTR cb, uint32_t fFlags);
|
---|
578 | RTDECL(int) RTDbgModCreateDeferred(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTUINTPTR cb, uint32_t fFlags);
|
---|
579 | RTDECL(int) RTDbgModCreateFromImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, uint32_t fFlags);
|
---|
580 | RTDECL(int) RTDbgModCreateFromMap(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTUINTPTR uSubtrahend, uint32_t fFlags);
|
---|
581 | RTDECL(uint32_t) RTDbgModRetain(RTDBGMOD hDbgMod);
|
---|
582 | RTDECL(uint32_t) RTDbgModRelease(RTDBGMOD hDbgMod);
|
---|
583 | RTDECL(const char *) RTDbgModName(RTDBGMOD hDbgMod);
|
---|
584 | RTDECL(RTUINTPTR) RTDbgModImageSize(RTDBGMOD hDbgMod);
|
---|
585 |
|
---|
586 | RTDECL(int) RTDbgModSegmentAdd(RTDBGMOD hDbgMod, RTUINTPTR uRva, RTUINTPTR cb, const char *pszName, size_t cchName, uint32_t fFlags, PRTDBGSEGIDX piSeg);
|
---|
587 | RTDECL(RTDBGSEGIDX) RTDbgModSegmentCount(RTDBGMOD hDbgMod);
|
---|
588 | RTDECL(int) RTDbgModSegmentByIndex(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, PRTDBGSEGMENT pSegInfo);
|
---|
589 | RTDECL(RTUINTPTR) RTDbgModSegmentSize(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
|
---|
590 | RTDECL(RTUINTPTR) RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
|
---|
591 |
|
---|
592 | RTDECL(int) RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off, RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal);
|
---|
593 | RTDECL(uint32_t) RTDbgModSymbolCount(RTDBGMOD hDbgMod);
|
---|
594 | RTDECL(int) RTDbgModSymbolByIndex(RTDBGMOD hDbgMod, uint32_t iSymbol, PRTDBGSYMBOL pSymbol);
|
---|
595 | RTDECL(int) RTDbgModSymbolByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymbol);
|
---|
596 | RTDECL(int) RTDbgModSymbolByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymbol);
|
---|
597 | RTDECL(int) RTDbgModSymbolByName(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL pSymbol);
|
---|
598 | RTDECL(int) RTDbgModSymbolByNameA(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol);
|
---|
599 |
|
---|
600 | RTDECL(int) RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t *piOrdinal);
|
---|
601 | RTDECL(int) RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLine);
|
---|
602 | RTDECL(int) RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLine);
|
---|
603 | /** @} */
|
---|
604 |
|
---|
605 | /** @} */
|
---|
606 |
|
---|
607 | RT_C_DECLS_END
|
---|
608 |
|
---|
609 | #endif
|
---|
610 |
|
---|