1 | /* $Id: VBoxTpG.h 40603 2012-03-24 13:39:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Tracepoint Generator Structures.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012 Oracle Corporation
|
---|
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 |
|
---|
18 |
|
---|
19 | #ifndef ___VBox_VTG_h___
|
---|
20 | #define ___VBox_VTG_h___
|
---|
21 |
|
---|
22 | #include <iprt/types.h>
|
---|
23 | #include <iprt/assert.h>
|
---|
24 |
|
---|
25 | RT_C_DECLS_BEGIN
|
---|
26 |
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Probe location.
|
---|
30 | */
|
---|
31 | typedef struct VTGPROBELOC
|
---|
32 | {
|
---|
33 | uint32_t uLine : 31;
|
---|
34 | uint32_t fEnabled : 1;
|
---|
35 | uint32_t idProbe;
|
---|
36 | const char *pszFunction;
|
---|
37 | const char *pszFile;
|
---|
38 | uint8_t *pbProbe;
|
---|
39 | } VTGPROBELOC;
|
---|
40 | /** Pointer to a probe location. */
|
---|
41 | typedef VTGPROBELOC *PVTGPROBELOC;
|
---|
42 |
|
---|
43 | /** @def VTG_OBJ_SECT
|
---|
44 | * The name of the section containing the other probe data provided by the
|
---|
45 | * assembly / object generated by VBoxTpG. */
|
---|
46 | /** @def VTG_LOC_SECT
|
---|
47 | * The name of the section containing the VTGPROBELOC structures. This is
|
---|
48 | * filled by the probe macros, @see VTG_DECL_VTGPROBELOC. */
|
---|
49 | /** @def VTG_DECL_VTGPROBELOC
|
---|
50 | * Declares a static variable, @a a_VarName, of type VTGPROBELOC in the section
|
---|
51 | * indicated by VTG_LOC_SECT. */
|
---|
52 | #if defined(RT_OS_WINDOWS)
|
---|
53 | # define VTG_OBJ_SECT ".VTGObj"
|
---|
54 | # define VTG_LOC_SECT ".VTGPrLc"
|
---|
55 | # ifdef _MSC_VER
|
---|
56 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
57 | __declspec(allocate(VTG_LOC_SECT)) static VTGPROBELOC a_VarName
|
---|
58 | # elif defined(__GNUC__)
|
---|
59 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
60 | static VTGPROBELOC __attribute__((section(VTG_LOC_SECT))) a_VarName
|
---|
61 | # else
|
---|
62 | # error "Unsupported Windows compiler!"
|
---|
63 | # endif
|
---|
64 |
|
---|
65 | #elif defined(RT_OS_DARWIN)
|
---|
66 | # define VTG_OBJ_SECT "__VTGObj"
|
---|
67 | # define VTG_LOC_SECT "__VTGPrLc"
|
---|
68 | # define VTG_LOC_SEG "__VTG"
|
---|
69 | # ifdef __GNUC__
|
---|
70 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
71 | static VTGPROBELOC __attribute__((section(VTG_LOC_SECT))) a_VarName
|
---|
72 | # else
|
---|
73 | # error "Unsupported Darwin compiler!"
|
---|
74 | # endif
|
---|
75 |
|
---|
76 | #elif defined(RT_OS_OS2)
|
---|
77 | # error "OS/2 is not supported"
|
---|
78 |
|
---|
79 | #else /* Assume the rest uses ELF. */
|
---|
80 | # define VTG_OBJ_SECT ".VTGObj"
|
---|
81 | # define VTG_LOC_SECT ".VTGPrLc"
|
---|
82 | # ifdef __GNUC__
|
---|
83 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
84 | static VTGPROBELOC __attribute__((section(VTG_LOC_SECT))) a_VarName
|
---|
85 | # else
|
---|
86 | # error "Unsupported compiler!"
|
---|
87 | # endif
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | /** VTG string table offset. */
|
---|
91 | typedef uint32_t VTGSTROFF;
|
---|
92 |
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * VTG argument descriptor.
|
---|
96 | */
|
---|
97 | typedef struct VTGDESCARG
|
---|
98 | {
|
---|
99 | VTGSTROFF offType;
|
---|
100 | VTGSTROFF offName;
|
---|
101 | } VTGDESCARG;
|
---|
102 | /** Pointer to an argument descriptor. */
|
---|
103 | typedef VTGDESCARG *PVTGDESCARG;
|
---|
104 |
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * VTG argument list descriptor.
|
---|
108 | */
|
---|
109 | typedef struct VTGDESCARGLIST
|
---|
110 | {
|
---|
111 | uint8_t cArgs;
|
---|
112 | uint8_t abReserved[3];
|
---|
113 | VTGDESCARG aArgs[1];
|
---|
114 | } VTGDESCARGLIST;
|
---|
115 | /** Pointer to a VTG argument list descriptor. */
|
---|
116 | typedef VTGDESCARGLIST *PVTGDESCARGLIST;
|
---|
117 |
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * VTG probe descriptor.
|
---|
121 | */
|
---|
122 | typedef struct VTGDESCPROBE
|
---|
123 | {
|
---|
124 | VTGSTROFF offName;
|
---|
125 | uint32_t offArgList;
|
---|
126 | uint16_t idxEnabled;
|
---|
127 | uint16_t idxProvider;
|
---|
128 | uint32_t u32User;
|
---|
129 | } VTGDESCPROBE;
|
---|
130 | AssertCompileSize(VTGDESCPROBE, 16);
|
---|
131 | /** Pointer to a VTG probe descriptor. */
|
---|
132 | typedef VTGDESCPROBE *PVTGDESCPROBE;
|
---|
133 |
|
---|
134 |
|
---|
135 | /**
|
---|
136 | * Code/data stability.
|
---|
137 | */
|
---|
138 | typedef enum kVTGStability
|
---|
139 | {
|
---|
140 | kVTGStability_Invalid = 0,
|
---|
141 | kVTGStability_Internal,
|
---|
142 | kVTGStability_Private,
|
---|
143 | kVTGStability_Obsolete,
|
---|
144 | kVTGStability_External,
|
---|
145 | kVTGStability_Unstable,
|
---|
146 | kVTGStability_Evolving,
|
---|
147 | kVTGStability_Stable,
|
---|
148 | kVTGStability_Standard,
|
---|
149 | kVTGStability_End
|
---|
150 | } kVTGStability;
|
---|
151 |
|
---|
152 | /**
|
---|
153 | * Data dependency.
|
---|
154 | */
|
---|
155 | typedef enum kVTGClass
|
---|
156 | {
|
---|
157 | kVTGClass_Invalid = 0,
|
---|
158 | kVTGClass_Unknown,
|
---|
159 | kVTGClass_Cpu,
|
---|
160 | kVTGClass_Platform,
|
---|
161 | kVTGClass_Group,
|
---|
162 | kVTGClass_Isa,
|
---|
163 | kVTGClass_Common,
|
---|
164 | kVTGClass_End
|
---|
165 | } kVTGClass;
|
---|
166 |
|
---|
167 |
|
---|
168 | /**
|
---|
169 | * VTG attributes.
|
---|
170 | */
|
---|
171 | typedef struct VTGDESCATTR
|
---|
172 | {
|
---|
173 | uint8_t u8Code;
|
---|
174 | uint8_t u8Data;
|
---|
175 | uint8_t u8DataDep;
|
---|
176 | } VTGDESCATTR;
|
---|
177 | AssertCompileSize(VTGDESCATTR, 3);
|
---|
178 | /** Pointer to a const VTG attribute. */
|
---|
179 | typedef VTGDESCATTR const *PCVTGDESCATTR;
|
---|
180 |
|
---|
181 |
|
---|
182 | /**
|
---|
183 | * VTG provider descriptor.
|
---|
184 | */
|
---|
185 | typedef struct VTGDESCPROVIDER
|
---|
186 | {
|
---|
187 | VTGSTROFF offName;
|
---|
188 | uint16_t iFirstProbe;
|
---|
189 | uint16_t cProbes;
|
---|
190 | VTGDESCATTR AttrSelf;
|
---|
191 | VTGDESCATTR AttrModules;
|
---|
192 | VTGDESCATTR AttrFunctions;
|
---|
193 | VTGDESCATTR AttrNames;
|
---|
194 | VTGDESCATTR AttrArguments;
|
---|
195 | uint8_t bReserved;
|
---|
196 | } VTGDESCPROVIDER;
|
---|
197 | /** Pointer to a VTG provider descriptor. */
|
---|
198 | typedef VTGDESCPROVIDER *PVTGDESCPROVIDER;
|
---|
199 |
|
---|
200 |
|
---|
201 | /**
|
---|
202 | * VTG data object header.
|
---|
203 | */
|
---|
204 | typedef struct VTGOBJHDR
|
---|
205 | {
|
---|
206 | char szMagic[24];
|
---|
207 | uint32_t cBits;
|
---|
208 | uint32_t u32Reserved0;
|
---|
209 | PVTGDESCPROVIDER paProviders;
|
---|
210 | uintptr_t cbProviders;
|
---|
211 | PVTGDESCPROBE paProbes;
|
---|
212 | uintptr_t cbProbes;
|
---|
213 | bool *pafProbeEnabled;
|
---|
214 | uintptr_t cbProbeEnabled;
|
---|
215 | char *pachStrTab;
|
---|
216 | uintptr_t cbStrTab;
|
---|
217 | PVTGDESCARGLIST paArgLists;
|
---|
218 | uintptr_t cbArgLists;
|
---|
219 | PVTGPROBELOC paProbLocs;
|
---|
220 | PVTGPROBELOC paProbLocsEnd;
|
---|
221 | uintptr_t auReserved1[4];
|
---|
222 | } VTGOBJHDR;
|
---|
223 | /** Pointer to a VTG data object header. */
|
---|
224 | typedef VTGOBJHDR *PVTGOBJHDR;
|
---|
225 |
|
---|
226 | /** The current VTGOBJHDR::szMagic value. */
|
---|
227 | #define VTGOBJHDR_MAGIC "VTG Object Header v1.0\0"
|
---|
228 |
|
---|
229 | /** The name of the VTG data object header symbol in the object file. */
|
---|
230 | extern VTGOBJHDR g_VTGObjHeader;
|
---|
231 |
|
---|
232 | RT_C_DECLS_END
|
---|
233 |
|
---|
234 | #endif
|
---|
235 |
|
---|