VirtualBox

source: kStuff/trunk/include/k/kDbgAll.h@ 18

Last change on this file since 18 was 2, checked in by bird, 18 years ago

Imported http://svn.netlabs.org/repos/libc/trunk/kStuff, revision 3612.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 5.6 KB
Line 
1/* $Id: kDbgAll.h 2 2007-11-16 16:07:14Z bird $ */
2/** @file
3 * kDbg - The Debug Info Read, All Details and Dependencies Included.
4 */
5
6/*
7 * Copyright (c) 2006-2007 knut st. osmundsen <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with This program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef ___k_kDbgAll_h___
26#define ___k_kDbgAll_h___
27
28#include <k/kDefs.h>
29#include <k/kTypes.h>
30#include <k/kRdr.h>
31#include <k/kLdr.h>
32#include <k/kDbg.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/** @defgroup grp_kDbgAll All
39 * @addtogroup grp_kDbg
40 * @{
41 */
42
43/**
44 * The debug module method table.
45 */
46typedef struct KDBGMODOPS
47{
48 /** The name of the reader. */
49 const char *pszName;
50
51 /** Pointer to the next debug module readers.
52 * This is only used for dynamically registered readers. */
53 struct KDBGMODOPS *pNext;
54
55 /**
56 * Tries to open the module.
57 *
58 * @returns 0 on success, KDBG_ERR on failure.
59 * @param ppMod Where to store the module that's been opened.
60 * @param pRdr The file provider.
61 * @param fCloseRdrs Whether the reader should be closed or not when the module is destroyed.
62 * @param off The file offset of the debug info. This is 0 if there isn't
63 * any specfic debug info section and the reader should start
64 * looking for debug info at the start of the file.
65 * @param cb The size of the debug info in the file. INT64_MAX if we don't
66 * know or there isn't any particular debug info section in the file.
67 * @param pLdrMod The associated loader module. This can be NULL.
68 */
69 int (*pfnOpen)(PKDBGMOD *ppMod, PKRDR pRdr, KBOOL fCloseRdr, KFOFF off, KFOFF cb, struct KLDRMOD *pLdrMod);
70
71 /**
72 * Closes the module.
73 *
74 * This should free all resources associated with the module
75 * except the pMod which is freed by the caller.
76 *
77 * @returns IPRT status code.
78 * @param pMod The module.
79 */
80 int (*pfnClose)(PKDBGMOD pMod);
81
82 /**
83 * Gets a symbol by segment:offset.
84 * This will be approximated to the nearest symbol if there is no exact match.
85 *
86 * @returns 0 on success. KLDR_ERR_* on failure.
87 * @param pMod The module.
88 * @param iSegment The segment this offset is relative to.
89 * The -1 segment is special, it means that the addres is relative to
90 * the image base. The image base is where the first bit of the image
91 * is mapped during load.
92 * @param off The offset into the segment.
93 * @param pSym Where to store the symbol details.
94 */
95 int (*pfnQuerySymbol)(PKDBGMOD pMod, KI32 iSegment, KDBGADDR off, PKDBGSYMBOL pSym);
96
97 /**
98 * Gets a line number entry by segment:offset.
99 * This will be approximated to the nearest line number there is no exact match.
100 *
101 * @returns 0 on success. KLDR_ERR_* on failure.
102 * @param pMod The module.
103 * @param iSegment The segment this offset is relative to.
104 * The -1 segment is special, it means that the addres is relative to
105 * the image base. The image base is where the first bit of the image
106 * is mapped during load.
107 * @param off The offset into the segment.
108 * @param pLine Where to store the line number details.
109 */
110 int (*pfnQueryLine)(PKDBGMOD pMod, KI32 iSegment, KDBGADDR uOffset, PKDBGLINE pLine);
111
112 /** This is just to make sure you've initialized all the fields.
113 * Must be identical to pszName. */
114 const char *pszName2;
115} KDBGMODOPS;
116/** Pointer to a module method table. */
117typedef KDBGMODOPS *PKDBGMODOPS;
118/** Pointer to a const module method table. */
119typedef const KDBGMODOPS *PCKDBGMODOPS;
120
121/**
122 * Register a debug module reader with the kDbgModule component.
123 *
124 * Dynamically registered readers are kept in FIFO order, and external
125 * readers will be tried after the builtin ones.
126 *
127 * @returns 0 on success.
128 * @returns KERR_INVALID_POINTER if pOps is missing bits.
129 * @returns KERR_INVALID_PARAMETER if pOps is already in the list.
130 * @param pOps The reader method table, kDbg takes owner ship of
131 * this. This must be writeable as the pNext pointer
132 * will be update. It must also stick around for as
133 * long as kDbg is in use.
134 */
135KDBG_DECL(int) kDbgModuleRegisterReader(PKDBGMODOPS pOps);
136
137
138
139/**
140 * Internal representation of a debug module.
141 */
142typedef struct KDBGMOD
143{
144 /** Magic value (KDBGMOD_MAGIC). */
145 KI32 u32Magic;
146 /** Pointer to the method table. */
147 PCKDBGMODOPS pOps;
148 /** The file provider for the file containing the debug info. */
149 PKRDR pRdr;
150 /** Whether or not to close pRdr. */
151 KBOOL fCloseRdr;
152 /** The associated kLdr module. This may be NULL. */
153 PKLDRMOD pLdrMod;
154} KDBGMOD;
155
156/** @}*/
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif
Note: See TracBrowser for help on using the repository browser.

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