VirtualBox

source: vbox/trunk/include/iprt/dbg.h@ 19542

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

IPRT: Started on debug support, RTDbg*.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
Line 
1/* $Id: dbg.h 19509 2009-05-08 02:18:39Z 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 * 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 ___iprt_dbg_h
23#define ___iprt_dbg_h
24
25#include <iprt/types.h>
26
27__BEGIN_DECLS
28
29/** @defgroup grp_rt_dbg RTDbg - Debugging Routines
30 * @ingroup grp_rt
31 * @{
32 */
33
34
35/** Debug segment index. */
36typedef uint32_t RTDBGSEGIDX;
37/** Pointer to a debug segment index. */
38typedef RTDBGSEGIDX *PRTDBGSEGIDX;
39/** Pointer to a const debug segment index. */
40typedef RTDBGSEGIDX const *PCRTDBGSEGIDX;
41/** NIL debug segment index. */
42#define NIL_RTDBGSEGIDX UINT32_C(0xffffffff)
43/** Special segment index that indicates that the offset is a relative
44 * virtual address (RVA). I.e. an offset from the start of the module. */
45#define RTDBGSEGIDX_RVA UINT32_C(0xfffffff0)
46/** Special segment index that indicates that the offset is a absolute. */
47#define RTDBGSEGIDX_ABS UINT32_C(0xfffffff1)
48
49/** Max length (including '\\0') of a symbol name. */
50#define RTDBG_SYMBOL_NAME_LENGTH (512 - 8 - 4 - 4 - 4)
51
52/**
53 * Debug symbol.
54 */
55typedef struct RTDBGSYMBOL
56{
57 /** Symbol value (address). */
58 RTUINTPTR Value;
59 /** Segment number when applicable or NIL_RTDBGSEGIDX. */
60 RTDBGSEGIDX iSeg;
61 /** Symbol size. */
62 uint32_t cb;
63 /** Symbol Flags. (reserved). */
64 uint32_t fFlags;
65 /** Symbol name. */
66 char szName[RTDBG_SYMBOL_NAME_LENGTH];
67} RTDBGSYMBOL;
68/** Pointer to debug symbol. */
69typedef RTDBGSYMBOL *PRTDBGSYMBOL;
70/** Pointer to const debug symbol. */
71typedef const RTDBGSYMBOL *PCRTDBGSYMBOL;
72
73RTDECL(PRTDBGSYMBOL) RTDbgSymbolAlloc(void);
74RTDECL(PRTDBGSYMBOL) RTDbgSymbolDup(PCRTDBGSYMBOL pSymbol);
75RTDECL(void) RTDbgSymbolFree(PRTDBGSYMBOL pSymbol);
76
77
78/**
79 * Debug line number information.
80 */
81typedef struct RTDBGLINE
82{
83 /** Address. */
84 RTUINTPTR Address;
85 /** Segment number when applicable or NIL_RTDBGSEGIDX. */
86 RTDBGSEGIDX iSeg;
87 /** Line number. */
88 uint32_t uLineNo;
89 /** Filename. */
90 char szFilename[260];
91} RTDBGLINE;
92/** Pointer to debug line number. */
93typedef RTDBGLINE *PRTDBGLINE;
94/** Pointer to const debug line number. */
95typedef const RTDBGLINE *PCRTDBGLINE;
96
97RTDECL(PRTDBGLINE) RTDbgLineAlloc(void);
98RTDECL(PRTDBGLINE) RTDbgLineDup(PCRTDBGLINE pLine);
99RTDECL(void) RTDbgLineFree(PRTDBGLINE pLine);
100
101
102/** @defgroup grp_rt_dbgas RTDbgAs - Debug Address Space
103 * @{
104 */
105RTDECL(int) RTDbgAsCreate(PRTDBGAS phDbgAs, const char *pszName, RTUINTPTR FirstAddr, RTUINTPTR LastAddr);
106RTDECL(int) RTDbgAsDestroy(PRTDBGAS phDbgAs);
107
108RTDECL(int) RTDbgAsModuleLink(PRTDBGAS phDbgAs, RTDBGMOD hDbgMod, RTUINTPTR ImageAddr);
109RTDECL(int) RTDbgAsModuleLinkSeg(PRTDBGAS phDbgAs, RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR SegAddr);
110RTDECL(int) RTDbgAsModuleUnlink(PRTDBGAS phDbgAs, RTDBGMOD hDbgMod);
111RTDECL(int) RTDbgAsModuleUnlinkByAddr(PRTDBGAS phDbgAs, RTUINTPTR ImageAddr);
112RTDECL(uint32_t) RTDbgAsModuleCount(PRTDBGAS phDbgAs);
113RTDECL(RTDBGMOD) RTDbgAsModuleByIndex(PRTDBGAS phDbgAs, uint32_t iModule);
114RTDECL(RTDBGMOD) RTDbgAsModuleByName(PRTDBGAS phDbgAs, RTUINTPTR Addr);
115RTDECL(RTDBGMOD) RTDbgAsModuleByAddr(PRTDBGAS phDbgAs, const char *pszName);
116
117RTDECL(int) RTDbgAsSymbolAdd(RTDBGAS hDbgAs, const char *pszSymbol, RTUINTPTR Addr, uint32_t cb);
118RTDECL(int) RTDbgAsSymbolByName(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol);
119RTDECL(int) RTDbgAsSymbolByNameA(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol);
120/** @} */
121
122
123/** @defgroup grp_rt_dbgmod RTDbgMod - Debug Module Interperter
124 * @{
125 */
126RTDECL(int) RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, const char *pszImgFile, const char *pszDbgFile);
127RTDECL(int) RTDbgModDestroy(RTDBGMOD hDbgMod);
128RTDECL(int) RTDbgModRetain(RTDBGMOD hDbgMod);
129RTDECL(int) RTDbgModRelease(RTDBGMOD hDbgMod);
130
131RTDECL(int) RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t cb);
132RTDECL(uint32_t) RTDbgModSymbolCount(RTDBGMOD hDbgMod);
133RTDECL(int) RTDbgModSymbolByIndex(RTDBGMOD hDbgMod, uint32_t iSymbol, PRTDBGSYMBOL pSymbol);
134RTDECL(int) RTDbgModSymbolByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymbol);
135RTDECL(int) RTDbgModSymbolByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymbol);
136RTDECL(int) RTDbgModSymbolByName(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL pSymbol);
137RTDECL(int) RTDbgModSymbolByNameA(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol);
138
139RTDECL(int) RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLine);
140RTDECL(int) RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLine);
141/** @} */
142
143/** @} */
144
145__END_DECLS
146
147#endif
148
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